-
Notifications
You must be signed in to change notification settings - Fork 47
/
provision.sh
executable file
·83 lines (63 loc) · 1.95 KB
/
provision.sh
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
#!/bin/bash
set -e
SOURCES=/vagrant
PFILES=$SOURCES/provisioning
echo "install base packages"
apt-get install -y curl vnc4server nfs-common nfs-user-server inetutils-inetd ratpoison xterm
if [[ ! -d "/opt/og2" ]]; then
echo "expand opengenera"
cd /opt; tar xfj /vagrant/opengenera2.tar.bz2
fi
if [[ ! -f "$SOURCES/snap4.tar.gz" ]]; then
echo "download snap4"
cd $SOURCES; curl -O http://www.unlambda.com/download/genera/snap4.tar.gz
fi
if [[ ! -d "/opt/snap4" ]]; then
echo "expand snap4"
cd /opt; tar xfz $SOURCES/snap4.tar.gz
fi
echo "/etc/inetd.conf"
cp $PFILES/inetd.conf /etc/inetd.conf
chmod 0644 /etc/inetd.conf
echo "bounce inetd"
/etc/init.d/inetutils-inetd restart
echo "set hostname"
echo 'genera-host' > /etc/hostname; hostname genera-host
echo "/etc/hosts"
cp $PFILES/hosts /etc/hosts
chmod 0644 /etc/hosts
echo "/etc/exports"
cp $PFILES/exports /etc/exports
chmod 0644 /etc/exports
echo "bounce nfs"
/etc/init.d/nfs-user-server restart
echo "/opt/snap4/.VLM"
cp $PFILES/dotVLM /opt/snap4/.VLM
chmod 0644 /opt/snap4/.VLM
if [[ ! -d "/var/lib/symbolics" ]]; then
echo "configure og2 image"
SDIR=/var/lib/symbolics
cp -R /opt/snap4 $SDIR;
cp -R /opt/og2/sys.sct $SDIR;
mkdir $SDIR/rel-8-5;
ln -s $SDIR/sys.sct $SDIR/rel-8-5/sys.sct;
cp $PFILES/run-genera $SDIR;
ln -s $SDIR/run-genera /usr/local/bin
cp $PFILES/restart-genera $SDIR
ln -s $SDIR/restart-genera /usr/local/bin
fi
echo "/root/.vnc"
mkdir -p /root/.vnc
cp $PFILES/vncpasswd /root/.vnc/passwd
chmod 0600 /root/.vnc/passwd
cp $PFILES/vncxstartup /root/.vnc/xstartup
chmod 0755 /root/.vnc/xstartup
echo "allow global write to genera files"
chmod ugo+w -R /var/lib/symbolics/sys.sct
echo "clear vnc.pid on startup"
echo 'rm -f /root/.vnc/genera-host:1.pid' > /etc/rc.local
echo 'HOME=/root vncserver -geometry 1150x900' >> /etc/rc.local
echo "start opengenera under vnc"
if [[ ! -f "/root/.vnc/genera-host:1.pid" ]]; then
HOME=/root vncserver -geometry 1150x900
fi