Difference between revisions of "Netboot Template"
From Amahi Wiki
| Line 1: | Line 1: | ||
<u>'''INSTALL'''</u> | <u>'''INSTALL'''</u> | ||
| − | <pre># App specific variables | + | <pre># INSTALL |
| − | + | # App specific variables | |
| − | + | export WAPATH=$HDA_APP_DIR/html; | |
| − | export WAPATH= | ||
# Constant variables--DO NOT CHANGE | # Constant variables--DO NOT CHANGE | ||
export NBPATH='/var/lib/tftpboot'; | export NBPATH='/var/lib/tftpboot'; | ||
| − | |||
| − | |||
| − | # Start of | + | # Start of Install |
| − | cat > html/install | + | cat > html/install.sh << EOF |
#!/bin/bash | #!/bin/bash | ||
| − | mkdir -p $NBPATH/$ | + | mkdir -p $NBPATH/$HDA_APP_NAME; |
| − | # Copy | + | # Copy files to Netboot |
| − | + | cd $WAPATH; | |
| + | cd ../unpack; | ||
| + | cp live/vmlinuz live/initrd.img live/filesystem.squashfs -d $NBPATH/$HDA_APP_NAME; | ||
# Update PXE Menu | # Update PXE Menu | ||
if [ -f $NBPATH/pxelinux.cfg/default.bu ]; then | if [ -f $NBPATH/pxelinux.cfg/default.bu ]; then | ||
| Line 23: | Line 22: | ||
# Append app menu to default | # Append app menu to default | ||
if [ -d $NBPATH/menu ]; then | if [ -d $NBPATH/menu ]; then | ||
| − | cp $WAPATH/$ | + | cp $WAPATH/$HDA_APP_NAME.mnu $NBPATH/menu |
cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default | cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default | ||
else | else | ||
mkdir $NBPATH/menu | mkdir $NBPATH/menu | ||
| − | cp $WAPATH/$ | + | cp $WAPATH/$HDA_APP_NAME.mnu $NBPATH/menu |
cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default | cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default | ||
fi | fi | ||
# Copy submenu (if needed) to conf | # Copy submenu (if needed) to conf | ||
if [ -d $NBPATH/conf ]; then | if [ -d $NBPATH/conf ]; then | ||
| − | cp $WAPATH/$ | + | cp $WAPATH/$HDA_APP_NAME.conf $NBPATH/conf |
else | else | ||
mkdir $NBPATH/conf | mkdir $NBPATH/conf | ||
| − | cp $WAPATH/$ | + | cp $WAPATH/$HDA_APP_NAME.conf $NBPATH/conf |
fi | fi | ||
| + | cd $WAPATH; | ||
| + | rm -rf ../unpack; | ||
echo "Installation complete."; | echo "Installation complete."; | ||
| − | # End of | + | # End of Install |
EOF | EOF | ||
| − | # Start of | + | # Start of Uninstall |
| − | cat > html/uninstall | + | cat > html/uninstall.sh << EOF |
#!/bin/bash | #!/bin/bash | ||
| − | # Remove | + | # Remove files |
| − | rm -rf $NBPATH/$ | + | rm -rf $NBPATH/$HDA_APP_NAME; |
| − | rm -rf $NBPATH/conf/$ | + | rm -rf $NBPATH/conf/$HDA_APP_NAME.conf; |
| − | rm -rf $NBPATH/menu/$ | + | rm -rf $NBPATH/menu/$HDA_APP_NAME.mnu; |
cp $NBPATH/pxelinux.cfg/default.bu $NBPATH/pxelinux.cfg/default; | cp $NBPATH/pxelinux.cfg/default.bu $NBPATH/pxelinux.cfg/default; | ||
if [ -f $NBPATH/menu/*.mnu ]; then | if [ -f $NBPATH/menu/*.mnu ]; then | ||
| Line 52: | Line 53: | ||
fi | fi | ||
echo "Uninstallation complete."; | echo "Uninstallation complete."; | ||
| − | # End of | + | # End of Uninstall |
EOF | EOF | ||
# This needs to be changed to match the app. This can be a single menu or link to a sub menu | # This needs to be changed to match the app. This can be a single menu or link to a sub menu | ||
| − | cat > html/$ | + | cat > html/$HDA_APP_NAME.mnu << EOF |
| − | LABEL | + | LABEL $HDA_APP_NAME |
| − | MENU LABEL | + | MENU LABEL $HDA_APP_NAME |
kernel menu.c32 | kernel menu.c32 | ||
| − | append conf/ | + | append conf/$HDA_APP_NAME.conf |
EOF | EOF | ||
# This is specific to the app and may not be needed. It generates a sub menu | # This is specific to the app and may not be needed. It generates a sub menu | ||
| − | cat > html/$ | + | cat > html/$HDA_APP_NAME.conf.old << EOF |
| − | MENU TITLE | + | MENU TITLE $HDA_APP_NAME |
| − | LABEL | + | LABEL $HDA_APP_NAME |
| − | + | MENU LABEL Normal | |
| − | + | 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 | |
| − | + | ||
| − | LABEL | + | LABEL $HDA_APP_NAME |
| − | + | MENU LABEL Failsafe | |
| − | + | kernel $HDA_APP_NAME/vmlinuz | |
| − | + | append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=normal nomodeset nosplash ip=$HDA_IPfetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs live-config | |
| + | EOF | ||
| + | |||
| + | cat > html/$HDA_APP_NAME.conf << EOF | ||
| + | MENU TITLE $HDA_APP_NAME | ||
| + | LABEL $HDA_APP_NAME | ||
| + | MENU LABEL Easy | ||
| + | kernel $HDA_APP_NAME/vmlinuz | ||
| + | append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=normal fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs ocs_prerun="mount -t cifs -v //$HDA_IP/Drivebackups /home/partimag -o user=$HDA_1ST_ADMIN" ocs_live_run="ocs-sr -gs -cs -r -j2 -k -rm-win-swap-hib -fsck-src-part -z1p -um beginner ask_user ask_user" ip=dhcp live-config | ||
| + | LABEL $HDA_APP_NAME | ||
| + | MENU LABEL Generic | ||
| + | kernel $HDA_APP_NAME/vmlinuz | ||
| + | append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=788 nomodeset nosplash vga=normal ocs_lang="" fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs live-config | ||
| + | LABEL $HDA_APP_NAME | ||
| + | MENU LABEL Expert | ||
| + | kernel $HDA_APP_NAME/vmlinuz | ||
| + | append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=normal fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs ocs_prerun="mount -t cifs -v //$HDA_IP/Drivebackups /home/partimag -o user=$HDA_1ST_ADMIN" ocs_live_run="ocs-sr -gs -cs -r -j2 -k -z1p -um expert ask_user ask_user" ip=dhcp live-config | ||
EOF | EOF | ||
| Line 92: | Line 109: | ||
<body bgcolor = "#ffffcc" text = "#000000"> | <body bgcolor = "#ffffcc" text = "#000000"> | ||
<center> | <center> | ||
| − | <img src="http://wiki.amahi.org/images/ | + | <img src="http://wiki.amahi.org/images/e/e0/Clonezilla-logo.png"></a> |
</center> | </center> | ||
| − | <h1> | + | <h1>Clonezilla Live Installed!</h1> |
| − | <p> | + | <p>Clonezilla, based on <a href="http://drbl.sf.net" target="_">DRBL</a>, <a href="http://www.partimage.org" target="_">Partition Image</a>, <a href="http://www.linux-ntfs.org/" target="_">ntfsclone</a>, <a href="http://partclone.org" target="_">partclone</a>, and <a href="http://udpcast.linux.lu/" target="_">udpcast</a>, allows you to do bare metal backup and recovery. Two types of Clonezilla are available, <a href="http://drbl.sf.net/clonezilla-live/" target="_">Clonezilla live</a> and <a href="http://drbl.sf.net/clonezilla-server-edition/" target="_">Clonezilla SE (server edition)</a>. Clonezilla live is suitable for single machine backup and restore.</p> |
<p><b>NOTE:</b> This application is a PXE network bootable OS which cannot be accessed via a web browser. Uncheck <b>List in dashboard</b> option to remove link from dashboard.</p> | <p><b>NOTE:</b> This application is a PXE network bootable OS which cannot be accessed via a web browser. Uncheck <b>List in dashboard</b> option to remove link from dashboard.</p> | ||
| Line 103: | Line 120: | ||
EOF | EOF | ||
| − | chmod 755 html/install | + | chmod 755 html/install.sh html/uninstall.sh; |
mkdir elevated; | mkdir elevated; | ||
cd elevated | cd elevated | ||
| − | cp $WAPATH/install | + | cp $WAPATH/install.sh .; |
| − | sudo ./install | + | sudo ./install.sh; |
cd ..; | cd ..; | ||
rm -rf elevated;</pre> | rm -rf elevated;</pre> | ||
Revision as of 01:24, 10 February 2014
INSTALL
# INSTALL
# App specific variables
export WAPATH=$HDA_APP_DIR/html;
# Constant variables--DO NOT CHANGE
export NBPATH='/var/lib/tftpboot';
# Start of Install
cat > html/install.sh << EOF
#!/bin/bash
mkdir -p $NBPATH/$HDA_APP_NAME;
# Copy files to Netboot
cd $WAPATH;
cd ../unpack;
cp live/vmlinuz live/initrd.img live/filesystem.squashfs -d $NBPATH/$HDA_APP_NAME;
# Update PXE 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
if [ -d $NBPATH/menu ]; then
cp $WAPATH/$HDA_APP_NAME.mnu $NBPATH/menu
cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default
else
mkdir $NBPATH/menu
cp $WAPATH/$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 $WAPATH/$HDA_APP_NAME.conf $NBPATH/conf
else
mkdir $NBPATH/conf
cp $WAPATH/$HDA_APP_NAME.conf $NBPATH/conf
fi
cd $WAPATH;
rm -rf ../unpack;
echo "Installation complete.";
# End of Install
EOF
# Start of Uninstall
cat > html/uninstall.sh << EOF
#!/bin/bash
# Remove files
rm -rf $NBPATH/$HDA_APP_NAME;
rm -rf $NBPATH/conf/$HDA_APP_NAME.conf;
rm -rf $NBPATH/menu/$HDA_APP_NAME.mnu;
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 "Uninstallation 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 > html/$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 > html/$HDA_APP_NAME.conf.old << EOF
MENU TITLE $HDA_APP_NAME
LABEL $HDA_APP_NAME
MENU LABEL Normal
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
LABEL $HDA_APP_NAME
MENU LABEL Failsafe
kernel $HDA_APP_NAME/vmlinuz
append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=normal nomodeset nosplash ip=$HDA_IPfetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs live-config
EOF
cat > html/$HDA_APP_NAME.conf << EOF
MENU TITLE $HDA_APP_NAME
LABEL $HDA_APP_NAME
MENU LABEL Easy
kernel $HDA_APP_NAME/vmlinuz
append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=normal fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs ocs_prerun="mount -t cifs -v //$HDA_IP/Drivebackups /home/partimag -o user=$HDA_1ST_ADMIN" ocs_live_run="ocs-sr -gs -cs -r -j2 -k -rm-win-swap-hib -fsck-src-part -z1p -um beginner ask_user ask_user" ip=dhcp live-config
LABEL $HDA_APP_NAME
MENU LABEL Generic
kernel $HDA_APP_NAME/vmlinuz
append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=788 nomodeset nosplash vga=normal ocs_lang="" fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs live-config
LABEL $HDA_APP_NAME
MENU LABEL Expert
kernel $HDA_APP_NAME/vmlinuz
append initrd=$HDA_APP_NAME/initrd.img boot=live union=aufs noswap noprompt vga=normal fetch=tftp://$HDA_IP/$HDA_APP_NAME/filesystem.squashfs ocs_prerun="mount -t cifs -v //$HDA_IP/Drivebackups /home/partimag -o user=$HDA_1ST_ADMIN" ocs_live_run="ocs-sr -gs -cs -r -j2 -k -z1p -um expert ask_user ask_user" ip=dhcp live-config
EOF
cat > html/index.html << EOF
<html>
<head>
<title> </title>
<style type="text/css">
<!--
h1 {text-align:center;
font-family:Arial, Helvetica, Sans-Serif;
}
p {text-indent:20px;
}
-->
</style>
</head>
<body bgcolor = "#ffffcc" text = "#000000">
<center>
<img src="http://wiki.amahi.org/images/e/e0/Clonezilla-logo.png"></a>
</center>
<h1>Clonezilla Live Installed!</h1>
<p>Clonezilla, based on <a href="http://drbl.sf.net" target="_">DRBL</a>, <a href="http://www.partimage.org" target="_">Partition Image</a>, <a href="http://www.linux-ntfs.org/" target="_">ntfsclone</a>, <a href="http://partclone.org" target="_">partclone</a>, and <a href="http://udpcast.linux.lu/" target="_">udpcast</a>, allows you to do bare metal backup and recovery. Two types of Clonezilla are available, <a href="http://drbl.sf.net/clonezilla-live/" target="_">Clonezilla live</a> and <a href="http://drbl.sf.net/clonezilla-server-edition/" target="_">Clonezilla SE (server edition)</a>. Clonezilla live is suitable for single machine backup and restore.</p>
<p><b>NOTE:</b> This application is a PXE network bootable OS which cannot be accessed via a web browser. Uncheck <b>List in dashboard</b> option to remove link from dashboard.</p>
</body>
</html>
EOF
chmod 755 html/install.sh html/uninstall.sh;
mkdir elevated;
cd elevated
cp $WAPATH/install.sh .;
sudo ./install.sh;
cd ..;
rm -rf elevated;
UNINSTALL
# App specific variables export WASNAM='pmagic'; export WAPATH='/var/hda/web-apps/pmagic/html'; # Uninstall $WASNAM mkdir elevated; cd elevated; cp $WAPATH/uninstall-$WASNAM.sh .; sudo ./uninstall-$WASNAM.sh; cd ..; rm -rf elevated;
