blob: b7b7648b189aef780bb282950da1bc67dbc42c18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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/
|