[arch-projects] [devtools] [PATCH 1/4] archbuild: Use array for base packages
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archbuild | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/archbuild b/archbuild index 19b734b..fa16914 100755 --- a/archbuild +++ b/archbuild @@ -1,12 +1,12 @@ #!/bin/bash -base_packages='base base-devel sudo' +base_packages=(base base-devel sudo) cmd="$(basename "${0%-build}")" if [ "${cmd%-*}" == 'multilib' ]; then repo="${cmd}" arch='x86_64' - base_packages+=' multilib-devel' + base_packages+=(multilib-devel) else repo=${cmd%-*} arch=${cmd##*-} @@ -56,7 +56,7 @@ if ${clean_first} || [ ! -d "${chroots}/${repo}-${arch}" ]; then -C /usr/share/devtools/pacman-${repo}.conf \ -M /usr/share/devtools/makepkg-${arch}.conf \ ${chroots}/${repo}-${arch}/root \ - ${base_packages} + "${base_packages[@]}" else setarch ${arch} mkarchroot \ -u \ -- 1.7.6.1
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archbuild | 30 +++++++++++++++--------------- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/archbuild b/archbuild index fa16914..c57a731 100755 --- a/archbuild +++ b/archbuild @@ -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}" -- 1.7.6.1
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- archbuild | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/archbuild b/archbuild index c57a731..5518996 100755 --- a/archbuild +++ b/archbuild @@ -2,20 +2,21 @@ base_packages=(base base-devel sudo) -cmd="$(basename "${0%-build}")" -if [[ "${cmd%-*}" == 'multilib' ]]; then - repo="${cmd}" +cmd="${0##*/}" +if [[ "${cmd%%-*}" == 'multilib' ]]; then + repo="${cmd%-build}" arch='x86_64' base_packages+=(multilib-devel) else - repo=${cmd%-*} - arch=${cmd##*-} + tag="${cmd%-build}" + repo=${tag%-*} + arch=${tag##*-} fi chroots='/var/tmp/archbuild' clean_first=false usage() { - echo "usage $(basename "$0")" + echo "usage $cmd" echo ' -c Recreate the chroot before building' echo ' -r <dir> Create chroots in this directory' exit 1 -- 1.7.6.1
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- commitpkg | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/commitpkg b/commitpkg index 410bc88..2a732b5 100755 --- a/commitpkg +++ b/commitpkg @@ -42,7 +42,7 @@ if [ -r ~/.makepkg.conf ]; then . ~/.makepkg.conf fi -cmd=$(basename "$0") +cmd=${0##*/} if [ ! -f PKGBUILD ]; then abort 'No PKGBUILD file' -- 1.7.6.1
participants (1)
-
Lukas Fleischer