#!/bin/bash # Contains code derived from devtools' "makechrootpkg" # Copyright 2011-2012 The Arch Linux Development Team # Copyright 2012 Luke Shumaker # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. chroot_init() { # make sure the chroot exists librechroot -n "$CHROOT" -l "$CHROOTCOPY" -m if [[ -r "$LIBREHOME/.gnupg/pubring.gpg" ]]; then install -D "$HOME/.gnupg/pubring.gpg" "$copydir/build/.gnupg/pubring.gpg" fi mkdir -p "$copydir/pkgdest" mkdir -p "$copydir/srcdest" mkdir -p "$copydir/build" chroot_makepkg_conf_set PKGDEST /pkgdest chroot_makepkg_conf_set SRCDEST /srcdest cat > "$copydir/etc/sudoers.d/nobody-pacman" <"$copydir/chrootexec" </dev/null cp "$pkgfile" . repo-add repo.db.tar.gz "${pkgfile##*/}" popd >/dev/null chown "$LIBREUSER" "$pkgfile" mv "$pkgfile" "$PKGDEST" if [[ $PKGDEST != . ]]; then ln -s "$PKGDEST/${pkgfile##*/}" . fi done }