diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-03-26 09:58:28 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-03-26 09:58:28 +0100 |
commit | bdde6e5a35a697603e9637bbc0e153b1d2fa4320 (patch) | |
tree | c2f8d0e62288a3fa23295a83f241e5d0edb59dd7 /archbuild | |
parent | 38f85d654aa93401fd90cbe44994ea894f73635f (diff) | |
parent | 2fa8fdec478529cd8649d38f9bfe2e50a3e28469 (diff) | |
download | devtools32-bdde6e5a35a697603e9637bbc0e153b1d2fa4320.tar.xz |
Merge branch 'master', remote-tracking branch 'heftig/master'
Diffstat (limited to 'archbuild')
-rwxr-xr-x | archbuild | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -4,9 +4,9 @@ base_packages='base base-devel sudo' cmd="$(basename "${0%-build}")" if [ "${cmd%-*}" == 'multilib' ]; then - repo="${cmd}" - arch='x86_64' - base_packages+=' gcc-multilib libtool-multilib' + repo="${cmd}" + arch='x86_64' + base_packages+=' multilib-devel' else repo=${cmd%-*} arch=${cmd##*-} @@ -29,20 +29,39 @@ while getopts 'cr:' arg; do esac done +if [ "$EUID" != '0' ]; then + echo 'This script must be run as root.' + exit 1 +fi + if ${clean_first} || [ ! -d "${chroots}/${repo}-${arch}" ]; then echo "Creating chroot for [${repo}] (${arch})..." - sudo rm -rf ${chroots}/${repo}-${arch} - sudo mkdir -p ${chroots}/${repo}-${arch} - setarch ${arch} sudo mkarchroot \ + + for copy in ${chroots}/${repo}-${arch}/*; do + [[ -d $copy ]] || continue + echo "Deleting chroot copy '$(basename "${copy}")'..." + + # Lock the copy + exec 9>${copy}.lock + flock 9 + + { type -P btrfs && btrfs subvolume delete ${copy}; } &>/dev/null + rm -rf ${copy} + done + exec 9>&- + + rm -rf ${chroots}/${repo}-${arch} + mkdir -p ${chroots}/${repo}-${arch} + setarch ${arch} mkarchroot \ -C /usr/share/devtools/pacman-${repo}.conf \ -M /usr/share/devtools/makepkg-${arch}.conf \ ${chroots}/${repo}-${arch}/root \ ${base_packages} else - setarch ${arch} sudo mkarchroot \ + setarch ${arch} mkarchroot \ -u \ ${chroots}/${repo}-${arch}/root fi echo "Building in chroot for [${repo}] (${arch})..." -setarch ${arch} sudo makechrootpkg -c -r ${chroots}/${repo}-${arch} +setarch ${arch} makechrootpkg -c -r ${chroots}/${repo}-${arch} |