Netboot Template

From Amahi Wiki
Revision as of 01:36, 30 March 2011 by Bigfoot65 (talk | contribs) (Protected "Netboot Template" ([edit=sysop] (indefinite) [move=sysop] (indefinite)) [cascading])
Jump to: navigation, search

INSTALL

# App specific variables
export WASNAM='pmagic';
export WALNAM='Parted Magic';
export WAPATH='/var/hda/web-apps/pmagic/html';
# Constant variables--DO NOT CHANGE
export NBPATH='/usr/share/amahi-netboot/tftp';
export HDAIP=`ifconfig eth0 | grep "inet addr" | awk '{ print $2 }' | awk 'BEGIN { FS=":" } { print $2 }'`;

# Start of $WALNAM Install
cat > html/install-$WASNAM.sh << EOF
#!/bin/bash
mkdir -p $NBPATH/$WASNAM;
# Copy $WALNAM files to Netboot
cp $WAPATH/$WASNAM/* -d $NBPATH/$WASNAM;
# 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/$WASNAM.mnu $NBPATH/menu
    cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default
  else
    mkdir $NBPATH/menu
    cp $WAPATH/$WASNAM.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/$WASNAM.conf $NBPATH/conf
  else
    mkdir $NBPATH/conf
    cp $WAPATH/$WASNAM.conf $NBPATH/conf
fi
echo "Installation complete.";
# End of $WALNAM Install
EOF
# Start of $WASNAM Uninstall
cat > html/uninstall-$WASNAM.sh << EOF
#!/bin/bash
# Remove $WALNAM
rm -rf $NBPATH/$WASNAM;
rm -rf $NBPATH/conf/$WASNAM.conf;
rm -rf $NBPATH/menu/$WASNAM.mnu;
cp $NBPATH/pxelinux.cfg/default.bu $NBPATH/pxelinux.cfg/default;
cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default
echo "Uninstallation 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/$WASNAM.mnu << EOF
LABEL Parted Magic
      MENU LABEL Parted Magic
      kernel menu.c32
      append conf/pmagic.conf
EOF
# This is specific to the app and may not be needed.  It generates a sub menu
cat > html/$WASNAM.conf << EOF
MENU TITLE Parted Magic
LABEL Parted Magic
    MENU LABEL Parted Magic
	kernel pmagic/bzImage
	append initrd=pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw sleep=10
	
LABEL Parted Magic (FAILSAFE)
    MENU LABEL Parted Magic (FAILSAFE)
	kernel pmagic/bzImage
	append initrd=pmagic/initramfs load_ramdisk=1 prompt_ramdisk=0 rw sleep=10 livemedia 
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/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;

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;


Return to Web App Packaging Notes