diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-05-28 18:56:45 -0600 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-05-28 18:56:45 -0600 |
commit | b4341ef8e90abe99d188dc444ff837a7aba756fa (patch) | |
tree | d0add860d80b46a0a35f1c7fecc7ac06779878b7 /src/chroot-tools | |
parent | 25bd327ad06d0497e9888ebc7c4bbbd6cab11f12 (diff) |
librechroot: didn't always create repo.db symlinktesting-20130528.1
Fix this and remove code duplication by pulling the relevant code into a
function.
Diffstat (limited to 'src/chroot-tools')
-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'" |