summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/chroot-tools/librechroot23
-rwxr-xr-xsrc/chroot-tools/libremakepkg.gpl24
2 files changed, 16 insertions, 11 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"
diff --git a/src/chroot-tools/libremakepkg.gpl2 b/src/chroot-tools/libremakepkg.gpl2
index cd279b8..bc8a9be 100755
--- a/src/chroot-tools/libremakepkg.gpl2
+++ b/src/chroot-tools/libremakepkg.gpl2
@@ -14,8 +14,8 @@
# GNU General Public License for more details.
chroot_init() {
- # no-op; make sure the chroot exists
- librechroot -n -l "$CHROOTCOPY" "$CHROOT"
+ # make sure the chroot exists
+ librechroot -n "$CHROOT" -l "$CHROOTCOPY" -m
if [[ -r "$LIBREHOME/.gnupg/pubring.gpg" ]]; then
install -D "$HOME/.gnupg/pubring.gpg" "$copydir/build/.gnupg/pubring.gpg"