Netboot Template
From Amahi Wiki
INSTALL
#Temp download/extract files mkdir -p files; echo Extracting files; unzip -q source-file -d files; mkdir -p elevated; cd elevated; # App specific variables # Constant variables--DO NOT CHANGE export NBPATH='/var/lib/tftpboot'; # Start of Install cat > ../install.sh << EOF #!/bin/bash echo Copying files; mkdir -p $NBPATH/$HDA_APP_NAME; # Copy files to Netboot cp ../files/live/vmlinuz ../files/live/initrd.img ../files/live/filesystem.squashfs -d $NBPATH/$HDA_APP_NAME; # Update PXE Menu echo Backing up menu; if [ -f $NBPATH/pxelinux.cfg/default.bu ]; then cp $NBPATH/pxelinux.cfg/default.bu $NBPATH/pxelinux.cfg/default else cp $NBPATH/pxelinux.cfg/default $NBPATH/pxelinux.cfg/default.bu fi # Append app menu to default echo Updating menu; if [ -d $NBPATH/menu ]; then cp ../$HDA_APP_NAME.mnu $NBPATH/menu cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default else mkdir $NBPATH/menu cp ../$HDA_APP_NAME.mnu $NBPATH/menu cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default fi # Copy submenu (if needed) to conf if [ -d $NBPATH/conf ]; then cp ../$HDA_APP_NAME.conf $NBPATH/conf else mkdir $NBPATH/conf cp ../$HDA_APP_NAME.conf $NBPATH/conf fi echo "Removing source files"; rm -rf ../files; echo "Install complete"; # End of Install EOF # Start of Uninstall cat > ../uninstall.sh << EOF #!/bin/bash echo Removing files; rm -rf ../files; rm -rf $NBPATH/$HDA_APP_NAME; rm -rf $NBPATH/conf/$HDA_APP_NAME.conf; rm -rf $NBPATH/menu/$HDA_APP_NAME.mnu; echo Restoring menu backup; cp $NBPATH/pxelinux.cfg/default.bu $NBPATH/pxelinux.cfg/default; if [ -f $NBPATH/menu/*.mnu ]; then cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default fi echo "Uninstall complete"; # End of Uninstall EOF # This needs to be changed to match the app. This can be a single menu or link to a sub menu cat > ../$HDA_APP_NAME.mnu << EOF LABEL $HDA_APP_NAME MENU LABEL $HDA_APP_NAME kernel menu.c32 append conf/$HDA_APP_NAME.conf EOF # This is specific to the app and may not be needed. It generates a sub menu cat > ../$HDA_APP_NAME.conf << EOF MENU TITLE $HDA_APP_NAME LABEL $HDA_APP_NAME MENU LABEL $HDA_APP_NAME kernel $HDA_APP_NAME/vmlinuz append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=788 fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs live-config EOF chmod 755 ../install.sh ../uninstall.sh; cp ../install.sh .; sudo ./install.sh; cd ..; rm -rf elevated; rm -rf *.zip;
UNINSTALL
# Uninstall mkdir -p elevated; cd elevated; cp ../uninstall.sh .; sudo ./uninstall.sh; cd ..; rm -rf elevated;