some cleanup for utility scripts
diff --git a/tools/setup_stack_user.sh b/tools/setup_stack_user.sh
index 85d418e..231a20f 100755
--- a/tools/setup_stack_user.sh
+++ b/tools/setup_stack_user.sh
@@ -40,9 +40,15 @@
chroot $STAGING_DIR groupadd libvirtd || true
chroot $STAGING_DIR useradd stack -s /bin/bash -d $DEST -G libvirtd || true
-# a simple password - pass
+# Add a simple password - pass
echo stack:pass | chroot $STAGING_DIR chpasswd
+# Configure sudo
+grep -q "^#includedir.*/etc/sudoers.d" $STAGING_DIR/etc/sudoers ||
+ echo "#includedir /etc/sudoers.d" | sudo tee -a $STAGING_DIR/etc/sudoers
+cp $TOP_DIR/files/sudo/* $STAGING_DIR/etc/sudoers.d/
+sed -e "s,%USER%,$USER,g" -i $STAGING_DIR/etc/sudoers.d/*
+
# and has sudo ability (in the future this should be limited to only what
# stack requires)
echo "stack ALL=(ALL) NOPASSWD: ALL" >> $STAGING_DIR/etc/sudoers
@@ -64,3 +70,5 @@
# Give stack ownership over $DEST so it may do the work needed
chroot $STAGING_DIR chown -R stack $DEST
+# Unmount
+umount $STAGING_DIR