summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
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