diff options
Diffstat (limited to 'abs/mv-core/MythVantage-config/create_master.sh')
-rwxr-xr-x | abs/mv-core/MythVantage-config/create_master.sh | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/abs/mv-core/MythVantage-config/create_master.sh b/abs/mv-core/MythVantage-config/create_master.sh new file mode 100755 index 0000000..b7b7648 --- /dev/null +++ b/abs/mv-core/MythVantage-config/create_master.sh @@ -0,0 +1,104 @@ +#!/bin/bash +CD=/media/cdrom +#CD=/data/srv/tftp/live +DESTCD=/data/srv/tftp/CD +DEST=/data/srv/tftp/masterbuild +#MODULES=$DESTCD/MythVantage/base/ + +#ONLY SUPPORTS ETH0 +myip=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1` +if [ x$myip = x ] +then + echo "couldn't find a ipaddress to use for NFS server" +fi + + +mkdir -p $DESTCD +mkdir -p $DEST + +mount $CD +status=0 +if [ -f $CD/system.sqf ] +then + status=0 +else + status=1 + echo "couldn't find system.sqf" + exit 1 +fi + +if [ x$status = x0 ] +then + echo "copying to disk" + cp -rvp $CD/*.sqf $DESTCD + cp -rvp $CD/overlay.ovl $DESTCD + echo "creating master copy at $DESTCD" + unsquashfs -f -d /$DEST $DESTCD/system.sqf + cd $DEST + lzop -d < $DESTCD/overlay.ovl |tar -xf - + cp -rp overlay/etc/* etc/ + cd - + + for i in sys proc dev tmp + do + mkdir $DEST/$i + done + chmod 777 /$DEST/tmp + mknod $DEST/dev/null c 1 3 + mknod $DEST/dev/null c 1 5 + mknod $DEST/dev/console c 5 1 + chmod +s $DEST/usr/bin/Xorg + chmod +s $DEST/usr/bin/crontab + chmod +s $DEST/usr/bin/sudo + chmod +s $DEST/bin/mount +fi + +if [ ! -f $DEST/etc/fstab.bak ] +then + cp $DEST/etc/fstab $DEST/etc/fstab.bak +fi + +tac $DEST/etc/fstab.bak|tail +4|tac > $DEST/etc/fstab +echo "$myip:/data/srv/tftp/masterbuild / nfs" >> $DEST/etc/fstab + +grep -q "/data/srv/tftp/masterbuild" /etc/exports +status=$? +if [ ! $status = 0 ] +then + echo "adding masterbuild to nfs exports" + echo "/data/srv/tftp/masterbuild *(rw,no_root_squash,anonuid=1000,anongid=1000)" >> /etc/exports + exportfs -arv +fi + +echo "configuring the kernel" +sed -ie 's/^MODULES=.*$/MODULES="nfs"/g' $DEST/etc/mkinitcpio.conf +sed -ie 's/^HOOKS=.*$/HOOKS="base net udev autodetect pata scsi sata filesystems"/g' $DEST/etc/mkinitcpio.conf +chroot $DEST mkinitcpio -p kernel26 + +#change rc.local for masterbuild +cd $DEST/etc +patch <<EOF +--- rc.local.orig 2008-09-27 09:17:42.000000000 -0500 ++++ rc.local 2008-09-27 09:21:47.000000000 -0500 +@@ -2,6 +2,9 @@ + . /etc/profile + . ${MV_ROOT}/bin/install_functions.sh + #install initial database ++rm -f /etc/sysconfig ++mysql -c "drop database mythconverg" ++pacman -R --noconfirm mythdb-initial 2>/dev/null + pacman -S --noconfirm mythdb-initial 2>/dev/null + + init_network + +EOF + +cd - + + + +echo "copy in modules for net install" +#copy in the modules/.livesys/medium/system.sqf +mkdir -p $DEST/.livesys/medium +cp $DESTCD/* $DEST/.livesys/medium/ + |