summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-28 15:20:59 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-28 15:20:59 -0500
commit00d67a5051e5d4163acffa80b7ef85f81f7e548f (patch)
tree2d27a49d659c7736871ca302eebc1df2d5ae3fa5 /src/chroot-tools/librechroot
parentfd1e5a426713715d9c0e3fabbfe0d8a20b629bad (diff)
take (some) advantage of chroottools, fix some compatability things
mkarchroot/archroot's option parsing is a little less flexible (but a lot more understandable) than it was before.
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-xsrc/chroot-tools/librechroot51
1 files changed, 5 insertions, 46 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 48e6cdc..8830c39 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -27,53 +27,12 @@
cmd=${0##*/}
-lock_open_write() {
- local fd=$1
- local path=$2
- local msg=$3
-
- # Only reopen the FD if it wasn't handed to us
- if [[ $(readlink -f /dev/fd/$fd) != "${path}.lock" ]]; then
- eval "exec $fd>${path}.lock"
- fi
-
- if ! flock -n $fd; then
- stat_busy "$msg"
- flock $fd
- stat_done
- fi
-}
-
-lock_open_read() {
- local fd=$1
- local path=$2
- local msg=$3
-
- # Only reopen the FD if it wasn't handed to us
- if [[ $(readlink -f /dev/fd/$fd) != "${path}.lock" ]]; then
- eval "exec $fd>${path}.lock"
- fi
-
- if ! flock -sn $fd; then
- stat_busy "$msg"
- flock -s $fd
- stat_done
- fi
-}
-
-lock_close() {
- local fd=$1
- eval "exec $fd>&-"
-}
-
clean_pacman() {
msg "Cleaning chroot with pacman: ${copydir}"
cp -a "$(dirname $0)/chcleanup" "${copydir}/clean"
mkdir -p "$copydir/build"
- mkarchroot -r "cd /build; /clean" "${copydir}"
-
- #mkarchroot "${copydir}" base base-devel sudo "${CHROOTEXTRAPKG[@]}"
+ archroot "${copydir}" -r "cd /build; /clean"
}
clean_repo() {
@@ -120,12 +79,12 @@ sync() {
update() {
msg "Updating chroot: ${copydir}"
- mkarchroot -u "${copydir}"
+ archroot "${copydir}" -u
}
enter() {
msg "Entering chroot: ${copydir}"
- mkarchroot -r "bash" "${copydir}"
+ archroot "${copydir}" -r "bash"
}
usage() {
@@ -183,11 +142,11 @@ main() {
fi
# Keep this lock as long as we are running
- # Note that '9' is the same FD number as in mkarchroot
+ # Note that '9' is the same FD number as in (mk)archroot
lock_open_write 9 "$copydir" "Locking chroot copy '$copy'"
if [[ ! -d $rootdir ]]; then
- libremkchroot -d "$CHROOTDIR" "$CHROOT"
+ libremkchroot "$CHROOT"
fi
if [[ ! -d $copydir ]] && [[ $mode != sync ]]; then