diff options
author | JulioJu | 2016-05-26 11:33:57 +0200 |
---|---|---|
committer | JulioJu | 2016-05-26 11:33:57 +0200 |
commit | 1b06bcfb2fb49c2da5a5dd08f4a65a369233381e (patch) | |
tree | ca9dafd68dfc4191772a73fc91ee829846e47b80 | |
download | aur-1b06bcfb2fb49c2da5a5dd08f4a65a369233381e.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 35 | ||||
-rw-r--r-- | PKGBUILD | 260 | ||||
-rw-r--r-- | marionnet.install | 182 |
3 files changed, 477 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..b1158d8905c7 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,35 @@ +pkgbase = marionnet-trunk + pkgdesc = Educational software. It is a virtual network laboratory: it allows users to define, configure and run complex computer networks without any need for physical setup. Very old version. + pkgver = 1 + pkgrel = 1 + url = https://launchpad.net/marionnet + install = marionnet.install + arch = i686 + arch = x86_64 + license = LGPL + makedepends = wget + makedepends = optipng + depends = xorg-server + depends = xorg-xinit + depends = xorg-server-utils + depends = gtksourceview2 + depends = libglademm + depends = graphviz + depends = xterm + depends = vde2 + depends = uml_utilities + depends = net-tools + depends = bridge-utils + depends = lib32-glibc + conflicts = marionnet + source = http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.gz + source = http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/dist/lablgtk-2.14.2.tar.gz + source = https://www.marionnet.org/download/marionnet_from_scratch/mirror/ocamlbricks-trunk.tar.gz + source = https://www.marionnet.org/download/marionnet_from_scratch/mirror/marionnet-trunk.tar.gz + sha256sums = 4f81ab86258be0eea1507dd5338c8670490f8616249821e731f8ac1c64caa4a7 + sha256sums = 4981abedabdc462303f345104042c88af227ccd50fd30a9bf48fd353ab02d0ba + sha256sums = 646b6de59a555b2e41960708cf4edfed571d88369d850a50e23bf4a4b17ed329 + sha256sums = 610c806e595be4d56ff6cded02e8d8a3091fe211487073c02ddb5132c3b4ffb6 + +pkgname = marionnet-trunk + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..5d96bdccf571 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,260 @@ +# Contributor: JulioJu < juanes 0890 at google mail dot com > +# Maintainer : JulioJu < juanes 0890 at google mail dot com > + +pkgname=('marionnet-trunk') +pkgver=1 +pkgrel=1 +pkgdesc="Educational software. It is a virtual network laboratory: it allows +users to define, configure and run complex computer networks without any need +for physical setup. Very old version." +arch=('i686' 'x86_64') +url="https://launchpad.net/marionnet" +makedepends=('wget' 'optipng') +license=('LGPL') +depends=('xorg-server' 'xorg-xinit' 'xorg-server-utils' 'gtksourceview2' 'libglademm' 'graphviz' 'xterm' 'vde2' 'uml_utilities' 'net-tools' 'bridge-utils') +if test "$CARCH" == x86_64; then + depends+=('lib32-glibc') +fi +# Not depends of camlp4 and ocaml-findlib. +conflicts=('marionnet') +source=("http://caml.inria.fr/pub/distrib/ocaml-3.12/ocaml-3.12.1.tar.gz" + 'http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/dist/lablgtk-2.14.2.tar.gz' + "https://www.marionnet.org/download/marionnet_from_scratch/mirror/ocamlbricks-trunk.tar.gz" + "https://www.marionnet.org/download/marionnet_from_scratch/mirror/marionnet-trunk.tar.gz" +) +sha256sums=('4f81ab86258be0eea1507dd5338c8670490f8616249821e731f8ac1c64caa4a7' + '4981abedabdc462303f345104042c88af227ccd50fd30a9bf48fd353ab02d0ba' + '646b6de59a555b2e41960708cf4edfed571d88369d850a50e23bf4a4b17ed329' + '610c806e595be4d56ff6cded02e8d8a3091fe211487073c02ddb5132c3b4ffb6') +install=marionnet.install + +# ################ +# MAKEDEPENDS : CREATED DURING COMPILATION but not keep +# pkgname=ocaml +# pkgver=3.12.1 +# Do not use older package (see : +# https://bugs.launchpad.net/marionnet/+bug/1580349 ) +# pkgdesc="A functional language with OO extensions" +# license=('LGPL2.1' 'custom: QPL-1.0') +# url="http://caml.inria.fr/" +# +# pkgname=lablgtk2 +# It seems we can use older package. +# pkgdesc="An Objective Caml interface to gtk2" +# license=('LGPL') +# url="http://lablgtk.forge.ocamlcore.org/" +# license=('GPL') +# +# pkgname=ocamlbricks +# pkgver=0.90.3 +# pkgdesc="Miscellaneous utility functions in OCaml for Marionnet" +# conflicts=('ocamlbricks_trunk') +# url="https://launchpad.net/ocamlbricks/" +# license=('GPL') + +build () { + OUR_MIRROR="https://www.marionnet.org/download/marionnet_from_scratch/mirror/" + PREFIX="${srcdir}/usr/local" + mkdir -p "${PREFIX}/usr/local" + OCAML_DIR="${srcdir}/ocaml-3.12.1" + LABLGTK2_DIR="${srcdir}/lablgtk-2.14.2" + MARIONNET_DIR="${srcdir}/marionnet" + OCAMLBRICK_DIR="${srcdir}/ocamlbricks" + + # Inspirated from : + # http://bazaar.launchpad.net/~marionnet-drivers/marionnet/trunk/view/head:/useful-scripts/marionnet_from_scratch + # Under + # Copyright (C) 2010 2011 2012 2013 Jean-Vincent Loddo Copyright (C) 2010 + # 2011 2012 2013 Université Paris 13 + # (LGPL) + + ### OCAML ### + + cd "${OCAML_DIR}" + + ./configure -prefix "${PREFIX}" -no-curses -no-tk + make world.opt && + make install + + make -C tools/ objinfo + + if [[ ! -e "${PREFIX}/bin/ocamlobjinfo" ]]; then + cp tools/objinfo ${PREFIX}/bin/ && + [[ -e ${PREFIX}/bin/ocamlobjinfo ]] || ln -s objinfo \ + ${PREFIX}/bin/ocamlobjinfo + fi + + ### PREPARE #### + + export PATH="${PREFIX}/bin:${PATH}" + LIB_OCAML="${PREFIX}/lib/ocaml/" + + # #### Liblgtk2 ### + cd "${LABLGTK2_DIR}" + ./configure --prefix="${PREFIX}" \ + --with-glade --without-gl --without-rsvg --without-gnomecanvas --without-gnomeui \ + --without-panel --without-gtkspell --without-gtksourceview --with-gtksourceview2 \ + --without-quartz && + make && + make opt && + make install + + + #### OCAMLBRICKS ########## + cd "${OCAMLBRICK_DIR}" +cat > CONFIGME <<EOF +ocaml_libraryprefix="${LIB_OCAML}" +libraryprefix="${LIB_OCAML}" +prefix="${PREFIX}" +configurationprefix="\${prefix}/etc" +documentationprefix="\${prefix}/share/doc" +localeprefix="\${prefix}/share/locale" +ocaml_sources="${LIB_OCAML}/caml" +ocaml_version=`ocamlc -version` +EOF + + make clean && + make && + make install + ############# MARIONNET ########### + + cd "${MARIONNET_DIR}" +cat > CONFIGME <<EOF +ocaml_libraryprefix="${LIB_OCAML}" +libraryprefix="${LIB_OCAML}" +prefix="${pkgdir}/usr/local" +configurationprefix="\${prefix}/etc" +documentationprefix="\${prefix}/share/doc" +localeprefix="\${prefix}/share/locale" +ocaml_sources="${LIB_OCAML}/caml" +ocaml_version=${ocaml_version} +EOF +# For not have step « Ajust local » below, we can put +# « localeprefix="\${prefix}/locale" » instead of +# « localeprefix="\${prefix}/share/locale" » + + make clean native +} + + +package() { + + # Fakeroot, so redifine them. + PREFIX="${srcdir}/usr/local" + MARIONNET_DIR="${srcdir}/marionnet" + export PATH="${PREFIX}/bin:${PATH}" + LIB_OCAML="${PREFIX}/lib/ocaml" + + cd ${MARIONNET_DIR} + echo $PWD + make install + + # Build ${pkgdir}/etc/marionnet/marionnet.conf + echo "* Generating ${pkgdir}/etc/marionnet/marionnet.conf" + + if [[ -f ${pkgdir}/usr/local/share/marionnet/marionnet.conf ]]; then + MARIONNET_DOT_CONF=${pkgdir}/usr/local/share/marionnet/marionnet.conf + elif [[ -f ${pkgdir}/usr/local/etc/marionnet/marionnet.conf ]]; then + MARIONNET_DOT_CONF=${pkgdir}/usr/local/etc/marionnet/marionnet.conf + else + echo "File \`marionnet.conf' not found. Exiting."; + exit 3 + fi + + function first_installed_binary_of_list { + local i + for i in "$@"; do + if type -t $i &>/dev/null; then + echo $i + return 0 + fi + done + # otherwise return the first: + echo $1 + } + + MARIONNET_KEYBOARD_LAYOUT=$(echo $LANG | grep -o '^[a-z]*') + MARIONNET_KEYBOARD_LAYOUT=${MARIONNET_KEYBOARD_LAYOUT=:-us} + MARIONNET_PDF_READER=$(first_installed_binary_of_list evince okular kpdf xpdf gv) + MARIONNET_POSTSCRIPT_READER=$MARIONNET_PDF_READER + MARIONNET_DVI_READER=$MARIONNET_PDF_READER + MARIONNET_HTML_READER=$(first_installed_binary_of_list firefox epiphany galeon konqueror rekonq chromium opera) + MARIONNET_TEXT_EDITOR=$(first_installed_binary_of_list emacs gedit kate kwrite xemacs) + + for i in MARIONNET_{PDF,POSTSCRIPT,DVI,HTML}_READER MARIONNET_TEXT_EDITOR MARIONNET_KEYBOARD_LAYOUT; do + v=$(eval echo \$$i); + sed -i -e "s/$i=\(.*\)/$i=$v/" $MARIONNET_DOT_CONF + done + + if [[ ! -f ${pkgdir}/etc/marionnet/marionnet.conf ]]; then + echo "* Installing ${pkgdir}/etc/marionnet/marionnet.conf ..." + mkdir -p ${pkgdir}/etc/marionnet/ + cp $MARIONNET_DOT_CONF ${pkgdir}/etc/marionnet/ + fi + + ### Make alias + + cd ${pkgdir}/usr/local/bin + + ln -sf marionnet.native marionnet + + #### Generate Daemon #### + + mkdir -p "${pkgdir}/usr/lib/systemd/system/" + cd "${pkgdir}/usr/lib/systemd/system/" + +cat > marionnetdaemon.service <<EOF +# Generating by makepkg from PKGBUILD +# (LGPL) +[UNIT] +Description="Marionnet daemon for graphics on virtual machines and host sockets" + +[Service] +Type=simple +ExecStart=/usr/local/sbin/marionnet-daemon.native +KillMode=process +Restart=on-failure + +[Install] +WantedBy=graphical.target +EOF + + # Fix bug https://bugs.launchpad.net/marionnet/+bug/1580349 + + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/launcher-icons/marionnet-launcher.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.cable-serial.small.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.script-analyse-3.med.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/marionnet-launcher.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.cable-serial-left-right.small.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.uml-gray.small.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.dado.24.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.resource-2.med.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.dado-no.24.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.xml-16.inv.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.script-finish.med.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.software-gray.small.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.script-start-2.med.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.cable-serial.xxl.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.diffuser.orig.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.hardware-gray.small.png + optipng -quiet -fix ${pkgdir}/usr/local/share/marionnet/images/ico.cable-serial-left-right.large.png + + + # Adjust LOCALES + # `/usr/share/locale' vs `/usr/local/share/locale' + # Under Arch, locales are under /usr/share/local and not + # /usr/local/share/locale + + SOURCE="${pkgdir}/usr/local/share/locale" + DEST="${pkgdir}/usr/share/locale/" + mkdir -p ${DEST} + # Move `marionnet.mo' files from $SOURCE to $DEST: + echo "* Moving installed locales into ${DEST}" + pushd >/dev/null ${SOURCE} + find . -name "marionnet.mo" | xargs tar -cf - | tar -C ${DEST} -xf - + popd >/dev/null + rm -Rf ${SOURCE} + +} + +# vim: ft=sh: diff --git a/marionnet.install b/marionnet.install new file mode 100644 index 000000000000..dce302d37894 --- /dev/null +++ b/marionnet.install @@ -0,0 +1,182 @@ + +# Adapted from : +# http://bazaar.launchpad.net/~marionnet-drivers/marionnet/trunk/view/head:/useful-scripts/marionnet_from_scratch +# (LGPL) + +pre_install() { + # ============================================================= + # Install marionnet_kernels and filesystems + # ============================================================= + echo ">>> Warning! Download marionnet kernels and filesystems (Linux + distributions Debian Lenny, Mandriva, Pinocchio, etc.)" + echo -e ">>> Warning! this operation can take many and many hours! \n\n\n" + wget http://www.marionnet.org/downloads/marionnet_from_scratch/marionnet_from_scratch + echo -e "\n\n\n>>>\`./marionnet_from_scratch --download-only -m trunk\`" + chmod +x ./marionnet_from_scratch + ./marionnet_from_scratch --download-only -m trunk + +} + +post_install () { + + +# Here $SUDO_OR_NOTHING is null +tmpfile=$(mktemp /tmp/marionnetInstallTmpXXXXXXX) + +# ============================================================= +# Adjust X -nolisten tcp +# ============================================================= + +function remove_nolisten_assignment_from { +# global SUDO_OR_NOTHING +local i=$1 +$SUDO_OR_NOTHING sed -i -e 's/\(^[a-ZA-Z0-9]*[=].*[-]nolisten tcp.*\)$/#\1\n\1/g' $i +$SUDO_OR_NOTHING sed -i -e 's/\(^[a-ZA-Z0-9]*[=].*\)[-]nolisten tcp\(.*\)$/\1 \2/g' $i +} + +function remove_nolisten_X_or_startx_actuals_from { +# global SUDO_OR_NOTHING +local i=$1 +$SUDO_OR_NOTHING sed -i -e 's/\(^[a-ZA-Z0-9/: ]*X.*\)[-]nolisten tcp\(.*\)$/\1\2/g' $i +$SUDO_OR_NOTHING sed -i -e 's/\(^[a-ZA-Z0-9/: ]*startx.*\)[-]nolisten tcp\(.*\)$/\1\2/g' $i +} + +function remove_DisallowTCP_from { +# global SUDO_OR_NOTHING +local i=$1 +$SUDO_OR_NOTHING sed -i -e 's/\(^DisallowTCP=true.*\)$/#\1\nDisallowTCP=false/g' $i +} + +# Sections in file have the form "[security]" +function ensure_section_and_binding { +[[ $# -ge 3 ]] || return 1 +local SECTION=$1 # ex: security +local VARIABLE=$2 # ex: Enable +local VALUE=$3 # ex: true +local AWK_PROGRAM +shift 3 +AWK_PROGRAM=" +BEGIN {x=0} +/\[$SECTION\]/ {x=1;print;next} +(x==1) && /$VARIABLE=.*/ {print \"$VARIABLE=$VALUE\"; x=2; next} +(x==1) && /\[.*\]/ {print \"$VARIABLE=$VALUE\n\"; print; x=2; next} +/\[.*\]/ {print;next} +{print} + END {if (x==0) print \"[$SECTION]\"; if (x==0 || x==1) print \"$VARIABLE=$VALUE\n\";}" + case $# in + 0) awk "$AWK_PROGRAM" ;; + *) + local i + local TMPFILE=$(tmpfile) + for i in "$@"; do + awk 0<"$i" 1>$TMPFILE "$AWK_PROGRAM" + cat $TMPFILE 1>"$i" + done + rm $TMPFILE + ;; + esac +} + +# This is needed, for instance, for ubuntu 10.10 +function ensure_DisallowTCP_false_to_gdm_custom_dot_conf { +# global SUDO_OR_NOTHING CHANGED_FILES +local custom=${1:-/etc/gdm/custom.conf} +local TMPFILE=$(tmpfile) +cp $custom $TMPFILE +ensure_section_and_binding "security" "DisallowTCP" "false" $TMPFILE +ensure_section_and_binding "xdmcp" "Enable" "true" $TMPFILE +if ! diff -q $custom $TMPFILE >/dev/null; then + CHANGED_FILES+="$custom " + $SUDO_OR_NOTHING bash -c "cat $TMPFILE >$custom" +fi +} + +# This is needed, for instance, for ubuntu 12.04 +function ensure_xserver_allow_tcp_in_lightdm_dot_conf { +# global SUDO_OR_NOTHING CHANGED_FILES +local custom=${1:-/etc/lightdm/lightdm.conf} +local TMPFILE=$(tmpfile) +cp $custom $TMPFILE +ensure_section_and_binding "SeatDefaults" "xserver-allow-tcp" "true" $TMPFILE +if ! diff -q $custom $TMPFILE >/dev/null; then + CHANGED_FILES+="$custom " + $SUDO_OR_NOTHING bash -c "cat $TMPFILE >$custom" +fi +} + + +function apply_all_filters { +# global CHANGED_FILES +local i=$1 +cat $i > $BACKUP +{ remove_nolisten_assignment_from $i; + remove_DisallowTCP_from $i; + remove_nolisten_X_or_startx_actuals_from $i; +} || true +diff -q $BACKUP $i >/dev/null || { +CHANGED_FILES+="$i " + } +} + +function adjust_X_display_manager { +# global SUDO_OR_NOTHING CHANGED_FILES +local BACKUP=$(tmpfile) +DIRS=$($SUDO_OR_NOTHING find /etc/ -type d -name "?dm") +if [[ -d /etc/X11/xinit ]]; then DIRS+=" /etc/X11/xinit/"; fi +FILES=$([[ -n $DIRS ]] && $SUDO_OR_NOTHING find $DIRS -name "*rc" -o -name "*.conf") +FILES=$(for i in $FILES; do grep -l "^[a-zA-Z0-9/_\-= ]*[-]nolisten tcp" $i; done) +for i in $FILES; do apply_all_filters $i; done +rm -f $BACKUP +# A special case: gdm/gdm3 : +if [[ -d /etc/gdm ]]; then + $SUDO_OR_NOTHING touch /etc/gdm/custom.conf + ensure_DisallowTCP_false_to_gdm_custom_dot_conf +elif [[ -d /etc/gdm? ]]; then + $SUDO_OR_NOTHING touch /etc/gdm?/custom.conf /etc/gdm?/daemon.conf + ensure_DisallowTCP_false_to_gdm_custom_dot_conf /etc/gdm?/custom.conf + ensure_DisallowTCP_false_to_gdm_custom_dot_conf /etc/gdm?/daemon.conf +fi +# Another special case: lightdm +if [[ -d /etc/lightdm ]]; then + $SUDO_OR_NOTHING touch /etc/lightdm/lightdm.conf + ensure_xserver_allow_tcp_in_lightdm_dot_conf +fi +[[ -n $CHANGED_FILES ]] +} + +if ps -A -o cmd | grep -q '^[a-zA-Z0-9/]*X.*[-]nolisten tcp'; then + echo '---' + echo "* Warning: your X server has been launched with the option '-nolisten tcp'" + echo " => This option should be removed from your X display manager configuration." + echo -n " Shall I try to fix it ([y]/n)? " + read z + if [[ $z != n && $z != N ]]; then + if adjust_X_display_manager; then + echo " >>> READ THIS LINES READ THIS LINES READ THIS LINES \ + READ THIS LINES READ THIS LINES READ THIS LINES READ THIS LINES \ + WARNIN READ THIS LINES READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES READ THIS LINES WARNIN \ + READ THIS LINES READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES READ THIS LINES" + echo " Ok. File(s) changed: $CHANGED_FILES" + echo " You must restart your X display manager for the changes to take effect." + else + echo " >>> READ THIS LINES READ THIS LINES READ THIS LINES \ + READ THIS LINES READ THIS LINES READ THIS LINES READ THIS LINES \ + WARNIN READ THIS LINES READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES READ THIS LINES WARNIN \ + READ THIS LINES READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES \ + READ THIS LINES WARNIN READ THIS LINES READ THIS LINES" + echo " Sorry, no change performed: you must edit your configuration manually." + fi + fi +fi + +} + + +# vim: ft=sh |