Browse code

copy over ssh keys and other env

Anthony Young authored on 2011/11/01 07:32:38
Showing 1 changed files
... ...
@@ -263,6 +263,23 @@ sed -e "s,@ETH2_NETMASK@,$MGT_NETMASK,g" -i $INTERFACES
263 263
 sed -e "s,@ETH3_IP@,$PUB_IP,g" -i $INTERFACES
264 264
 sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
265 265
 
266
+# Gracefully cp only if source file/dir exists
267
+function cp_it {
268
+    if [ -e $1 ] || [ -d $1 ]; then
269
+        cp -pRL $1 $2
270
+    fi
271
+}
272
+
273
+# Copy over your ssh keys and env if desired
274
+COPYENV=${COPYENV:-1}
275
+if [ "$COPYENV" = "1" ]; then
276
+    cp_it ~/.ssh $STAGING_DIR/opt/stack/.ssh
277
+    cp_it ~/.ssh/id_rsa.pub $STAGING_DIR/opt/stack/.ssh/authorized_keys
278
+    cp_it ~/.gitconfig $STAGING_DIR/opt/stack/.gitconfig
279
+    cp_it ~/.vimrc $STAGING_DIR/opt/stack/.vimrc
280
+    cp_it ~/.bashrc $STAGING_DIR/opt/stack/.bashrc
281
+fi
282
+
266 283
 # Configure run.sh
267 284
 cat <<EOF >$STAGING_DIR/opt/stack/run.sh
268 285
 #!/bin/bash