Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Enter Mirror Can Now Run Scripts in Mirror

This is not something I've wanted to use it for.
This just seemed like the right place to put this functionality.

The functionality is about to be put to use by build_mirror.
  • Loading branch information...
commit 4cc6c2ed2e69854819dc4ec697dd568258ba7e2a 1 parent 5a79990
Christopher Vollick authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 enter_mirror
12 enter_mirror
View
@@ -3,6 +3,10 @@
DATA_LOCATION="/mnt/easy_mirror"
MIRROR_NAME="$1"
+if [ "$#" -gt 0 ]; then
+ shift
+fi
+
if [ '!' -d "$DATA_LOCATION" ]; then
echo "There are no active mirrors" >&2
exit 1
@@ -24,4 +28,10 @@ if [ -z "$MIRROR_NAME" ]; then
fi
fi
-chroot "$DATA_LOCATION/$MIRROR_NAME/union" su -l "$SUDO_USER"
+if [ "$#" = 0 ]; then
+ # We weren't given a command, so just run a shell
+ chroot "$DATA_LOCATION/$MIRROR_NAME/union" su -l "$SUDO_USER"
+else
+ # Run the commands we were given
+ chroot "$DATA_LOCATION/$MIRROR_NAME/union" sudo -u "$SUDO_USER" "$@"
+fi
Please sign in to comment.
Something went wrong with that request. Please try again.