# # script to install a local boot option # for LTSP # and get hardware specs # of client for the lts.conf file # Ubuntu installation on /dev/hda2 needed! # the script copies the two files # 'vmlinuz.ltsp' and 'initrd.lts' # to the local machine. The local machine # is supposed to have a Ubuntu installation # on /dev/hda2 (i.e. windows on the 1st) # It then edits the grub-menu to # add a menu entry for the local boot for LTSP # adds a password and deletes recovery mode entry # The script can be used to update the bootloader # after a windows installation # After that it gets hardware specs of the client # and sends them to the server to use in lts.conf # start needed services # nfs /etc/init.d/portmap start /etc/init.d/nfs-kernel-server start /etc/init.d/nfs-common start # create directory for nfs mount mkdir nfs mount 192.168.0.254:/tftpboot nfs # create dirctory on /dev/hda2 and copy boot files mkdir -p /mnt/hda2 mount -t ext3 /dev/hda2 /mnt/hda2 cp /nfs/lts/pxe/vmlinuz.ltsp /mnt/hda2/boot/. cp /nfs/lts/pxe/initrd.lts /mnt/hda2/boot/. HDLOCAL="/mnt/hda2" # add menu entry in grub, if not already there if ! grep Etherboot $HDLOCAL/boot/grub/menu.lst then sed '/End Default Options/s|$|\n\n##added\ntitle Etherboot\nroot (hd0,1)\nkernel /boot/vmlinuz.ltsp\ninitrd /boot/initrd.lts\nboot\n\n##/added|' $HDLOCAL/boot/grub/menu.lst > tmp.txt cp -v $HDLOCAL/boot/grub/menu.lst $HDLOCAL/boot/grub/menu.lst.orig cp -v tmp.txt $HDLOCAL/boot/grub/menu.lst fi # add md5 password to grub # default password is mydeartcv # PASSWORD="$1$nU0qE$KghZa4V91tV3xpDu/rbOG0" PASSWORD="$1$nU0qE$KghZa4V91tV3xpDu/rbOG0" if ! grep hiddenmenu $HDLOCAL/boot/grub/menu.lst then sed '/End Default Options/s|$|\nhiddenmenu\npassword --md5 '"$PASSWORD"'\n|;/^title.*recovery mode/,/^boot/d' $HDLOCAL/boot/grub/menu.lst > tmp.txt cp -v $HDLOCAL/boot/grub/menu.lst $HDLOCAL/boot/grub/menu.lst.orig2 cp -v tmp.txt $HDLOCAL/boot/grub/menu.lst fi # update grub grub-install --root-directory=/mnt/hda2 /dev/hda # section hardware detection # prompt for client name (number on case) # and comments (like serial mouse) FILENAME=$(ifconfig eth0|sed -n 's/.*HWaddr //p') echo "HARDWARE DETECTION FOR LTSP" echo "Please enter client no:[Ctrl-C to end script here]" read CLIENT echo "Please enter comment:" read COMMENT echo "$CLIENT" >tmp.txt echo "$COMMENT" >>tmp.txt # get specs of local machine lspci -vv >> tmp.txt ifconfig >>tmp.txt fdisk -l >>tmp.txt cat /proc/meminfo >>tmp.txt # copy specs file to server cp tmp.txt /nfs/clients/"$CLIENT""-""$FILENAME" #reboot