http://proxy.asn-graz.ac.at/~d4e/experimental/
tar xvfj vlizedlab.x86_64.tar.bz2 -C /
/srv/tftpboot
/opt/s4e/vlizedlab
/usr/share/vlizedlab/scripts/vb…
/vm/vb/Windows7…
LABEL vlizedlabclient32 MENU LABEL V'lizedLab Client 32-bit installieren KERNEL /vlizedlab/i386/boot/vmlinuz APPEND ip=dhcp boot=live netboot=nfs nfsroot=192.168.100.14:/daten/tftpboot/vlizedlab/i386/ root=/dev/nfs initrd=/vlizedlab/i386/boot/initrd.img FAI_FLAGS="verbose,createvt" FAI_ACTION=install hostname=vlclientde panic=60 vga=788 fb=false nomodeset LABEL vlizedlabclient64 MENU LABEL V'lizedLab Client 64-bit installieren KERNEL /vlizedlab/amd64/boot/vmlinuz APPEND ip=dhcp boot=live netboot=nfs nfsroot=192.168.100.14:/daten/tftpboot/vlizedlab/amd64/ root=/dev/nfs initrd=/vlizedlab/amd64/boot/initrd.img FAI_FLAGS="verbose,createvt" FAI_ACTION=install hostname=vlclientde panic=60 vga=788 fb=false nomodeset
apt-get update apt-get install mc vim htop hwinfo screen virtualbox virtualbox-ose hal ntpdate ntfs-3g apt-get dist-upgrade
apt-get purge linux-headers-3.1.0-1-486 linux-headers-3.1.0-1-686-pae linux-headers-3.1.0-1-common linux-image-3.1.0-1-486 linux-image-3.1.0-1-686-pae linux-kbuild-3.1 linux-headers-3.2.0-2-486 linux-image-3.2.0-2-486 linux-image-486
vi /etc/default/grub
update-grup
ntpdate bgweiz.at; hwclock -w -u; date
...
exec vlstartvbmachine vb/d4e2012 &
exec xterm -fn 9x15bold -title "Virtual Machine Start Menu" -e /usr/share/vlizedlab/scripts/startmenustudent
#!/bin/bash # normally started as user Student within X VLCOMMON=/usr/share/vlizedlab/scripts/common if [ -f $VLCOMMON ]; then source $VLCOMMON ; else exit 1; fi TITLE="VlizedlabClient - Bundesgymnasium und Bundesrealgymnasium Weiz - `hostname`" sleep 1 DOEXIT=no while [ "$DOEXIT" != yes ]; do MENU="" NR=1 for XC in \ `find $VBHOME -maxdepth 2 -a -type f -a \( -name '*.sh' -o -name '*.vdi' \) -exec dirname {} \; \ | sort -ru ` ; do MNAME=`basename $XC` MDIR=`dirname $XC` MTOOL=`basename $MDIR` MENU="$MENU $NR ${MNAME}" NR=`expr $NR + 1` done MENU="$MENU u Wechseldatenträger_aushängen x xterm t Beenden" choice=`dialog --cr-wrap \ --backtitle "$TITLE" \ --defaultno \ --menu 'Bitte auswählen:' 0 0 0 $MENU 3>&1 1>&2 2>&3` clear #echo "Updating Virtual Machine $choice" case $choice in [1-9]|[0-9][0-9]) VM="" NR=1 for XC in \ `find $VBHOME -maxdepth 2 -a -type f -a \( -name '*.sh' -o -name '*.vdi' \) -exec dirname {} \; \ | sort -ru ` ; do if [ "$NR" = "$choice" ]; then MNAME=`basename $XC` MDIR=`dirname $XC` MTOOL=`basename $MDIR` fi NR=`expr $NR + 1` done if [ "$MTOOL" = vb ]; then vlstartvbmachine $MTOOL/$MNAME fi echo "waiting..." ;; um) clear devmon --unmount-recent sleep 2 ;; u) clear devmon --unmount-all sleep 2 ;; vv) sudo /usr/sbin/vlviewremote -viewonly ;; v) sudo /usr/sbin/vlviewremote ;; sr) vlsetresolution menu ;; x) xterm -e bash -c "echo 'Logging in as user >student<; Please provide password.'; sudo /bin/login student" & ;; t) DOEXIT=yes ;; esac done
... --kpress(ALTMETA.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')"), --kpress(ALTMETA.."F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"), ... bdoc("Query for manual page to be displayed."), --kpress(ALTMETA.."F1", "mod_query.query_man(_, ':man')"), bdoc("Show the Ion manual page."), --kpress(META.."F1", "ioncore.exec_on(_, ':man ion3')"), bdoc("Run a terminal emulator."), --kpress(ALTMETA.."F2", "ioncore.exec_on(_, XTERM or 'x-terminal-emulator')"), bdoc("Query for command line to execute."), --kpress(ALTMETA.."F3", "mod_query.query_exec(_)"), bdoc("Query for Lua code to execute."), --kpress(META.."F3", "mod_query.query_lua(_)"), bdoc("Query for host to connect to with SSH."), --kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"), bdoc("Query for file to edit."), --kpress(ALTMETA.."F5", -- "mod_query.query_editfile(_, 'run-mailcap --action=edit')"), bdoc("Query for file to view."), --kpress(ALTMETA.."F6", -- "mod_query.query_runfile(_, 'run-mailcap --action=view')"), bdoc("Query for workspace to go to or create a new one."), --kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"), bdoc("Query for a client window to go to."), --kpress(META.."G", "mod_query.query_gotoclient(_)"), bdoc("Display context menu."), --kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"), --kpress(META.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"), ...
... --dopath("mod_statusbar") --dopath("mod_dock") ...
chmod 4755 /usr/lib/dbus-1.0/dbus-daemon-launch-helper
... 0 20 * * * /sbin/halt
#!/bin/bash -x VERSION=2 echo "starting MACHINE >$MACHINE< in >$MACHINEDIR<" VBoxManage --nologo createvm --name $MACHINE --register --basefolder $MACHINEDIR VBoxManage --nologo modifyvm $MACHINE --synthcpu on --memory 1536 --vram 21 --pae off --ioapic on --hwvirtex off --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 1 --nic1 nat --audio alsa --accelerate2dvideo on --accelerate3d on if [ -f $MACHINEDIR/init.add.sh ]; then source $MACHINEDIR/init.add.sh fi ( sleep 10 && ( VBoxManage controlvm $MACHINE setvideomodehint 800 600 32 ) ) &
VBoxManage --nologo modifyvm $MACHINE --ostype "Windows7" VBoxManage --nologo modifyvm $MACHINE --nictype1 "82540EM" --audiocontroller hda VBoxManage --nologo storagectl $MACHINE --name C$MACHINE --add sata --controller IntelAHCI --hostiocache on VBoxManage --nologo sharedfolder add $MACHINE --name media --hostpath /media --automount mtyp="immutable" #mtyp="normal" VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ --type hdd --medium $MACHINEDIR/$MACHINE.vdi --mtype $mtyp #VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ # --type dvddrive --medium $MACHINEDIR/Windows7_AIO.iso
VBoxManage --nologo modifyvm $MACHINE --ostype "WindowsXP" VBoxManage --nologo modifyvm $MACHINE --nictype1 "Am79C970A" --audiocontroller hda VBoxManage --nologo storagectl $MACHINE --name C$MACHINE --add ide --controller PIIX4 --hostiocache on VBoxManage --nologo sharedfolder add $MACHINE --name media --hostpath /media --automount mtyp="immutable" #mtyp="normal" VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ --type hdd --medium $MACHINEDIR/$MACHINE.vdi --mtype $mtyp #VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ # --type dvddrive --medium $MACHINEDIR/WindowsXP.iso
VBoxManage --nologo modifyvm $MACHINE --ostype "OpenSUSE" VBoxManage --nologo modifyvm $MACHINE --nictype1 "82540EM" --audiocontroller ac97 VBoxManage --nologo storagectl $MACHINE --name C$MACHINE --add ide --controller PIIX4 --hostiocache off VBoxManage --nologo sharedfolder add $MACHINE --name media --hostpath /media --automount mtyp="immutable" #mtyp="normal" VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ --type hdd --medium $MACHINEDIR/$MACHINE.vdi --mtype $mtyp #VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ # --type dvddrive --medium $MACHINEDIR/d4e2012.i586.iso
VBoxManage --nologo modifyvm $MACHINE --synthcpu on --memory 3000 --vram 21 --pae on --ioapic on --hwvirtex on --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 1 --nic1 nat --audio alsa --accelerate2dvideo off --accelerate3d off VBoxManage --nologo modifyvm $MACHINE --ostype "Windows8" VBoxManage --nologo modifyvm $MACHINE --nictype1 "82540EM" --audiocontroller hda VBoxManage --nologo storagectl $MACHINE --name C$MACHINE --add sata --controller IntelAHCI --hostiocache on VBoxManage --nologo sharedfolder add $MACHINE --name media --hostpath /media --automount mtyp="immutable" #mtyp="normal" VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ --type hdd --medium $MACHINEDIR/$MACHINE.vdi --mtype $mtyp #VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ # --type dvddrive --medium $MACHINEDIR/de_windows_8_x64_x86_aio.iso
VBoxManage --nologo modifyvm $MACHINE --ostype "Debian" VBoxManage --nologo modifyvm $MACHINE --chipset piix3 --pagefusion on VBoxManage --nologo storagectl $MACHINE --name C$MACHINE --add ide --controller PIIX4 --hostiocache on VBoxManage --nologo modifyvm $MACHINE --mouse usbtablet VBoxManage --nologo sharedfolder add $MACHINE --name media --hostpath /media --automount VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ --type dvddrive --medium $MACHINEDIR/d4e2012-live.iso
#!/bin/bash MACHINE="geogebra" MACHINEDIR="/home/matthias/Downloads/geogebra" rm -rf $MACHINEDIR/$MACHINE VBoxManage --nologo createvm --name $MACHINE --register --basefolder $MACHINEDIR VBoxManage --nologo modifyvm $MACHINE --synthcpu on --memory 1536 --vram 21 --ioapic on --hwvirtex off --bioslogofadein off --bioslogofadeout off --bioslogodisplaytime 1 --nic1 nat --audio alsa --accelerate2dvideo on --accelerate3d on VBoxManage --nologo modifyvm $MACHINE --ostype "Debian" VBoxManage --nologo modifyvm $MACHINE --chipset piix3 --pagefusion on VBoxManage --nologo storagectl $MACHINE --name C$MACHINE --add ide --controller PIIX4 --hostiocache on VBoxManage --nologo modifyvm $MACHINE --mouse usbtablet VBoxManage --nologo storageattach $MACHINE --storagectl C$MACHINE --port 1 --device 0 \ --type dvddrive --medium $MACHINEDIR/geogebra-lernstick-2014-02-18.iso VBoxManage --nologo startvm $MACHINE 2>&1 3>&1
/home/student/.xinitrc /usr/share/vlizedlab/scripts/vb.init.default.sh
#!/bin/bash udp-receiver --nosync --nokbd | tar -xvz -C /
chmod 700 /usr/local/bin/getfiles
tar -czv udpcastlist `cat udpcastlist` | udp-sender
vludpreceiveVMs
vludpsendVMs
cfdisk /dev/sda
sda1 Boot-Flag Primary Linux 5229.51MB sda2 Primary Linux-swap 2113.90MB sda3 Primary Linux Rest
mkfs.ext2 /dev/sda1 mkswap /dev/sda2 mkfs.xfs /dev/sda3
rsync -av -P --exclude=dev --exclude=proc --exclude=sys --exclude=vm -e ssh root@192.168.100.130:/ /media/sda1/.
rsync -av -P -e ssh root@192.168.100.130:/vm/ /media/sda3/.
mkdir /media/sda3/{dev,proc,sys,vm} rm /media/sda1/etc/udev/rules.d/70-persistent-net.rules
mount --bind /proc /media/sda1/proc mount --bind /dev /media/sda1/dev mount --bind /sys /media/sda1/sys
chroot /media/sda1 /bin/bash
grub-install /dev/sda update-grub
exit; umount /media/sda1/proc /media/sda1/dev /media/sda1/sys; reboot
authoritative; ddns-update-style none; # eth2 unterrichtsnetz subnet 192.168.100.0 netmask 255.255.255.0 { authoritative; range 192.168.100.161 192.168.100.200; range 192.168.100.30 192.168.100.100; default-lease-time 14400; max-lease-time 172800; option broadcast-address 192.168.100.255; option routers 192.168.100.254; option subnet-mask 255.255.255.0; option netbios-name-servers 192.168.100.254; option netbios-node-type 8; option domain-name-servers 193.170.221.1, 8.8.4.4, 8.8.8.8; option ntp-servers 193.170.221.1; # pxe filename "pxelinux.0"; next-server 192.168.100.14; } # AULA HP xw4400 Workstation host aula01 { hardware ethernet 00:1c:c4:32:0b:b7; fixed-address 192.168.100.74; } host aula02 { hardware ethernet 00:15:60:a4:48:7f; fixed-address 192.168.100.75; } host aula03 { hardware ethernet 00:1b:78:b0:8c:2c; fixed-address 192.168.100.76; } host aula04 { hardware ethernet 00:1c:c4:32:0a:30; fixed-address 192.168.100.77; } host aula05 { hardware ethernet 00:1c:c4:32:07:88; fixed-address 192.168.100.78; } host aula06 { hardware ethernet 00:1b:78:b0:86:50; fixed-address 192.168.100.79; } host aula07 { hardware ethernet 00:1b:78:a5:f6:c2; fixed-address 192.168.100.80; } host aula08 { hardware ethernet 00:1c:c4:32:0b:a0; fixed-address 192.168.100.81; } host aula09 { hardware ethernet 00:1c:c4:32:07:34; fixed-address 192.168.100.82; } host aula10 { hardware ethernet 00:1c:c4:32:0b:e5; fixed-address 192.168.100.83; } host aula11 { hardware ethernet 00:1c:c4:32:0b:db; fixed-address 192.168.100.84; } host aula12 { hardware ethernet 00:1c:c4:32:0b:a1; fixed-address 192.168.100.85; } # eth1 verwaltungsnetz subnet 192.168.238.0 netmask 255.255.255.0 { range 192.168.238.100 192.168.238.200; default-lease-time 345600; max-lease-time 691200; option broadcast-address 192.168.238.255; option routers 192.168.238.254; option subnet-mask 255.255.255.0; option netbios-name-servers 193.170.221.1; option domain-name-servers 8.8.8.8, 193.170.221.1, 8.8.8.8; option ntp-servers 193.170.221.1; }
#!/bin/bash if [ "$1" != "eg" ] && [ "$1" != "ikt" ] &&[ "$1" != "aula" ] &&[ "$1" != "ug" ] &&[ "$1" != "klabu" ]; then echo "eg / ikt / aula / ug / klabu" exit fi clients=`awk '/'$1'/ {print $2}' /etc/dhcpd.conf` if [ "$1" == "ikt" ]; then MUSTERRECHNER="192.168.100.130" elif [ "$1" == "klabu" ]; then MUSTERRECHNER="192.168.100.86" elif [ "$1" == "aula" ]; then MUSTERRECHNER="192.168.100.74" elif [ "$1" == "eg" ]; then MUSTERRECHNER="192.168.100.60" elif [ "$1" == "ug" ]; then MUSTERRECHNER="192.168.100.109" fi for client in $clients; do echo $client IP=`awk '/'$client'/ {print $8}' /etc/dhcpd.conf | tr -d ";"` if [ "$IP" != "$MUSTERRECHNER" ]; then /usr/bin/expect -c " spawn /usr/bin/ssh -q -l root $IP \" killall udp-receiver; killall VirtualBox; vlinitvbox; killall screen; rm -rf /var/run/screen; mkdir /var/run/screen; chown root:utmp /var/run/screen; screen -dm -S udp vludpreceiveVMs; \" ;\ expect \"word: \" {send \"PASSWORT\r\" } ;\ interact " fi done
#!/bin/bash if [ "$1" != "eg" ] && [ "$1" != "ikt" ] &&[ "$1" != "aula" ] &&[ "$1" != "ug" ] &&[ "$1" != "klabu" ]; then echo "eg / ikt / aula / ug / klabu" exit fi clients=`awk '/'$1'/ {print $2}' /etc/dhcpd.conf` if [ "$1" == "ikt" ]; then MUSTERRECHNER="192.168.100.130" elif [ "$1" == "klabu" ]; then MUSTERRECHNER="192.168.100.86" elif [ "$1" == "aula" ]; then MUSTERRECHNER="192.168.100.74" elif [ "$1" == "eg" ]; then MUSTERRECHNER="192.168.100.60" elif [ "$1" == "ug" ]; then MUSTERRECHNER="192.168.100.109" fi for client in $clients; do echo $client IP=`awk '/'$client'/ {print $8}' /etc/dhcpd.conf | tr -d ";"` if [ "$IP" != "$MUSTERRECHNER" ]; then /usr/bin/expect -c " spawn /usr/bin/ssh -q -l root $IP \" killall screen; rm -rf /var/run/screen; mkdir /var/run/screen; chown root:utmp /var/run/screen; screen -dm -S udp /usr/local/bin/getfiles; \" ;\ expect \"word: \" {send \"PASSWORT\r\" } ;\ interact " fi done
#!/bin/bash if [ "$1" != "eg" ] && [ "$1" != "ikt" ] &&[ "$1" != "aula" ] &&[ "$1" != "ug" ] &&[ "$1" != "klabu" ]; then echo "eg / ikt / aula / ug / klabu" exit fi clients=`awk '/'$1'/ {print $2}' /etc/dhcpd.conf` for client in $clients; do echo $client IP=`awk '/'$client'/ {print $8}' /etc/dhcpd.conf | tr -d ";"` nmap -sP $IP | grep "host up" 2>&1 >/dev/null && echo -e "\033[45;1;32m=> $IP : ON \033[0m" || echo -e "\033[44;1;33m=> $IP : OFF \033[0m" done </file> <code bash wakeup.sh> #!/bin/bash if [ "$1" != "eg" ] && [ "$1" != "ikt" ] &&[ "$1" != "aula" ] &&[ "$1" != "ug" ] &&[ "$1" != "klabu" ]; then echo "eg / ikt / aula / ug / klabu" exit fi clients=`awk '/'$1'/ {print $2}' /etc/dhcpd.conf` for client in $clients; do if [ "$1" == "klabu" ]; then sleep 0.5; else sleep 0.1; fi echo $client MAC=`awk '/'$client'/ {print $6}' /etc/dhcpd.conf | tr -d ";"` for i in {1..17} do /usr/sbin/ether-wake -i eth2 $MAC done done
#!/bin/bash if [ "$1" != "eg" ] && [ "$1" != "ikt" ] &&[ "$1" != "aula" ] &&[ "$1" != "ug" ] &&[ "$1" != "klabu" ]; then echo "eg / ikt / aula / ug / klabu" exit fi clients=`awk '/'$1'/ {print $2}' /etc/dhcpd.conf` if [ "$1" == "ikt" ]; then MUSTERRECHNER="192.168.100.130" elif [ "$1" == "klabu" ]; then MUSTERRECHNER="192.168.100.86" elif [ "$1" == "aula" ]; then MUSTERRECHNER="192.168.100.74" elif [ "$1" == "eg" ]; then MUSTERRECHNER="192.168.100.60" elif [ "$1" == "ug" ]; then MUSTERRECHNER="192.168.100.109" fi for client in $clients; do echo $client IP=`awk '/'$client'/ {print $8}' /etc/dhcpd.conf | tr -d ";"` # if [ "$IP" != "$MUSTERRECHNER" ]; then /usr/bin/expect -c " spawn /usr/bin/ssh -q -l root $IP \" poweroff; exit \" ;\ expect \"word: \" {send \"PASSWORT\r\" } ;\ interact " # fi done
feynman:~ # sh view.sh 192.168.100.xx Kennwort: eu...
Clients sind auf Plank unter /etc/dhcpd.conf zu finden
Login auf Planck cd /opt/wartung/vlizedlab Check ob alle PCs im Saal laufen: sh ping.sh ug
sh wakeup.sh ug
sh wakeup_single.sh ug01
ssh ug01 (eu...)
killall VirtualBox; vlinitvbox
vi /vm/vb/Windows7/init.add.sh
#mtyp="immutable" -> nur lesend mtyp="normal" -> schreiben & lesen
killall VirtualBox; vlinitvbox
Änderungen durchführen
Lokal als .\root (uS...) anmelden
Startmenü -> cmd -> rechte Maustaste -> Als Administrator ausführen:
cscript slmgr.vbs -skms kms.lsr-stmk.gv.at cscript slmgr.vbs -ato
cscript "\Program Files\Microsoft Office\Office14\ospp.vbs" /sethst:kms.lsr-stmk.gv.at cscript "\Program Files\Microsoft Office\Office14\ospp.vbs" /act
ifdown dsl0 ifup dsl0
… etwas Geduld …
ping kms.lsr-stmk.gv.at muss funktionieren!
Rechner sauber herunterfahren!
vi /vm/vb/Windows7/init.add.sh
mtyp="immutable" -> nur lesend #mtyp="normal" -> schreiben & lesen
killall VirtualBox; vlinitvbox
Am Planck kontrollieren, ob wirklich alle Rechner laufen. cd /opt/wartung/vlizedlab sh ping.sh ug
sh klonen.sh ug
Wenn diese Fehlermmeldung kommt: Directory '/var/run/screen' must have mode 777.
Dann
chmod 777 /var/run/screen und nochmals "screen" starten
vludpsendVMs -> "Blauer" Bildschirm erscheint, gewünschte VM zum Klonen auswählen, Liste der Clients die Lauschen erscheint -> Bestätigen... Strg+A und D screen in den Hintergrund legen
Nach dem Klonen unbedingt alle Clients komplett neu starten, am besten via Planck: sh reboot.sh ug
Bisschen warten... und erneut verbinden. Enjoy!