Browse code

some cleanup for utility scripts

Anthony Young authored on 2011/11/10 15:29:22
Showing 2 changed files
... ...
@@ -40,9 +40,15 @@ mkdir -p $STAGING_DIR/$DEST
40 40
 chroot $STAGING_DIR groupadd libvirtd || true
41 41
 chroot $STAGING_DIR useradd stack -s /bin/bash -d $DEST -G libvirtd || true
42 42
 
43
-# a simple password - pass
43
+# Add a simple password - pass
44 44
 echo stack:pass | chroot $STAGING_DIR chpasswd
45 45
 
46
+# Configure sudo
47
+grep -q "^#includedir.*/etc/sudoers.d" $STAGING_DIR/etc/sudoers ||
48
+    echo "#includedir /etc/sudoers.d" | sudo tee -a $STAGING_DIR/etc/sudoers
49
+cp $TOP_DIR/files/sudo/* $STAGING_DIR/etc/sudoers.d/
50
+sed -e "s,%USER%,$USER,g" -i $STAGING_DIR/etc/sudoers.d/*
51
+
46 52
 # and has sudo ability (in the future this should be limited to only what
47 53
 # stack requires)
48 54
 echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers
... ...
@@ -64,3 +70,5 @@ cp_it ~/.bashrc $STAGING_DIR/$DEST/.bashrc
64 64
 # Give stack ownership over $DEST so it may do the work needed
65 65
 chroot $STAGING_DIR chown -R stack $DEST
66 66
 
67
+# Unmount
68
+umount $STAGING_DIR
... ...
@@ -48,4 +48,6 @@ chroot $STAGING_DIR apt-get install -y --download-only `cat files/apts/* | grep
48 48
 chroot $STAGING_DIR apt-get install -y --force-yes `cat files/apts/* | grep -v NOPRIME | cut -d\# -f1` || true
49 49
 mkdir -p $STAGING_DIR/var/cache/pip
50 50
 PIP_DOWNLOAD_CACHE=/var/cache/pip chroot $STAGING_DIR pip install `cat files/pips/*` || true
51
+
52
+# Unmount
51 53
 umount $STAGING_DIR