diff options
Diffstat (limited to 'src/chroot-tools/libremakepkg.gpl2')
-rwxr-xr-x | src/chroot-tools/libremakepkg.gpl2 | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/chroot-tools/libremakepkg.gpl2 b/src/chroot-tools/libremakepkg.gpl2 index 1077b66..fd58d50 100755 --- a/src/chroot-tools/libremakepkg.gpl2 +++ b/src/chroot-tools/libremakepkg.gpl2 @@ -23,6 +23,8 @@ chroot_init() { mkdir -p "$copydir/pkgdest" mkdir -p "$copydir/srcdest" + mkdir -p "$copydir/build" + chroot_makepkg_conf_set PKGDEST /pkgdest chroot_makepkg_conf_set SRCDEST /srcdest @@ -66,26 +68,27 @@ chroot_extract() { chown -R nobody "$copydir"/{build,pkgdest,srcdest} cp -a "$(which chcleanup)" "${copydir}/clean" - local file="$copydir/chrootextract" - echo '#!/bin/bash' > "$file" - echo '. /etc/profile' >> "$file" - echo 'export HOME=/build' >> "$file" - echo 'cd /build' >> "$file" - echo '/clean' >> "$file" - echo "sudo -u nobody ${MAKEPKG} $makepkg_args -o" >> "$file" - chmod 755 "$file" - archroot "$copydir" -r /chrootextract + chroot_exec "/clean && sudo -u nobody ${MAKEPKG} ${makepkg_args} -o" } chroot_build() { - local file="$copydir/chrootbuild" - echo '#!/bin/bash' > "$file" - echo '. /etc/profile' >> "$file" - echo 'export HOME=/build' >> "$file" - echo 'cd /build' >> "$file" - echo "sudo -u nobody ${MAKEPKG} $makepkg_args -e" >> "$file" - chmod 755 "$file" - archroot -N "$copydir" -r /chrootbuild + chroot_exec -N "sudo -u nobody ${MAKEPKG} ${makepkg_args} -e" +} + +chroot_exec() { + local flags='' + [[ $1 == -N ]] && { flags=$1; shift; } + local cmd="$*" + cat >"$copydir/chrootexec" <<EOF +#!/bin/bash +. /etc/profile +export HOME=/build +cd /build + +${cmd} +EOF + chmod 755 "$copydir/chrootexec" + archroot $flags "$copydir" -r /chrootexec } copy_pkgs() { |