diff options
author | Lukas Fleischer <archlinux@cryptocrack.de> | 2011-08-28 18:36:52 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-08-29 13:58:49 +0200 |
commit | ef10f6c799c18adb555ee4f081097caf36823bfe (patch) | |
tree | faa7050bb3d231cbda9d4751fae2c2c6f756de7f | |
parent | d70918d18af105f57ca38f06c0f3590bedf8e197 (diff) |
archbuild: Proper quoting, use double brackets
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
-rwxr-xr-x | archbuild | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -3,7 +3,7 @@ base_packages=(base base-devel sudo) cmd="$(basename "${0%-build}")" -if [ "${cmd%-*}" == 'multilib' ]; then +if [[ "${cmd%-*}" == 'multilib' ]]; then repo="${cmd}" arch='x86_64' base_packages+=(multilib-devel) @@ -29,39 +29,39 @@ while getopts 'cr:' arg; do esac done -if [ "$EUID" != '0' ]; then +if [[ "$EUID" != '0' ]]; then echo 'This script must be run as root.' exit 1 fi -if ${clean_first} || [ ! -d "${chroots}/${repo}-${arch}" ]; then +if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then echo "Creating chroot for [${repo}] (${arch})..." - for copy in ${chroots}/${repo}-${arch}/*; do + for copy in "${chroots}/${repo}-${arch}"/*; do [[ -d $copy ]] || continue echo "Deleting chroot copy '$(basename "${copy}")'..." # Lock the copy - exec 9>${copy}.lock + exec 9>"${copy}.lock" flock 9 - { type -P btrfs && btrfs subvolume delete ${copy}; } &>/dev/null - rm -rf ${copy} + { 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 \ + 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} mkarchroot \ -u \ - ${chroots}/${repo}-${arch}/root + "${chroots}/${repo}-${arch}/root" fi echo "Building in chroot for [${repo}] (${arch})..." -setarch ${arch} makechrootpkg -c -r ${chroots}/${repo}-${arch} +setarch "${arch}" makechrootpkg -c -r "${chroots}/${repo}-${arch}" |