diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-12-02 22:42:41 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-12-09 14:20:48 -0500 |
commit | 70e1601042250b395659f4c325ae7a73cbe238ab (patch) | |
tree | 386b7ba9274217c6b4a5e695e25cb9761dfe22e0 /src/chroot-tools | |
parent | d17a673ba0a62f6f8755484a574e9ab0186ab705 (diff) |
libremakepkg: learn '-C' to dissable using the chroot
Diffstat (limited to 'src/chroot-tools')
-rwxr-xr-x | src/chroot-tools/libremakepkg | 9 | ||||
-rwxr-xr-x | src/chroot-tools/libremakepkg.gpl2 | 19 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 4e810d1..ec7adbd 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -120,6 +120,7 @@ usage() { echo " -n <CHROOT> Use this chroot instead of \`$CHROOT'" echo ' -l <COPY> Use this chroot copy instead of basing it' echo ' on the username' + echo ' -C Do not use a chroot' echo '' echo " -m <MAKEPKG> Use the command MAKEPKG instead of 'makepkg'" echo '' @@ -134,11 +135,13 @@ main() { makepkg_args='-s --noconfirm -L ' MAKEPKG=makepkg + NOCHROOT=false while getopts 'n:l:m:Rh' arg ; do case "${arg}" in n) CHROOT=$OPTARG;; l) CHROOTCOPY=$OPTARG;; + C) NOCHROOT=true;; m) MAKEPKG=$OPTARG;; h) usage; exit 0;; *) usage; exit 1;; @@ -180,7 +183,7 @@ main() { chroot_makepkg_conf_get CARCH export CARCH - chroot_init + $NOCHROOT || chroot_init libre_check_pkgbuild chroot_extract @@ -188,8 +191,8 @@ main() { chroot_build libre_check_pkg - copy_pkgs - copy_logs + $NOCHROOT || copy_pkgs + $NOCHROOT || copy_logs } main "$@" diff --git a/src/chroot-tools/libremakepkg.gpl2 b/src/chroot-tools/libremakepkg.gpl2 index fd58d50..9c600ed 100755 --- a/src/chroot-tools/libremakepkg.gpl2 +++ b/src/chroot-tools/libremakepkg.gpl2 @@ -36,6 +36,11 @@ EOF } chroot_extract() { + if $NOCHROOT; then + chcleanup + sudo -u ${LIBREUSER} ${MAKEPKG} ${makepkg_args} -o + return + fi rm -rf "$copydir"/build/* cp PKGBUILD "$copydir/build/" ( @@ -72,14 +77,19 @@ chroot_extract() { } chroot_build() { - chroot_exec -N "sudo -u nobody ${MAKEPKG} ${makepkg_args} -e" + local user=$LIBREUSER + $NOCHROOT || user=nobody + chroot_exec -N "sudo -u ${user} ${MAKEPKG} ${makepkg_args} -e" } chroot_exec() { local flags='' [[ $1 == -N ]] && { flags=$1; shift; } local cmd="$*" - cat >"$copydir/chrootexec" <<EOF + if $NOCHROOT; then + ${cmd} + else + cat >"$copydir/chrootexec" <<EOF #!/bin/bash . /etc/profile export HOME=/build @@ -87,8 +97,9 @@ cd /build ${cmd} EOF - chmod 755 "$copydir/chrootexec" - archroot $flags "$copydir" -r /chrootexec + chmod 755 "$copydir/chrootexec" + archroot $flags "$copydir" -r /chrootexec + fi } copy_pkgs() { |