#!/bin/bash # This script is licensed under GPL v3 or higher. # Some usefull values eval $(n4d-vars getvalues SRV_IP) NBD_SERVER=$SRV_IP EXTRA_LLIUREX_OPTS=" --accept-unsigned-packages --mirroronnet --purge-chroot" actions_on_fail() { # First umount /net/mirror/ on ltsp client umount -l /opt/ltsp/$chroot/net/mirror/llx1306 umount -l "/opt/ltsp/$chroot/proc" umount -l "/opt/ltsp/$chroot/sys" umount -l "/opt/ltsp/$chroot/dev/pts" umount -l "/opt/ltsp/$chroot/dev" # DANGEROUS... # If not lliurex-version remove all and exit #CATCH=0 #chroot /opt/ltsp/$chroot/ lliurex-version | grep -q "cdd" || CATCH=1 #if [ ${CATCH} -eq 1 ]; then # rm -rf "/opt/ltsp/$chroot" # [ ! -f "/opt/ltsp/images/$chroot.img" ] || rm -f "/opt/ltsp/images/$chroot.img" #fi # If lliurex-version on chroot, not all hope is abandoned... # but no entry at pxe. } usage() { echo "Usage: lliurex-ltsp-create-client [desktop | client | infantil | musica | pime | lite ]" echo "Usage: lliurex-ltsp-create-client [desktop-64 | client-64 | infantil-64 | musica-64 | pime-64 | lite-64 ]" exit 1 } if [ $# -ne 1 ]; then echo "lliurex-ltsp-create-client needs a parameter" exit 1 fi # Check properly permissions chmod 755 /opt/ltsp/images # To the turron CHROOT_NAME=$1 case "$CHROOT_NAME" in "desktop") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-desktop.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "desktop-64") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-desktop-64.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "client") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-client.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "client-64") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-client-64.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "infantil-64") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-infantil-64.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "infantil") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-infantil.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "musica") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-music.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "musica-64") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-music-64.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "pime") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-pime.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "pime-64") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-pime-64.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "lite") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-lite.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; "lite-64") ALL_IS_OK=0 ltsp-build-client --config "/etc/ltsp/lliurex-ltsp-lite-64.conf" ${EXTRA_LLIUREX_OPTS} && ALL_IS_OK=1 ;; *) usage ;; esac echo $menulabel; #echo "LliureX LTSP creating image... it will take a lot of time... take a coffee patiently." #echo "ltsp-build-client command is:" #echo 'ltsp-build-client --mirror file:///net/mirror/llx1306 --security-mirror none --updates-mirror none --accept-unsigned-packages --mirroronnet --chroot='$chroot' --dist pandora --late-packages "'$metapackage' lliurex-ltsp-client epoptes-client devilspie" --debconf-seeds /usr/share/live/build/preseed/'$metapackage' '$arch' --purge-chroot' #ltsp-build-client --mirror file:///net/mirror/llx1306 --security-mirror none --updates-mirror none --accept-unsigned-packages --mirroronnet --chroot=$chroot --dist pandora --late-packages "$metapackage ${CUSTOM_PACKAGES}" --debconf-seeds /usr/share/live/build/preseed/$metapackage $arch --purge-chroot || umount -l /opt/ltsp/$chroot/net/mirror/llx1306 if [ ${ALL_IS_OK} -ne 1 ]; then actions_on_fail else echo "LliureX LTSP updating PXELINUX... " exit 0 fi /usr/share/lliurex-ltsp/llx-create-pxelinux.sh exit 0