summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-11-28 22:10:26 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-11-28 22:10:26 -0500
commit06f10b87d16d4c83016ff3ef21217494f921d93b (patch)
treea96805d184775b9b45464763fa78d4786ddc38b6 /src/chroot-tools/librechroot
parent01d928f223a23f28af04dc1cdfcfd62ed6cc3f61 (diff)
many fixes
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-xsrc/chroot-tools/librechroot14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index e39b105..d43ea2f 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -51,6 +51,7 @@ sync() {
lock_close 8
}
+cmd=${0##*/}
usage() {
echo "Usage: $cmd [OPTIONS] [CHROOT] "
echo 'Interacts with a chroot.'
@@ -80,7 +81,7 @@ main() {
[[ $CHROOTCOPY != root ]] || CHROOTCOPY=copy
local mode=enter
- local archroot_args=()
+ local archroot_args=(-f)
local ARG=''
while getopts 'l:NCcI:i:nrsuh' arg; do
case $arg in
@@ -90,7 +91,7 @@ main() {
C) mode=clean_repo;;
c) mode=clean_pacman;;
I) mode=install_file; ARG=$OPTARG;;
- I) mode=install_pkg; ARG=$OPTARG;;
+ i) mode=install_pkg; ARG=$OPTARG;;
n) mode=noop;;
r) mode=run; ARG=$OPTARG;;
s) mode=sync;;
@@ -118,7 +119,7 @@ main() {
# Keep this lock as long as we are running
# Note that '9' is the same FD number as in (mk)archroot
- lock_open_write 9 "$copydir" "Locking chroot copy '$copy'"
+ lock_open_write 9 "$copydir" "Locking chroot copy '$CHROOTCOPY'"
if [[ ! -d $rootdir ]]; then
libremkchroot "$CHROOT"
@@ -139,8 +140,11 @@ main() {
clean_pacman)
msg "Intelligently cleaning packages"
cp -a "$(dirname $0)/chcleanup" "${copydir}/clean"
- mkdir -p "$copydir/build"
- archroot "${archroot_args[@]}" "${copydir}" -r "cd /build; /clean"
+ echo '#!/bin/bash' > "${copydir}/cleanstrap"
+ echo 'mkdir /build' >> "${copydir}/cleanstrap"
+ echo 'cd /build; /clean' >> "${copydir}/cleanstrap"
+ chmod 755 "${copydir}/cleanstrap"
+ archroot "${archroot_args[@]}" "${copydir}" -r /cleanstrap
;;
install_file)
msg "Installing package file: $ARG"