Browse code

make a cp_it cp wrapper

Anthony Young authored on 2011/09/14 14:09:36
Showing 1 changed files
... ...
@@ -67,13 +67,19 @@ echo stack:pass | chroot $ROOTFS chpasswd
67 67
 # stack requires)
68 68
 echo "stack ALL=(ALL) NOPASSWD: ALL" >> $ROOTFS/etc/sudoers
69 69
 
70
+function cp_it {
71
+    if [ -e $1 ] || [ -d $1 ]; then
72
+        cp -pr $1 $2
73
+    fi
74
+}
75
+
70 76
 # Copy over your ssh keys and env if desired
71 77
 if [ "$COPYENV" = "1" ]; then
72
-    cp -pr ~/.ssh $ROOTFS/opt/.ssh
73
-    cp -p ~/.ssh/id_rsa.pub $ROOTFS/opt/.ssh/authorized_keys
74
-    cp -pr ~/.gitconfig $ROOTFS/opt/.gitconfig
75
-    cp -pr ~/.vimrc $ROOTFS/opt/.vimrc
76
-    cp -pr ~/.bashrc $ROOTFS/opt/.bashrc
78
+    cp_it ~/.ssh $ROOTFS/opt/.ssh
79
+    cp_it ~/.ssh/id_rsa.pub $ROOTFS/opt/.ssh/authorized_keys
80
+    cp_it ~/.gitconfig $ROOTFS/opt/.gitconfig
81
+    cp_it ~/.vimrc $ROOTFS/opt/.vimrc
82
+    cp_it ~/.bashrc $ROOTFS/opt/.bashrc
77 83
 fi
78 84
 
79 85
 # Give stack ownership over /opt so it may do the work needed
... ...
@@ -93,8 +99,8 @@ iface eth0 inet static
93 93
 EOF
94 94
 
95 95
 # Configure the runner
96
-INSTALL_SH=$ROOTFS/root/install.sh
97
-cat > $INSTALL_SH <<EOF
96
+RUN_SH=$ROOTFS/root/run.sh
97
+cat > $RUN_SH <<EOF
98 98
 #!/bin/bash
99 99
 # Make sure dns is set up
100 100
 echo "nameserver $NAMESERVER" | resolvconf -a eth0
... ...
@@ -109,14 +115,14 @@ fi
109 109
 su -c "cd ~/nfs-stack && $STACKSH_PARAMS ./stack.sh" stack
110 110
 EOF
111 111
 
112
-# Make the install.sh executable
113
-chmod 700 $INSTALL_SH
112
+# Make the run.sh executable
113
+chmod 700 $RUN_SH
114 114
 
115
-# Make installer run on boot
115
+# Make runner launch on boot
116 116
 RC_LOCAL=$ROOTFS/etc/rc.local
117 117
 cat > $RC_LOCAL <<EOF
118 118
 #!/bin/sh -e
119
-/root/install.sh
119
+/root/run.sh
120 120
 EOF
121 121
 
122 122
 # Configure cgroup directory