Difference between revisions of "Netboot Template"

From Amahi Wiki
Jump to: navigation, search
Line 1: Line 1:
<u>'''amahi-netboot Work Around For Fedora 19''' (add to netboot template)</u>
 
 
* Add after HDAIP variable line:
 
<pre>cat > html/amahi-pxe.conf << EOF
 
dhcp-boot=pxelinux.0,hda,$HDAIP #insert hda IP
 
enable-tftp
 
tftp-root=/var/lib/tftpboot
 
EOF</pre>
 
 
* Add after #!/bin/bash line:
 
<pre>if [ -f /etc/dnsmasq.d/amahi-pxe.conf ]; then
 
# Skip update
 
echo;
 
else
 
### START amahi-netboot work around ###
 
sed -i '14s/yes/no/' /etc/xinetd.d/tftp;
 
cp html/amahi-pxe.conf /etc/dnsmasq.d/amahi-pxe.conf;
 
# restart dnsmasq
 
systemctl restart dnsmasq.service;
 
### END amahi-netboot work around ###
 
fi</pre>
 
 
 
<u>'''INSTALL'''</u>
 
<u>'''INSTALL'''</u>
 
<pre># App specific variables
 
<pre># App specific variables

Revision as of 23:25, 2 February 2014

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='/var/lib/tftpboot';
export INTFC=`ifconfig | expand | cut -c1-8 | sort | uniq -u | awk -F: '{print $1;}' | grep -Fvx -e lo | grep -Fvx -e tun0`
export HDAIP=$(/sbin/ip -o -4 addr list $INTFC | awk '{print $4}' | cut -d/ -f1);

# 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;
if [ -f $NBPATH/menu/*.mnu ]; then
cat $NBPATH/menu/*.mnu >> $NBPATH/pxelinux.cfg/default
fi
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;