From 46510e1fc48f37ce76c2bf5f19f885bba8d5d098 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 18 Jun 2014 13:05:12 -0400 Subject: Clean up quoting. --- cron-jobs/check_archlinux/parse_pkgbuilds.sh | 36 +++++++------- cron-jobs/devlist-mailer | 2 +- cron-jobs/ftpdir-cleanup | 19 ++++--- cron-jobs/integrity-check | 4 +- cron-jobs/repo-sanity-check | 23 ++++----- cron-jobs/sourceballs | 18 +++---- cron-jobs/sourceballs2 | 8 +-- cron-jobs/update-abs-tarballs | 4 +- db-check-nonfree | 6 +-- db-cleanup | 21 ++++---- db-functions | 74 ++++++++++++++-------------- db-move | 32 ++++++------ db-remove | 8 +-- db-repo-add | 18 +++---- db-repo-remove | 18 +++---- db-sync | 56 ++++++++++----------- db-update | 6 +-- testing2x | 22 ++++----- 18 files changed, 187 insertions(+), 188 deletions(-) diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh index 9b26f1e..b857ac8 100755 --- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh +++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh @@ -12,7 +12,7 @@ readonly -a variables splitpkg_overrides backup_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" - eval "${indirect}=(\${$var[@]})" + eval "${indirect}=(\"\${$var[@]}\")" done } @@ -20,9 +20,9 @@ restore_package_variables() { for var in "${splitpkg_overrides[@]}"; do indirect="${var}_backup" if [ -n "${!indirect}" ]; then - eval "${var}=(\${$indirect[@]})" + eval "${var}=(\"\${$indirect[@]}\")" else - unset ${var} + unset "${var}" fi done } @@ -42,31 +42,31 @@ print_info() { if [ -n "$arch" ]; then echo "%ARCH%" - for i in "${arch[@]}"; do echo $i; done + for i in "${arch[@]}"; do echo "$i"; done echo "" fi if [ -n "$depends" ]; then echo "%DEPENDS%" for i in "${depends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$makedepends" ]; then echo "%MAKEDEPENDS%" for i in "${makedepends[@]}"; do - echo $i + echo "$i" done echo "" fi if [ -n "$conflicts" ]; then echo "%CONFLICTS%" - for i in "${conflicts[@]}"; do echo $i; done + for i in "${conflicts[@]}"; do echo "$i"; done echo "" fi if [ -n "$provides" ]; then echo "%PROVIDES%" - for i in "${provides[@]}"; do echo $i; done + for i in "${provides[@]}"; do echo "$i"; done echo "" fi } @@ -76,9 +76,9 @@ source_pkgbuild() { dir=$1 pkgbuild=$dir/PKGBUILD for var in "${variables[@]}"; do - unset ${var} + unset "${var}" done - source $pkgbuild &>/dev/null || ret=$? + source "$pkgbuild" &>/dev/null || ret=$? # ensure $pkgname and $pkgver variables were found if [ $ret -ne 0 -o -z "$pkgname" -o -z "$pkgver" ]; then @@ -89,7 +89,7 @@ source_pkgbuild() { if [ "${#pkgname[@]}" -gt "1" ]; then pkgbase=${pkgbase:-${pkgname[0]}} for pkg in "${pkgname[@]}"; do - if [ "$(type -t package_${pkg})" != "function" ]; then + if [ "$(type -t "package_${pkg}")" != "function" ]; then echo -e "%INVALID%\n$pkgbuild\n" return 1 else @@ -104,7 +104,7 @@ source_pkgbuild() { break fi done - done < <(type package_${pkg}) + done < <(type "package_${pkg}") print_info restore_package_variables fi @@ -124,14 +124,14 @@ find_pkgbuilds() { return fi - if [ -f $1/PKGBUILD ]; then - source_pkgbuild $1 + if [ -f "$1/PKGBUILD" ]; then + source_pkgbuild "$1" return fi empty=1 - for dir in $1/*; do - if [ -d $dir ]; then - find_pkgbuilds $dir + for dir in "$1"/*; do + if [ -d "$dir" ]; then + find_pkgbuilds "$dir" unset empty fi done @@ -147,7 +147,7 @@ fi CARCH=$1 shift for dir in "$@"; do - find_pkgbuilds $dir + find_pkgbuilds "$dir" done exit 0 diff --git a/cron-jobs/devlist-mailer b/cron-jobs/devlist-mailer index 32896f7..1a05521 100755 --- a/cron-jobs/devlist-mailer +++ b/cron-jobs/devlist-mailer @@ -23,6 +23,6 @@ if [ -n "$(echo $stdin)" ]; then To: $LIST From: $FROM -$stdin" | /usr/sbin/sendmail -F$FROM "$LIST" +$stdin" | /usr/sbin/sendmail -F"$FROM" "$LIST" fi diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index f2d8b33..d5a277b 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -7,7 +7,7 @@ clean_pkg() { local pkg local target - if ! ${CLEANUP_DRYRUN}; then + if ! "${CLEANUP_DRYRUN}"; then for pkg in "$@"; do if [ -h "$pkg" ]; then rm -f "$pkg" "$pkg.sig" @@ -22,8 +22,7 @@ clean_pkg() { fi } - -${CLEANUP_DRYRUN} && warning 'dry run mode is active' +"${CLEANUP_DRYRUN}" && warning 'dry run mode is active' for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do @@ -38,7 +37,7 @@ for repo in "${PKGREPOS[@]}"; do missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#missing_pkgs[@]} -ge 1 ]; then error "Missing packages in [${repo}] (${arch})..." - for missing_pkg in ${missing_pkgs[@]}; do + for missing_pkg in "${missing_pkgs[@]}"; do msg2 "${missing_pkg}" done fi @@ -46,7 +45,7 @@ for repo in "${PKGREPOS[@]}"; do old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}")) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from [${repo}] (${arch})..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}" done @@ -62,18 +61,18 @@ cat "${WORKDIR}/db-"* | sort -u > "${WORKDIR}/db" old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db")) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from package pool..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}" done fi -old_pkgs=($(find ${CLEANUP_DESTDIR} -type f -name "*${PKGEXT}" -mtime +${CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${CLEANUP_DESTDIR}" -type f -name "*${PKGEXT}" -mtime +"${CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old packages from the cleanup directory..." - for old_pkg in ${old_pkgs[@]}; do + for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - if ! ${CLEANUP_DRYRUN}; then + if ! "${CLEANUP_DRYRUN}"; then rm -f "${CLEANUP_DESTDIR}/${old_pkg}" rm -f "${CLEANUP_DESTDIR}/${old_pkg}.sig" fi @@ -82,7 +81,7 @@ fi for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index 86a8f1d..33a4eb6 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -13,12 +13,12 @@ fi mailto=$1 check() { - ${dirname}/check_archlinux/check_packages.py \ + "${dirname}"/check_archlinux/check_packages.py \ --repos="${repos}" \ --abs-tree="/srv/abs/rsync/${arch},/srv/abs/rsync/any" \ --repo-dir="${FTP_BASE}" \ --arch="${arch}" \ - 2>&1 | ${dirname}/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" + 2>&1 | "${dirname}"/devlist-mailer "Integrity Check ${arch}: ${repos}" "${mailto}" } repos='core,extra,community' diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index f5f80c8..105bac4 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -10,9 +10,9 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on this repo's abs on_abs=($( - find ${SVNREPO}/${_repo} -name PKGBUILD | \ + find "${SVNREPO}/${_repo}" -name PKGBUILD | \ while read pkgbuild; do - source ${pkgbuild} >/dev/null 2>&1 + source "${pkgbuild}" >/dev/null 2>&1 # cleanup to save memory unset build package source md5sums pkgdesc pkgver pkgrel epoch \ url license arch depends makedepends optdepends options \ @@ -20,11 +20,11 @@ for _repo in "${PKGREPOS[@]}"; do # also cleanup package functions for _pkg in "${pkgname[@]}"; do - unset package_${pkg} >/dev/null 2>&1 + unset "package_${pkg}" >/dev/null 2>&1 done # this fills the on_abs array - echo ${pkgname[@]} + echo "${pkgname[@]}" done )) @@ -36,20 +36,21 @@ for _repo in "${PKGREPOS[@]}"; do # Find all pkgnames on repos on_repo=($( - find ${FTP_BASE}/${_repo} -name "*.pkg.tar.?z" -printf "%f\n" | \ - sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" + find "${FTP_BASE}/${_repo}" -name "*.pkg.tar.?z" \ + -printf "%f\n" | sed "s/^\(.\+\)-[^-]\+-[^-]\+-[^-]\+$/\1/" )) # Compares them, whatever is on repos but not on abs should be removed - remove=($(comm -13 <(echo ${on_abs[@]} | tr ' ' "\n" | sort -u) \ - <(echo ${on_repo[@]} | tr ' ' "\n" | sort -u))) + remove=($(comm -13 \ + <(printf '%s\n' "${on_abs[@]}" | sort -u) \ + <(printf '%s\n' "${on_repo[@]}" | sort -u) )) # Remove them from databases, ftpdir-cleanup will take care of the rest - find ${FTP_BASE}/${_repo} -name "*.db.tar.?z" -exec \ - repo-remove {} ${remove[@]} >/dev/null 2>&1 \; + find "${FTP_BASE}/${_repo}" -name "*.db.tar.?z" -exec \ + repo-remove {} "${remove[@]}" >/dev/null 2>&1 \; msg2 "Removed the following packages:" - plain "$(echo ${remove[@]} | tr ' ' "\n")" + plain '%s' "${remove[@]}" done diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs index 8171980..9c07c22 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -9,7 +9,7 @@ script_lock for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_lock ${repo} ${arch} || exit 1 + repo_lock "${repo}" "${arch}" || exit 1 done done @@ -41,7 +41,7 @@ done for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${arch} + repo_unlock "${repo}" "${arch}" done done @@ -74,7 +74,7 @@ for repo in "${PKGREPOS[@]}"; do # Build the source package if its not already there if ! grep -Fqx "${pkgbase}-${pkgver}${SRCEXT}" "${WORKDIR}/available-src-pkgs"; then # Check if we had failed before - if in_array "${pkgbase}-${pkgver}${SRCEXT}" ${failedpkgs[@]}; then + if in_array "${pkgbase}-${pkgver}${SRCEXT}" "${failedpkgs[@]}"; then continue fi @@ -99,9 +99,9 @@ for repo in "${PKGREPOS[@]}"; do mv "${pkgbase}-${pkgver}${SRCEXT}" "${FTP_BASE}/${SRCPOOL}" # Avoid creating the same source package for every arch echo "${pkgbase}-${pkgver}${SRCEXT}" >> "${WORKDIR}/available-src-pkgs" - newpkgs[${#newpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + newpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") else - failedpkgs[${#failedpkgs[*]}]="${pkgbase}-${pkgver}${SRCEXT}" + failedpkgs+=("${pkgbase}-${pkgver}${SRCEXT}") fi popd >/dev/null fi @@ -128,22 +128,22 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages..." - ${SOURCE_CLEANUP_DRYRUN} && warning 'dry run mode is active' + "${SOURCE_CLEANUP_DRYRUN}" && warning 'dry run mode is active' for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - if ! ${SOURCE_CLEANUP_DRYRUN}; then + if ! "${SOURCE_CLEANUP_DRYRUN}"; then mv "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}" touch "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" fi done fi -old_pkgs=($(find ${SOURCE_CLEANUP_DESTDIR} -type f -name "*${SRCEXT}" -mtime +${SOURCE_CLEANUP_KEEP} -printf '%f\n')) +old_pkgs=($(find "${SOURCE_CLEANUP_DESTDIR}" -type f -name "*${SRCEXT}" -mtime +"${SOURCE_CLEANUP_KEEP}" -printf '%f\n')) if [ ${#old_pkgs[@]} -ge 1 ]; then msg "Removing old source packages from the cleanup directory..." for old_pkg in "${old_pkgs[@]}"; do msg2 "${old_pkg}" - ${SOURCE_CLEANUP_DRYRUN} || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" + "${SOURCE_CLEANUP_DRYRUN}" || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}" done fi diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 49a2dac..f7b3779 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -24,11 +24,11 @@ pushd "${SVNREPO}" >/dev/null for repo in "${PKGREPOS[@]}"; do msg "Sourceballing [${repo}]" - pushd $repo >/dev/null + pushd "$repo" >/dev/null find -maxdepth 1 -type d | while read pkg; do pushd "${SVNREPO}/$repo/$pkg" >/dev/null - [[ ! -e PKGBUILD ]] && { + [[ ! -e ./PKGBUILD ]] && { warning "$repo/$pkg is not a package" continue } @@ -41,7 +41,7 @@ for repo in "${PKGREPOS[@]}"; do optdepends license arch options check mksource for _pkg in "${pkgname[@]}"; do - unset package_${_pkg} >/dev/null 2>&1 + unset "package_${_pkg}" >/dev/null 2>&1 done pkgbase=${pkgbase:-$pkgname} @@ -54,7 +54,7 @@ for repo in "${PKGREPOS[@]}"; do makepkg --allsource --ignorearch -c >/dev/null 2>&1 - [ $? -ne 0 ] && plain ${srcfile} + [ $? -ne 0 ] && plain '%s' "${srcfile}" done # end find pkgs popd >/dev/null diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 901cc4b..e710f7c 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -2,6 +2,4 @@ . "$(dirname "$(readlink -e "$0")")/../config" -rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ - -exit $? +rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ "${FTP_BASE}/" diff --git a/db-check-nonfree b/db-check-nonfree index b08b7b1..cae4a14 100755 --- a/db-check-nonfree +++ b/db-check-nonfree @@ -11,12 +11,12 @@ fi # TODO: this might lock too much (architectures) for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_lock ${repo} ${pkgarch} || exit 1 + repo_lock "${repo}" "${pkgarch}" || exit 1 done done msg "Check nonfree in repo:" -nonfree=($(cut -d: -f1 ${BLACKLIST_FILE} | sort -u)) +nonfree=($(cut -d: -f1 "${BLACKLIST_FILE}" | sort -u)) for repo in "${ARCHREPOS[@]}"; do for pkgarch in "${ARCHES[@]}"; do msg2 "$repo $pkgarch" @@ -41,6 +41,6 @@ done for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${pkgarch} + repo_unlock "${repo}" "${pkgarch}" done done diff --git a/db-cleanup b/db-cleanup index a35bdf2..b2f2e08 100755 --- a/db-cleanup +++ b/db-cleanup @@ -25,10 +25,11 @@ trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR -${CLEANUP_DRYRUN} && EXTRAFLAGS+=" --dry-run" +EXTRAFLAGS=() +"${CLEANUP_DRYRUN}" && EXTRAFLAGS+=(--dry-run) -for _repo in ${PKGREPOS[@]}; do - for _arch in ${ARCHES[@]}; do +for _repo in "${PKGREPOS[@]}"; do + for _arch in "${ARCHES[@]}"; do msg "Getting ${_repo}-${_arch} database" dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}" @@ -42,25 +43,25 @@ for _repo in ${PKGREPOS[@]}; do bsdtar tf "${dbfile}" | \ cut -d'/' -f1 | \ sort -u | \ - sed "s|$|*|" >> /tmp/${0##*/}.$$.filter + sed "s|$|*|" >> "/tmp/${0##*/}.$$.filter" done done msg "Removing old files:" -for POOL in ${PKGPOOLS[@]} ${SRCPOOLS[@]}; do +for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do msg2 "${POOL}" - rsync ${EXTRAFLAGS} -va --delete-excluded \ + rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \ --include-from="/tmp/${0##*/}.$$.filter" \ --exclude="*" \ - ${FTP_BASE}/${POOL}/ \ - ${FTP_BASE}/${POOL}/ + "${FTP_BASE}/${POOL}/" \ + "${FTP_BASE}/${POOL}/" done msg "Removing symlinks:" -find -L ${FTP_BASE}/ -type l -${CLEANUP_DRYRUN} || find -L ${FTP_BASE}/ -type l -delete +find -L "${FTP_BASE}/" -type l +"${CLEANUP_DRYRUN}" || find -L "${FTP_BASE}/" -type l -delete exit $? diff --git a/db-functions b/db-functions index 6b49e6a..1384080 100644 --- a/db-functions +++ b/db-functions @@ -12,7 +12,7 @@ set_umask () { } restore_umask () { - umask $UMASK >/dev/null + umask "$UMASK" >/dev/null } # just like mv -f, but we touch the file and then copy the content so @@ -75,7 +75,7 @@ in_array() { [[ -z $1 ]] && return 1 # Not Found local item for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found + [[ $item = "$needle" ]] && return 0 # Found done return 1 # Not Found } @@ -87,16 +87,16 @@ in_array() { get_full_version() { if [[ $1 -eq 0 ]]; then # zero epoch case, don't include it in version - echo $2-$3 + echo "$2-$3" else - echo $1:$2-$3 + echo "$1:$2-$3" fi } script_lock() { local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - local _owner="$(/usr/bin/stat -c %U $LOCKDIR)" + local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" error "Script ${0##*/} is already locked by $_owner." exit 1 else @@ -129,7 +129,7 @@ cleanup() { arch=${l#*.} if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then msg "Removing left over lock from [${repo}] (${arch})" - repo_unlock $repo $arch + repo_unlock "$repo" "$arch" fi done if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then @@ -137,7 +137,7 @@ cleanup() { script_unlock fi rm -rf "$WORKDIR" - [ "$1" ] && exit $1 + [ "$1" ] && exit "$1" } abort() { @@ -167,11 +167,11 @@ repo_lock () { # This is the lock file used by repo-add and repo-remove if [ -f "${DBLOCKFILE}" ]; then - error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat $DBLOCKFILE)" + error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat "$DBLOCKFILE")" return 1 fi if [ -f "${FILESLOCKFILE}" ]; then - error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat ${FILESLOCKFILE})" + error "Repo [${1}] (${2}) is already locked by repo-{add,remove} process $(cat "$FILESLOCKFILE")" return 1 fi @@ -185,17 +185,17 @@ repo_lock () { fi _count=0 - while [ $_count -le $_trial ] || $_lockblock ; do + while [ "$_count" -le "$_trial" ] || "$_lockblock" ; do if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then - _owner="$(/usr/bin/stat -c %U $LOCKDIR)" + _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" warning "Repo [${1}] (${2}) is already locked by $_owner. " msg2 "Retrying in $LOCK_DELAY seconds..." else - LOCKS[${#LOCKS[*]}]="$1.$2" + LOCKS+=("$1.$2") set_umask return 0 fi - sleep $LOCK_DELAY + sleep "$LOCK_DELAY" let _count=$_count+1 done @@ -293,7 +293,7 @@ getpkgfile() { elif [ ! -f "${1}" ]; then error "Package ${1} not found!" exit 1 - elif ${REQUIRE_SIGNATURE} && [ ! -f "${1}.sig" ]; then + elif "${REQUIRE_SIGNATURE}" && [ ! -f "${1}.sig" ]; then error "Package signature ${1}.sig not found!" exit 1 fi @@ -303,7 +303,7 @@ getpkgfile() { getpkgfiles() { local f - if [ ! -z "$(echo ${@%\.*} | sed "s/ /\n/g" | sort | uniq -D)" ]; then + if [ ! -z "$(printf '%s\n' "${@%\.*}" | sort | uniq -D)" ]; then error 'Duplicate packages found!' exit 1 fi @@ -312,7 +312,7 @@ getpkgfiles() { if [ ! -f "${f}" ]; then error "Package ${f} not found!" exit 1 - elif ${REQUIRE_SIGNATURE} && [ ! -f "${f}.sig" ]; then + elif "${REQUIRE_SIGNATURE}" && [ ! -f "${f}.sig" ]; then error "Package signature ${f}.sig not found!" exit 1 fi @@ -324,11 +324,11 @@ getpkgfiles() { check_pkgfile() { local pkgfile=$1 - local pkgname="$(getpkgname ${pkgfile})" + local pkgname="$(getpkgname "${pkgfile}")" [ $? -ge 1 ] && return 1 - local pkgver="$(getpkgver ${pkgfile})" + local pkgver="$(getpkgver "${pkgfile}")" [ $? -ge 1 ] && return 1 - local pkgarch="$(getpkgarch ${pkgfile})" + local pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && return 1 in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1 @@ -342,13 +342,13 @@ check_pkgfile() { check_pkgsvn() { local pkgfile="${1}" - local _pkgbase="$(getpkgbase ${pkgfile})" + local _pkgbase="$(getpkgbase "${pkgfile}")" [ $? -ge 1 ] && return 1 - local _pkgname="$(getpkgname ${pkgfile})" + local _pkgname="$(getpkgname "${pkgfile}")" [ $? -ge 1 ] && return 1 - local _pkgver="$(getpkgver ${pkgfile})" + local _pkgver="$(getpkgver "${pkgfile}")" [ $? -ge 1 ] && return 1 - local _pkgarch="$(getpkgarch ${pkgfile})" + local _pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && return 1 local repo="${2}" @@ -361,10 +361,10 @@ check_pkgsvn() { [ $? -ge 1 ] && return 1 fi - local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel}) )" + local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}")" [ "${svnver}" == "${_pkgver}" ] || return 1 - local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}")) in_array "${_pkgname}" "${svnnames[@]}" || return 1 return 0 @@ -383,19 +383,19 @@ check_splitpkgs() { for pkgfile in "${pkgfiles[@]}"; do issplitpkg "${pkgfile}" || continue - local _pkgbase="$(getpkgbase ${pkgfile})" + local _pkgbase="$(getpkgbase "${pkgfile}")" msg2 "Checking $_pkgbase" - local _pkgname="$(getpkgname ${pkgfile})" - local _pkgarch="$(getpkgarch ${pkgfile})" + local _pkgname="$(getpkgname "${pkgfile}")" + local _pkgarch="$(getpkgarch "${pkgfile}")" mkdir -p "${repo}/${_pkgarch}/${_pkgbase}" echo "${_pkgname}" >> "${repo}/${_pkgarch}/${_pkgbase}/staging" if [ ! -f "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" ]; then mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}" - cp -r ${SVNREPO}/$repo/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ - cp -r ${SVNREPO}/libre/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ - cp -r ${SVNREPO}/libre-testing/$_pkgbase/PKGBUILD "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/$_pkgbase">/dev/null 2>&1 + cp -r "${SVNREPO}/$repo/$_pkgbase/PKGBUILD" "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre/$_pkgbase/PKGBUILD" "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null 2>&1 || \ + cp -r "${SVNREPO}/libre-testing/$_pkgbase/PKGBUILD" "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/$_pkgbase">/dev/null 2>&1 [[ $? -ge 1 ]] && { echo "Failed $_pkgbase-$_pkgver-$_pkgarch" @@ -403,7 +403,7 @@ check_splitpkgs() { } fi - local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]})) + local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}")) for svnname in "${svnnames[@]}"; do echo "${svnname}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn" done @@ -475,8 +475,8 @@ check_repo_permission() { for arch in ${ARCHES}; do local dir="${FTP_BASE}/${repo}/os/${arch}/" [ -w "${dir}" ] || return 1 - [ -f "${dir}"${repo}${DBEXT} -a ! -w "${dir}"${repo}${DBEXT} ] && return 1 - [ -f "${dir}"${repo}${FILESEXT} -a ! -w "${dir}"${repo}${FILESEXT} ] && return 1 + [ -f "${dir}${repo}"${DBEXT} -a ! -w "${dir}${repo}"${DBEXT} ] && return 1 + [ -f "${dir}${repo}"${FILESEXT} -a ! -w "${dir}${repo}"${FILESEXT} ] && return 1 done return 0 @@ -490,9 +490,9 @@ set_repo_permission() { if [ -w "${dbfile}" ]; then local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") - chgrp $group "${dbfile}" || error "Could not change group of ${dbfile} to $group" - chgrp $group "${filesfile}" || error "Could not change group of ${filesfile} to $group" - chmod g+w "${dbfile}" || error "Could not set write permission for group $group to ${dbfile}" + chgrp "$group" "${dbfile}" || error "Could not change group of ${dbfile} to $group" + chgrp "$group" "${filesfile}" || error "Could not change group of ${filesfile} to $group" + chmod g+w "${dbfile}" || error "Could not set write permission for group $group to ${dbfile}" chmod g+w "${filesfile}" || error "Could not set write permission for group $group to ${filesfile}" else error "You don't have permission to change ${dbfile}" diff --git a/db-move b/db-move index f1c3dea..53543bc 100755 --- a/db-move +++ b/db-move @@ -14,14 +14,14 @@ repo_to="${args[1]}" ftppath_from="${FTP_BASE}/${repo_from}/os/" ftppath_to="${FTP_BASE}/${repo_to}/os/" -if ! check_repo_permission $repo_to || ! check_repo_permission $repo_from; then +if ! check_repo_permission "$repo_to" || ! check_repo_permission "$repo_from"; then die "You don't have permission to move packages from ${repo_from} to ${repo_to}" fi # TODO: this might lock too much (architectures) for pkgarch in "${ARCHES[@]}"; do - repo_lock ${repo_to} ${pkgarch} || exit 1 - repo_lock ${repo_from} ${pkgarch} || exit 1 + repo_lock "${repo_to}" "${pkgarch}" || exit 1 + repo_lock "${repo_from}" "${pkgarch}" || exit 1 done # First loop is to check that all necessary files exist @@ -29,12 +29,12 @@ for pkgbase in "${args[@]:2}"; do for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${SVNREPO}/${repo_from}/${pkgbase}" if [ -r "${svnrepo_from}/PKGBUILD" ]; then - pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) + pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) if [ ${#pkgnames[@]} -lt 1 ]; then die "Could not read pkgname" fi - pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel})) + pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}") if [ -z "${pkgver}" ]; then die "Could not read pkgver" fi @@ -47,7 +47,7 @@ for pkgbase in "${args[@]:2}"; do for pkgname in "${pkgnames[@]}"; do for tarch in "${tarches[@]}"; do - getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT} >/dev/null + getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} >/dev/null done done continue 2 @@ -71,22 +71,22 @@ for pkgbase in "${args[@]:2}"; do tarches=("${pkgarch}") fi msg2 "${pkgbase} (${tarches[*]})" - pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo ${pkgname[@]})) - pkgver=$(. "${svnrepo_from}/PKGBUILD"; echo $(get_full_version ${epoch:-0} ${pkgver} ${pkgrel})) + pkgnames=($(. "${svnrepo_from}/PKGBUILD"; echo "${pkgname[@]}")) + pkgver=$(. "${svnrepo_from}/PKGBUILD"; get_full_version "${epoch:-0}" "${pkgver}" "${pkgrel}") for pkgname in "${pkgnames[@]}"; do for tarch in "${tarches[@]}"; do - pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/"${pkgname}-${pkgver}-${pkgarch}${PKGEXT}) + pkgpath=$(getpkgfile "${ftppath_from}/${tarch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}) pkgfile="${pkgpath##*/}" # copy package to pool if needed # TODO: can be removed once every package has been moved to the package pool - if [ ! -f ${FTP_BASE}/${PKGPOOL}/${pkgfile} ]; then - cp ${pkgpath} ${FTP_BASE}/${PKGPOOL} + if [ ! -f "${FTP_BASE}/${PKGPOOL}/${pkgfile}" ]; then + cp "${pkgpath}" "${FTP_BASE}/${PKGPOOL}" fi - ln -s "../../../${PKGPOOL}/${pkgfile}" ${ftppath_to}/${tarch}/ - if [ -f ${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig ]; then - ln -s "../../../${PKGPOOL}/${pkgfile}.sig" ${ftppath_to}/${tarch}/ + ln -s "../../../${PKGPOOL}/${pkgfile}" "${ftppath_to}/${tarch}/" + if [ -f "${FTP_BASE}/${PKGPOOL}/${pkgfile}.sig" ]; then + ln -s "../../../${PKGPOOL}/${pkgfile}.sig" "${ftppath_to}/${tarch}/" fi add_pkgs[${tarch}]+="${FTP_BASE}/${PKGPOOL}/${pkgfile} " remove_pkgs[${tarch}]+="${pkgname} " @@ -104,6 +104,6 @@ for tarch in "${ARCHES[@]}"; do done for pkgarch in "${ARCHES[@]}"; do - repo_unlock ${repo_from} ${pkgarch} - repo_unlock ${repo_to} ${pkgarch} + repo_unlock "${repo_from}" "${pkgarch}" + repo_unlock "${repo_to}" "${pkgarch}" done diff --git a/db-remove b/db-remove index 46585ad..b0ed9bd 100755 --- a/db-remove +++ b/db-remove @@ -12,7 +12,7 @@ repo="$1" arch="$2" pkgbases=("${@:3}") -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from ${repo}" fi @@ -23,7 +23,7 @@ else fi for tarch in "${tarches[@]}"; do - repo_lock $repo $tarch || exit 1 + repo_lock "$repo" "$tarch" || exit 1 done remove_pkgs=() @@ -31,7 +31,7 @@ for pkgbase in "${pkgbases[@]}"; do msg "Removing $pkgbase from [$repo]..." if [ -d "${SVNREPO}/$repo/$pkgbase" ]; then - remove_pkgs=($(. "${SVNREPO}/$repo/$pkgbase/PKGBUILD"; echo ${pkgname[@]})) + remove_pkgs=($(. "${SVNREPO}/$repo/$pkgbase/PKGBUILD"; echo "${pkgname[@]}")) else warning "$pkgbase not found in ABS(libre)" warning "Removing only $pkgbase from the repo" @@ -42,5 +42,5 @@ done for tarch in "${tarches[@]}"; do arch_repo_remove "${repo}" "${tarch}" "${remove_pkgs[@]}" - repo_unlock $repo $tarch + repo_unlock "$repo" "$tarch" done diff --git a/db-repo-add b/db-repo-add index a6355a1..92be22e 100755 --- a/db-repo-add +++ b/db-repo-add @@ -10,32 +10,32 @@ fi repo="$1" arch="$2" -pkgfiles=(${@:3}) +pkgfiles=("${@:3}") ftppath="$FTP_BASE/$repo/os" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to add packages to ${repo}" fi if [ "$arch" == "any" ]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done -for tarch in ${tarches[@]}; do - for pkgfile in ${pkgfiles[@]}; do +for tarch in "${tarches[@]}"; do + for pkgfile in "${pkgfiles[@]}"; do if [[ ! -f "${FTP_BASE}/${repo}/os/${arch}/${pkgfile##*/}" ]]; then die "Package file ${pkgfile##*/} not found in ${FTP_BASE}/${repo}/os/${arch}/" else msg "Adding $pkgfile to [$repo]..." fi done - arch_repo_add "${repo}" "${tarch}" ${pkgfiles[@]} - repo_unlock $repo $tarch + arch_repo_add "${repo}" "${tarch}" "${pkgfiles[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-repo-remove b/db-repo-remove index 7077d62..487abd8 100755 --- a/db-repo-remove +++ b/db-repo-remove @@ -10,28 +10,28 @@ fi repo="$1" arch="$2" -pkgnames=(${@:3}) +pkgnames=("${@:3}") ftppath="$FTP_BASE/$repo/os" -if ! check_repo_permission $repo; then +if ! check_repo_permission "$repo"; then die "You don't have permission to remove packages from ${repo}" fi if [ "$arch" == "any" ]; then - tarches=(${ARCHES[@]}) + tarches=("${ARCHES[@]}") else tarches=("$arch") fi -for tarch in ${tarches[@]}; do - repo_lock $repo $tarch || exit 1 +for tarch in "${tarches[@]}"; do + repo_lock "$repo" "$tarch" || exit 1 done -for tarch in ${tarches[@]}; do - for pkgname in ${pkgnames[@]}; do +for tarch in "${tarches[@]}"; do + for pkgname in "${pkgnames[@]}"; do msg "Removing $pkgname from [$repo]..." done - arch_repo_remove "${repo}" "${tarch}" ${pkgnames[@]} - repo_unlock $repo $tarch + arch_repo_remove "${repo}" "${tarch}" "${pkgnames[@]}" + repo_unlock "$repo" "$tarch" done diff --git a/db-sync b/db-sync index 138328b..9b90219 100755 --- a/db-sync +++ b/db-sync @@ -16,7 +16,8 @@ # Run as `V=true db-sync` to get verbose output VERBOSE=${V} -${VERBOSE} && extra="-v" +extra=() +${VERBOSE} && extra+=(-v) WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX") trap "rm -rf -- $(printf '%q' "${WORKDIR}")" EXIT @@ -24,19 +25,19 @@ trap "rm -rf -- $(printf '%q' "${WORKDIR}")" EXIT # Returns contents of a repo get_repos() { # Exclude everything but db files - rsync ${extra} --no-motd -mrtlH --no-p --include="*/" \ + rsync "${extra[@]}" --no-motd -mrtlH --no-p --include="*/" \ --include="*.db" \ --include="*${DBEXT}" \ --include="*.files" \ --include="*${FILESEXT}" \ --exclude="*" \ --delete-after \ - rsync://${mirror}/${mirrorpath}/ "$WORKDIR" + "rsync://${mirror}/${mirrorpath}/" "$WORKDIR" } get_repo_content() { # Return all contents - bsdtar tf ${1} | \ + bsdtar tf "${1}" | \ cut -d "/" -f 1 | \ sort -u } @@ -68,12 +69,12 @@ init() { get_repos # Traverse all repo-arch pairs - for _repo in ${ARCHREPOS[@]}; do - for _arch in ${ARCHARCHES[@]}; do + for _repo in "${ARCHREPOS[@]}"; do + for _arch in "${ARCHARCHES[@]}"; do msg "Processing ${_repo}-${_arch}" - db_file=$(get_repo_file ${_repo} ${_arch})${DBEXT} - files_file=$(get_repo_file ${_repo} ${_arch})${FILESEXT} + db_file=$(get_repo_file "${_repo}" "${_arch}")${DBEXT} + files_file=$(get_repo_file "${_repo}" "${_arch}")${FILESEXT} if [ ! -f "${db_file}" ]; then warning "%s doesn't exist, skipping this repo-arch" "${db_file}" @@ -93,7 +94,7 @@ init() { LC_ALL=C repo-remove "${files_file}" "${blacklist[@]}" \ |& sed -n 's/-> Removing/ &/p' # Get db contents - db=($(get_repo_content ${db_file})) + db=($(get_repo_content "${db_file}")) msg2 "Process clean db for syncing..." @@ -103,30 +104,30 @@ init() { # IMPORTANT: the . in the sed command is needed because an empty # whitelist would consist of a single * allowing any package to # pass through - printf '%s\n' "${db[@]}" | sed "s|.$|&*|g" > /tmp/${_repo}-${_arch}.whitelist + printf '%s\n' "${db[@]}" | sed "s|.$|&*|g" > "/tmp/${_repo}-${_arch}.whitelist" msg2 "$(wc -l /tmp/${_repo}-${_arch}.whitelist | cut -d' ' -f1) packages in whitelist" # Sync excluding everything but whitelist # We delete here for cleanup - rsync ${extra} --no-motd -rtlH \ + rsync "${extra[@]}" --no-motd -rtlH \ --delete-after \ --delete-excluded \ --delay-updates \ - --include-from=/tmp/${_repo}-${_arch}.whitelist \ + --include-from="/tmp/${_repo}-${_arch}.whitelist" \ --exclude="*" \ - rsync://${mirror}/${mirrorpath}/${_repo}/os/${_arch}/ \ - ${FTP_BASE}/${_repo}/os/${_arch}/ + "rsync://${mirror}/${mirrorpath}/${_repo}/os/${_arch}/" \ + "${FTP_BASE}/${_repo}/os/${_arch}/" # Add a new whitelist whitelists+=(/tmp/${_repo}-${_arch}.whitelist) msg "Putting databases back in place" - rsync ${extra} --no-motd -rtlH \ + rsync "${extra[@]}" --no-motd -rtlH \ --delay-updates \ --safe-links \ - ${WORKDIR}/${_repo}/os/${_arch}/ \ - ${FTP_BASE}/${_repo}/os/${_arch}/ + "${WORKDIR}/${_repo}/os/${_arch}/" \ + "${FTP_BASE}/${_repo}/os/${_arch}/" # Cleanup unset db @@ -136,7 +137,7 @@ init() { msg "Syncing package pool" # Concatenate all whitelists, check for single *s just in case - cat ${whitelists[@]} | grep -v "^\*$" | sort -u > /tmp/any.whitelist + cat "${whitelists[@]}" | grep -v "^\*$" | sort -u > /tmp/any.whitelist msg2 "Retrieving $(wc -l /tmp/any.whitelist | cut -d' ' -f1) packages from pool" @@ -144,14 +145,14 @@ init() { # *Don't delete-after*, this is the job of cleanup scripts. It will remove our # packages too local pkgpool - for pkgpool in ${ARCHPKGPOOLS[@]}; do - rsync ${extra} --no-motd -rtlH \ + for pkgpool in "${ARCHPKGPOOLS[@]}"; do + rsync "${extra[@]}" --no-motd -rtlH \ --delay-updates \ --safe-links \ --include-from=/tmp/any.whitelist \ --exclude="*" \ - rsync://${mirror}/${mirrorpath}/${pkgpool}/ \ - ${FTP_BASE}/${pkgpool}/ + "rsync://${mirror}/${mirrorpath}/${pkgpool}/" \ + "${FTP_BASE}/${pkgpool}/" done # Sync sources @@ -163,14 +164,14 @@ init() { # *Don't delete-after*, this is the job of cleanup scripts. It will remove our # packages too local srcpool - for srcpool in ${ARCHSRCPOOLS[@]}; do - rsync ${extra} --no-motd -rtlH \ + for srcpool in "${ARCHSRCPOOLS[@]}"; do + rsync "${extra[@]}" --no-motd -rtlH \ --delay-updates \ --safe-links \ --include-from=/tmp/any.whitelist \ --exclude="*" \ - rsync://${mirror}/${mirrorpath}/${srcpool}/ \ - ${FTP_BASE}/${srcpool}/ + "rsync://${mirror}/${mirrorpath}/${srcpool}/" \ + "${FTP_BASE}/${srcpool}/" done # Cleanup @@ -191,14 +192,13 @@ source "$(dirname "$(readlink -e "$0")")/libremessages" # Check variables presence for var in DBEXT FILESEXT mirror mirrorpath WORKDIR BLACKLIST_FILE FTP_BASE ARCHSRCPOOLS ARCHPKGPOOLS; do - test -z "${!var}" && fatal_error "Empty ${var}" done # From makepkg set -E for signal in TERM HUP QUIT; do - trap "trap_exit $signal '%s signal caught. Exiting...' $signal" $signal + trap "trap_exit $signal '%s signal caught. Exiting...' $signal" "$signal" done trap 'trap_exit INT "Aborted by user! Exiting..."' INT trap 'trap_exit USR1 "An unknown error has occurred. Exiting..."' ERR diff --git a/db-update b/db-update index 186ed55..18162db 100755 --- a/db-update +++ b/db-update @@ -19,7 +19,7 @@ fi # TODO: this might lock too much (architectures) for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_lock ${repo} ${pkgarch} || exit 1 + repo_lock "${repo}" "${pkgarch}" || exit 1 done done @@ -55,7 +55,7 @@ for repo in "${repos[@]}"; do any_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-any${PKGEXT} 2>/dev/null)) for pkgarch in "${ARCHES[@]}"; do add_pkgs=() - arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-${pkgarch}${PKGEXT} 2>/dev/null)) + arch_pkgs=($(getpkgfiles "${STAGING}/${repo}/"*-"${pkgarch}"${PKGEXT} 2>/dev/null)) for pkg in "${arch_pkgs[@]}" "${any_pkgs[@]}"; do pkgfile="${pkg##*/}" msg2 "${pkgfile} (${pkgarch})" @@ -81,7 +81,7 @@ done for repo in "${repos[@]}"; do for pkgarch in "${ARCHES[@]}"; do - repo_unlock ${repo} ${pkgarch} + repo_unlock "${repo}" "${pkgarch}" done done diff --git a/testing2x b/testing2x index b6828fc..37c4395 100755 --- a/testing2x +++ b/testing2x @@ -11,28 +11,28 @@ fi # Lock everything to reduce possibility of interfering task between the different repo-updates script_lock for repo in 'core' 'extra' 'testing'; do - for pkgarch in ${ARCHES[@]}; do - repo_lock ${repo} ${pkgarch} || exit 1 + for pkgarch in "${ARCHES[@]}"; do + repo_lock "${repo}" "${pkgarch}" || exit 1 done done declare -A pkgs -for pkgbase in $*; do +for pkgbase in "$@"; do if [ ! -d "${WORKDIR}/${pkgbase}" ]; then /usr/bin/svn export -q "${SVNREPO}/${pkgbase}/repos" "${WORKDIR}/${pkgbase}" >/dev/null found_source=false - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do svnrepo_from="${WORKDIR}/${pkgbase}/testing-${pkgarch}" if [ -r "${svnrepo_from}/PKGBUILD" ]; then found_source=true break fi done - ${found_source} || die "${pkgbase} not found in [testing]" + "${found_source}" || die "${pkgbase} not found in [testing]" found_target=false - for pkgarch in ${ARCHES[@]} 'any'; do + for pkgarch in "${ARCHES[@]}" 'any'; do for repo in 'core' 'extra'; do svnrepo_to="${WORKDIR}/${pkgbase}/${repo}-${pkgarch}" if [ -r "${svnrepo_to}/PKGBUILD" ]; then @@ -42,16 +42,16 @@ for pkgbase in $*; do fi done done - ${found_target} || die "${pkgbase} neither found in [core] nor [extra]" + "${found_target}" || die "${pkgbase} neither found in [core] nor [extra]" fi done -for pkgarch in ${ARCHES[@]}; do - repo_unlock 'testing' ${pkgarch} +for pkgarch in "${ARCHES[@]}"; do + repo_unlock 'testing' "${pkgarch}" done for repo in 'core' 'extra'; do - for pkgarch in ${ARCHES[@]}; do - repo_unlock ${repo} ${pkgarch} + for pkgarch in "${ARCHES[@]}"; do + repo_unlock "${repo}" "${pkgarch}" done if [ -n "${pkgs[${repo}]}" ]; then "$(dirname "$(readlink -e "$0")")/db-move" 'testing' "${repo}" ${pkgs[${repo}]} -- cgit v1.1-4-g5e80