From 1ba64c22602bdf5c53565083c13c67a4583e32ff Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 8 Dec 2012 13:11:18 -0500 Subject: Add /usr/share/libretools/conf.sh, use /etc/libretools.d/chroot.conf Use it for librechroot, libremakepkg, libremkchroot --- src/chroot-tools/chroot.conf | 7 ++++++ src/chroot-tools/librechroot | 5 ++++- src/chroot-tools/libremakepkg | 45 ++++++++++---------------------------- src/chroot-tools/libremakepkg.gpl2 | 4 ++-- src/chroot-tools/libremkchroot | 5 ++++- 5 files changed, 28 insertions(+), 38 deletions(-) create mode 100644 src/chroot-tools/chroot.conf (limited to 'src/chroot-tools') diff --git a/src/chroot-tools/chroot.conf b/src/chroot-tools/chroot.conf new file mode 100644 index 0000000..cd5c71d --- /dev/null +++ b/src/chroot-tools/chroot.conf @@ -0,0 +1,7 @@ +## The directory where the chroots are stored +CHROOTDIR=/var/lib/archbuild +## Extra packages to have installed on the chroot (besides base base-devel and sudo) +CHROOTEXTRAPKG=(distcc ccache tsocks libretools) +## The meaning of this changes based on the version of libretools+devtools +## do NOT set it to 'root' +CHROOT=default diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index 52a3bdf..0770ad6 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -20,7 +20,10 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. /etc/libretools.conf +. /usr/share/libretools/conf.sh +load_conf_libretools_chroot + +. "$(which libremessages)" # This file (librechroot) is GPLv3+, but I would like to use some code # modified from devtools' "makechrootpkg", which is GPLv2. diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index ec7adbd..c66f5cc 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -20,7 +20,10 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -. /etc/libretools.conf +. /usr/share/libretools/conf.sh +load_conf_libretools_chroot + +. "$(which libremessages)" shopt -s nullglob @@ -54,34 +57,6 @@ trap_exit() { exit 1 } -## -# Usage: makepkg_conf_get SETTING [DEFAULT] -## -makepkg_conf_get() { - local setting=$1 - if [[ -f $LIBREHOME/.makepkg.conf ]]; then - eval $(grep "^$setting=" "$LIBREHOME/.makepkg.conf") - fi - if [[ -z ${!setting:-} ]]; then - eval $(grep "^$setting=" "/etc/makepkg.conf") - fi - if [[ -z ${!setting:-} && -n ${2:-} ]]; then - eval "$setting='$2'" - fi -} - -chroot_makepkg_conf_get() { - local setting=$1 - eval $(grep "^$setting=" "$copydir/etc/makepkg.conf") -} - -chroot_makepkg_conf_set() { - local key=$1 - local val=$2 - sed -i "/^$key=/d" "$copydir/etc/makepkg.conf" - echo "$key='$val'" >> "$copydir/etc/makepkg.conf" -} - # Functions that check for issues with the build ############################### libre_check_pkgbuild() { @@ -172,16 +147,18 @@ main() { trap 'trap_exit "(libremakepkg): Aborted by user! Exiting..."' INT trap 'trap_exit "(libremakepkg): An unknown error has occurred. Exiting..."' ERR - makepkg_conf_get SRCDEST . - makepkg_conf_get PKGDEST . + SRCDEST="$(get_conf_makepkg SRCDEST .)" + PKGDEST="$(get_conf_makepkg PKGDEST .)" # OK, we're starting now ############################################### lock_open_write 9 "$copydir" "Locking chroot '$CHROOTCOPY'" - # Set target CARCH as it might be used within the PKGBUILD to select correct sources - chroot_makepkg_conf_get CARCH - export CARCH + # Set target CARCH as it might be used within the PKGBUILD to select + # correct sources + MAKEPKG_CONF=$copydir/etc/makepkg.conf + export CARCH="$(get_conf_makepkg CARCH)" + unset MAKEPKG_CONF $NOCHROOT || chroot_init diff --git a/src/chroot-tools/libremakepkg.gpl2 b/src/chroot-tools/libremakepkg.gpl2 index 3f66589..50bb48e 100755 --- a/src/chroot-tools/libremakepkg.gpl2 +++ b/src/chroot-tools/libremakepkg.gpl2 @@ -25,8 +25,8 @@ chroot_init() { mkdir -p "$copydir/srcdest" mkdir -p "$copydir/build" - chroot_makepkg_conf_set PKGDEST /pkgdest - chroot_makepkg_conf_set SRCDEST /srcdest + MAKEPKG_CONF=$copydir/etc/makepkg.conf set_conf_makepkg PKGDEST /pkgdest + MAKEPKG_CONF=$copydir/etc/makepkg.conf set_conf_makepkg SRCDEST /srcdest cat > "$copydir/etc/sudoers.d/nobody-pacman" <. -. /etc/libretools.conf +. /usr/share/libretools/conf.sh +load_conf_libretools_chroot + +. "$(which libremessages)" cmd=${0##*/} -- cgit v1.2.3-54-g00ecf