summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2022-07-04 15:24:52 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2024-01-01 17:40:25 -0500
commitc17c8d41f8cb4120595b67370c5a296dd7314694 (patch)
treee02fc132ef8310230fd6d26ee060d5f6310dc13d
parentcf56d2a9ab68229fcfee593a5f7a6a27600da20b (diff)
allow clean-pkgs command to work with -l option
-rwxr-xr-xsrc/chroot-tools/librechroot11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 33d4ebb..fac9b09 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -86,6 +86,15 @@ calculate_directories() {
# but assume that COPY is set.
local rootdir copydir
+ # TODO: review the implementation and USAGE for `-l`
+ # this trick only works with absolute path to chroot
+ # eg: why does `-l` accept 'Name of, or absolute path ...'
+ # when -n can be given for 'Name of the chroot to use'?
+ if [[ ${COPY:0:1} = / ]]; then
+ CHROOTDIR=$(dirname $(dirname ${COPY}))
+ CHROOT=$( basename $(dirname ${COPY}))
+ fi
+
if [[ -n ${CHROOTDIR:-} ]] && [[ -n ${CHROOT:-} ]]; then
rootdir="${CHROOTDIR}/${CHROOT}/root"
else
@@ -100,6 +109,8 @@ calculate_directories() {
copydir=''
fi
+ declare -p CHROOTDIR
+ declare -p CHROOT
declare -p rootdir
declare -p copydir
}