diff options
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-x | src/chroot-tools/librechroot | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 5afce05..ed00688 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -32,6 +32,13 @@ normshell() ( "$@" ) +make_emtpy_repo() { + local copydir=$1 + mkdir -p "${copydir}/repo" + bsdtar -czf "${copydir}/repo/repo.db.tar.gz" -T /dev/null + ln -s "repo.db.tar.gz" "${copydir}/repo/repo.db" +} + cmd=${0##*/} usage() { echo "Usage: $cmd [OPTIONS] COMMAND [ARGS...]" @@ -168,8 +175,7 @@ main() { set +u # if archroot_args is empty, it counts as unbound archroot "${archroot_args[@]}" -m "$rootdir" base-devel set -u - mkdir -p "${rootdir}/repo" - bsdtar -czf "${rootdir}/repo/repo.db.tar.gz" -T /dev/null + make_empty_repo "$copydir" fi if [[ ! -d $copydir ]] || [[ $mode == sync ]]; then @@ -232,9 +238,7 @@ main() { enter) archroot -r "$copydir" bash;; clean-repo) rm -rf "${copydir}/repo/*" - mkdir -p "${copydir}/repo" - bsdtar -czf "${copydir}/repo/repo.db.tar.gz" -T /dev/null - ln -s "repo.db.tar.gz" "${copydir}/repo/repo.db" + make_empty_repo "$copydir" ;; *) error "Unrecognized command: \`$mode'" |