<u>'''INSTALL'''</u>
<pre># App specific variablesTemp download/extract filesmkdir -p files;export WASNAM='pmagic'echo Extracting files;export WALNAM='Parted Magic'unzip -q source-file -d files;export WAPATH='/var/hda/webmkdir -apps/pmagic/html'p elevated;cd elevated; # App specific variables
# Constant variables--DO NOT CHANGE
export NBPATH='/usrvar/sharelib/amahi-netboot/tftp';export HDAIP=`ifconfig eth0 | grep "inet addr" | awk '{ print $2 }' | awk 'BEGIN { FS=":" } { print $2 }tftpboot'`;
# Start of $WALNAM Installcat > html../install-$WASNAM.sh << EOF
#!/bin/bash
echo Copying files;mkdir -p $NBPATH/$WASNAMHDA_APP_NAME;# Copy $WALNAM files to Netbootcp $WAPATH../files/live/vmlinuz ../files/live/initrd.img ../files/$WASNAMlive/* filesystem.squashfs -d $NBPATH/$WASNAMHDA_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
fi
# Append app menu to default
echo Updating menu;
if [ -d $NBPATH/menu ]; then
cp $WAPATH../$WASNAMHDA_APP_NAME.mnu $NBPATH/menu
cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default
else
mkdir $NBPATH/menu
cp $WAPATH../$WASNAMHDA_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../$WASNAMHDA_APP_NAME.conf $NBPATH/conf
else
mkdir $NBPATH/conf
cp $WAPATH../$WASNAMHDA_APP_NAME.conf $NBPATH/conf
fi
echo "Installation Removing source files";rm -rf ../files;echo "Install complete.";# End of $WALNAM Install
EOF
# Start of $WASNAM Uninstallcat > html../uninstall-$WASNAM.sh << EOF
#!/bin/bash
# Remove $WALNAMecho Removing files;rm -rf ../files;rm -rf $NBPATH/$WASNAMHDA_APP_NAME;rm -rf $NBPATH/conf/$WASNAMHDA_APP_NAME.conf;rm -rf $NBPATH/menu/$WASNAMHDA_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
fiecho "Uninstallation Uninstall complete.";# End of $WALNAM 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../$WASNAMHDA_APP_NAME.mnu << EOFLABEL Parted Magic$HDA_APP_NAME MENU LABEL Parted Magic$HDA_APP_NAME
kernel menu.c32
append conf/pmagic$HDA_APP_NAME.conf
EOF
# This is specific to the app and may not be needed. It generates a sub menu
cat > html../$WASNAMHDA_APP_NAME.conf << EOFMENU TITLE Parted Magic$HDA_APP_NAMELABEL Parted Magic$HDA_APP_NAME MENU LABEL Parted Magic$HDA_APP_NAME kernel pmagic$HDA_APP_NAME/bzImagevmlinuz append initrd=pmagic$HDA_APP_NAME/initramfs load_ramdiskinitrd.img boot=live union=1 prompt_ramdiskaufs noswap noprompt vga=0 rw sleep788 fetch=10 LABEL Parted Magic (FAILSAFE) MENU LABEL Parted Magic (FAILSAFE) kernel pmagictftp://$HDA_IP/bzImage append initrd=pmagic$HDA_APP_NAME/initramfs load_ramdisk=1 prompt_ramdisk=0 rw sleep=10 livemedia filesystem.squashfs live-config
EOF
cat > htmlchmod 755 ../indexinstall.sh .html << EOF./uninstall.sh;<html><head><title> <cp ../title>install.sh .;<style type="textsudo ./css"><!--h1 {text-align:centerinstall.sh; font-family:Arial, Helvetica, Sans-Serifcd ..; } p {textrm -indent:20pxrf elevated; }--></style></head><body bgcolor = "#ffffcc" text = "#000000"><center><img src="http://wiki.amahi.org/images/6/60/Partedmagic-logo.png"></a></center><h1>Parted Magic Installed!</h1>
<p>The Parted Magic OS employs core programs of GParted and Parted to handle partitioning tasks with ease, while featuring other useful <a href="/programs.html" mce_href="/programs.html" target="_blank">programs</a> (e.g. Clonezilla, Partimage, TestDisk, Truecrypt, G4L, SuperGrubDisk, ddrescue, etc...) and an excellent set of <a href="/documentation.html" mce_href="/documentation.html" target="_blank">documentation</a> to benefit the user. An extensive collection of file system tools are also included, as Parted Magic supports the following: ext2, ext3, ext4, fat16, fat32, hfs, hfs+, jfs, linux-swap, ntfs, reiserfs, reiser4, and xfs.</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-$WASNAM.sh html/uninstall-$WASNAM.sh; mkdir elevated;cd elevated cp $WAPATH/install-$WASNAM.sh .;sudo ./install-$WASNAM.sh;cd ..;rm -rf elevated*.zip;</pre>
<u>'''UNINSTALL'''</u>
<pre># App specific variablesexport WASNAM='pmagic';export WAPATH='/var/hda/web-apps/pmagic/html';# Uninstall $WASNAMmkdir -p elevated;
cd elevated;
cp $WAPATH../uninstall-$WASNAM.sh .;sudo ./uninstall-$WASNAM.sh;
cd ..;
rm -rf elevated;</pre>
Return to [[Web App Packaging Notes]]