summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/create_master.sh
blob: 1e641b45abe0f67734d63283083c7bd9a2fc66b6 (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
#!/bin/bash
#CD=/mnt/cd
CD=/data/srv/tftp/live
DESTCD=/data/srv/tftp/CD
DEST=/data/srv/tftp/masterbuild
MODULES=$DESTCD/MythVantage/base/  
myip=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'|head -n1`

mkdir -p $DESTCD
mkdir -p $DEST

mount $CD
status=0
if [ -f $CD/MythVantage/base/data.lzm ]
then
	status=0
else
	status=1
fi
if [ x$status = x0 ]
then
	echo "copying to disk"
	cp -rp $CD/*  $DESTCD
	cd $MODULES
	   for i in *.lzm 
	   do
		   echo $i
		   lzm2dir $i \/$DEST
	   done
        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
echo "/data/srv/tftp/masterbuild  *(rw,no_root_squash,anonuid=1000,anongid=1000)" >> /etc/exports


exportfs -arv

#copy in the modules
mkdir -p $DEST/mnt/live/mnt/
mv $DESTCD/*  $DEST/mnt/live/mnt/