summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-30 16:10:48 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-30 16:10:48 -0500
commit762e198c42dcd5b3da5c3a9dbe1006c7f85ec643 (patch)
tree1d0ff11257fa31b52cd8ebb1a88b29d07c8d53c1 /src/chroot-tools/librechroot
parentd602c1d5d462100313a2c6c47434c652444ba7fd (diff)
[librechroot] have -n set the CHROOT; rename the old -n to -m
https://labs.parabola.nu/issues/252
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-xsrc/chroot-tools/librechroot23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 8e57004..e93c57e 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -30,13 +30,14 @@
cmd=${0##*/}
usage() {
- echo "Usage: $cmd [OPTIONS] [CHROOT] "
+ echo "Usage: $cmd [OPTIONS] "
echo 'Interacts with a chroot.'
echo ''
echo "The default CHROOT is \`${CHROOT}'."
echo ''
echo 'Options:'
echo ' Settings:'
+ echo " -n <CHROOT> Use this chroot instead of \`$CHROOT'"
echo ' -l <COPY> Use this as the chroot copy instead of basing it'
echo ' on the username'
echo ' -N Disable networking in the chroot'
@@ -46,7 +47,7 @@ usage() {
echo ' -c Clean the packages installed in the chroot'
echo ' -I <FILE> Install the package FILE into the chroot'
echo ' -i <PKG> Install the package PKG from repos into the chroot'
- echo ' -n No-op, just make sure that the chroot exists'
+ echo ' -m Make sure the chroot exists; do nothing else'
echo ' -r <CMD> Run CMD in the chroot'
echo " -s Sync the copy with the 'root' copy"
echo ' -u Update the chroot'
@@ -60,8 +61,9 @@ main() {
local mode=enter
local archroot_args=(-f)
local ARG=''
- while getopts 'l:NCcI:i:nrsuh' arg; do
+ while getopts 'n:l:NCcI:i:mrsuh' arg; do
case $arg in
+ n) CHROOT=$OPTARG;;
l) CHROOTCOPY=$OPTARG;;
N) archroot_args+=(-N);;
@@ -69,7 +71,7 @@ main() {
c) mode=clean_pacman;;
I) mode=install_file; ARG=$OPTARG;;
i) mode=install_pkg; ARG=$OPTARG;;
- n) mode=noop;;
+ m) mode=noop;;
r) mode=run; ARG=$OPTARG;;
s) mode=sync;;
u) mode=update;;
@@ -79,16 +81,17 @@ main() {
esac
done
shift $(($OPTIND - 1))
- case $# in
- 0) :;;
- 1) CHROOT="$1";;
- *) usage; exit 1;;
- esac
+ if [[ $# > 0 ]]; then
+ usage
+ exit 1
+ fi
# not local
rootdir="${CHROOTDIR}/${CHROOT}/root"
copydir="${CHROOTDIR}/${CHROOT}/${CHROOTCOPY}"
+ ########################################################################
+
if (( EUID )); then
error "This script must be run as root."
exit 1
@@ -106,6 +109,8 @@ main() {
sync
fi
+ ########################################################################
+
case "$mode" in
clean_repo)
msg "Cleaning local pacman repository"