Browse code

run entire run script as stack user

Anthony Young authored on 2011/09/14 18:54:27
Showing 1 changed files
... ...
@@ -120,33 +120,33 @@ iface eth0 inet static
120 120
 EOF
121 121
 
122 122
 # Configure the runner
123
-RUN_SH=$ROOTFS/root/run.sh
123
+RUN_SH=$ROOTFS/opt/run.sh
124 124
 cat > $RUN_SH <<EOF
125 125
 #!/bin/bash
126 126
 # Make sure dns is set up
127
-echo "nameserver $NAMESERVER" | resolvconf -a eth0
127
+echo "nameserver $NAMESERVER" | sudo resolvconf -a eth0
128 128
 sleep 1
129 129
 
130 130
 # Kill any existing screens
131
-sudo -c "killall screen" stack
131
+su -c "killall screen" stack
132 132
 
133 133
 # Install and run stack.sh
134
-apt-get update
135
-apt-get -y --force-yes install git-core vim-nox sudo
134
+sudo apt-get update
135
+sudo apt-get -y --force-yes install git-core vim-nox sudo
136 136
 if [ ! -d "/opt/nfs-stack" ]; then
137
-    su -c "git clone git://github.com/cloudbuilders/nfs-stack.git ~/nfs-stack" stack
137
+    git clone git://github.com/cloudbuilders/nfs-stack.git ~/nfs-stack
138 138
 fi
139
-su -c "cd ~/nfs-stack && $STACKSH_PARAMS ./stack.sh" stack > /opt/run.sh.log
139
+cd /opt/nfs-stack && $STACKSH_PARAMS ./stack.sh > /opt/run.sh.log
140 140
 EOF
141 141
 
142 142
 # Make the run.sh executable
143
-chmod 700 $RUN_SH
143
+chmod 755 $RUN_SH
144 144
 
145 145
 # Make runner launch on boot
146 146
 RC_LOCAL=$ROOTFS/etc/rc.local
147 147
 cat > $RC_LOCAL <<EOF
148 148
 #!/bin/sh -e
149
-/root/run.sh
149
+su -c "/opt/run.sh" stack
150 150
 EOF
151 151
 
152 152
 # Configure cgroup directory