Skip to content

Commit

Permalink
Enter Mirror Can Now Run Scripts in Mirror
Browse files Browse the repository at this point in the history
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
psycotica0 committed Nov 13, 2012
1 parent 5a79990 commit 4cc6c2e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion enter_mirror
Expand Up @@ -3,6 +3,10 @@
DATA_LOCATION="/mnt/easy_mirror" DATA_LOCATION="/mnt/easy_mirror"
MIRROR_NAME="$1" MIRROR_NAME="$1"


if [ "$#" -gt 0 ]; then
shift
fi

if [ '!' -d "$DATA_LOCATION" ]; then if [ '!' -d "$DATA_LOCATION" ]; then
echo "There are no active mirrors" >&2 echo "There are no active mirrors" >&2
exit 1 exit 1
Expand All @@ -24,4 +28,10 @@ if [ -z "$MIRROR_NAME" ]; then
fi fi
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

0 comments on commit 4cc6c2e

Please sign in to comment.