Unverified Commit 5b4b19cd authored by Luke Shumaker's avatar Luke Shumaker Committed by Eli Schwartz
Browse files

Fixup quoting around variables, especially arrays

Search for unquoted variables using the command:

    grep -Prn --exclude-dir=.git '(?<!["=]|\[\[ |\[\[ -[zn] )\$(?!{?#|\(|\? )'

and ignore a bunch of false positives.

You may verify that the only differences between the lines removed and
lines added are double-quotes:

        diff -u \
          <(git show|sed -n 's/^-//p'|grep -v '^-- a/'|sed 's/"//g') \
          <(git show|sed -n 's/^+//p'|grep -v '^++ b/'|sed 's/"//g')
parent a852b282
......@@ -36,5 +36,5 @@ PKGEXTS=".pkg.tar.@(gz|bz2|xz|lzo|lrz|Z)"
ALLOWED_LICENSES=('GPL' 'GPL1' 'GPL2' 'GPL3' 'LGPL' 'LGPL1' 'LGPL2' 'LGPL2.1' 'LGPL3')
# Override default config with config.local
LOCAL_CONFIG=${DBSCRIPTS_CONFIG:-"$(dirname ${BASH_SOURCE[0]})/config.local"}
LOCAL_CONFIG=${DBSCRIPTS_CONFIG:-"$(dirname "${BASH_SOURCE[0]}")/config.local"}
[[ -f "${LOCAL_CONFIG}" ]] && . "${LOCAL_CONFIG}"
......@@ -6,7 +6,7 @@
exit() { return; }
splitpkg_overrides=('depends' 'optdepends' 'provides' 'conflicts')
variables=('pkgname' 'pkgbase' 'epoch' 'pkgver' 'pkgrel' 'makedepends' 'arch' ${splitpkg_overrides[@]})
variables=('pkgname' 'pkgbase' 'epoch' 'pkgver' 'pkgrel' 'makedepends' 'arch' "${splitpkg_overrides[@]}")
readonly -a variables splitpkg_overrides
backup_package_variables() {
......@@ -30,31 +30,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
for i in "${depends[@]}"; do
echo "$i"
done
echo ""
fi
if [ -n "$makedepends" ]; then
echo "%MAKEDEPENDS%"
for i in ${makedepends[@]}; do
echo $i
for i in "${makedepends[@]}"; do
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
}
......@@ -64,10 +64,10 @@ source_pkgbuild() {
ret=0
dir=$1
pkgbuild=$dir/PKGBUILD
for var in ${variables[@]}; do
unset ${var}
for var in "${variables[@]}"; do
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
......@@ -77,8 +77,8 @@ source_pkgbuild() {
if [ "${#pkgname[@]}" -gt "1" ]; then
pkgbase=${pkgbase:-${pkgname[0]}}
for pkg in ${pkgname[@]}; do
if [ "$(type -t package_${pkg})" != "function" ]; then
for pkg in "${pkgname[@]}"; do
if [ "$(type -t "package_${pkg}")" != "function" ]; then
echo -e "%INVALID%\n$pkgbuild\n"
return 1
else
......@@ -87,13 +87,13 @@ source_pkgbuild() {
while IFS= read -r line; do
var=${line%%=*}
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
for realvar in ${variables[@]}; do
for realvar in "${variables[@]}"; do
if [ "$var" == "$realvar" ]; then
eval $line
break
fi
done
done < <(type package_${pkg})
done < <(type "package_${pkg}")
print_info
eval "$restore_package_variables"
fi
......@@ -113,14 +113,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
......@@ -136,7 +136,7 @@ fi
CARCH=$1
shift
for dir in "$@"; do
find_pkgbuilds $dir
find_pkgbuilds "$dir"
done
exit 0
......@@ -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
#!/bin/bash
. "$(dirname $0)/../config"
. "$(dirname $0)/../db-functions"
. "$(dirname "$0")/../config"
. "$(dirname "$0")/../db-functions"
clean_pkg() {
local pkg
......@@ -24,16 +24,16 @@ clean_pkg() {
script_lock
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
repo_lock ${repo} ${arch} || exit 1
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${arch}" || exit 1
done
done
[[ $CLEANUP_DRYRUN = true ]] && warning 'dry run mode is active'
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
if [[ ! -f ${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT} ]]; then
continue
fi
......@@ -49,7 +49,7 @@ for repo in ${PKGREPOS[@]}; do
missing_pkgs=($(comm -13 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}"))
if (( ${#missing_pkgs[@]} >= 1 )); then
error "Missing packages in [%s] (%s)..." "$repo" "$arch"
for missing_pkg in ${missing_pkgs[@]}; do
for missing_pkg in "${missing_pkgs[@]}"; do
msg2 '%s' "${missing_pkg}"
done
fi
......@@ -57,7 +57,7 @@ for repo in ${PKGREPOS[@]}; do
old_pkgs=($(comm -23 "${WORKDIR}/repo-${repo}-${arch}" "${WORKDIR}/db-${repo}-${arch}"))
if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old packages from [%s] (%s)..." "$repo" "$arch"
for old_pkg in ${old_pkgs[@]}; do
for old_pkg in "${old_pkgs[@]}"; do
msg2 '%s' "${old_pkg}"
clean_pkg "${FTP_BASE}/${repo}/os/${arch}/${old_pkg}"
done
......@@ -75,7 +75,7 @@ cat "${WORKDIR}"/db-* 2>/dev/null | sort -u > "${WORKDIR}/db"
old_pkgs=($(comm -23 "${WORKDIR}/pool" "${WORKDIR}/db"))
if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old packages from package pool..."
for old_pkg in ${old_pkgs[@]}; do
for old_pkg in "${old_pkgs[@]}"; do
msg2 '%s' "${old_pkg}"
clean_pkg "$FTP_BASE/${PKGPOOL}/${old_pkg}"
done
......@@ -90,7 +90,7 @@ for f in "${CLEANUP_DESTDIR}"/**/*${PKGEXTS}; do
done
if (( ${#old_pkgs[@]} >= 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 '%s' "${old_pkg}"
if [[ $CLEANUP_DRYRUN != true ]]; then
rm -f "${CLEANUP_DESTDIR}/${old_pkg}"
......@@ -99,9 +99,9 @@ if (( ${#old_pkgs[@]} >= 1 )); then
done
fi
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
repo_unlock ${repo} ${arch}
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_unlock "${repo}" "${arch}"
done
done
......
#!/bin/bash
dirname="$(dirname $0)"
dirname="$(dirname "$0")"
. "${dirname}/../config"
. "${dirname}/../db-functions"
......@@ -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,multilib'
......
#!/bin/bash
dirname="$(dirname $(readlink -e $0))"
dirname="$(dirname "$(readlink -e "$0")")"
. "${dirname}/../config"
. "${dirname}/../db-functions"
pushd "${WORKDIR}" >/dev/null
script_lock
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
repo_lock ${repo} ${arch} || exit 1
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${arch}" || exit 1
done
done
......@@ -18,8 +18,8 @@ renice +10 -p $$ > /dev/null
# Create a readable file for each repo with the following format
# <pkgbase|pkgname> <pkgver>-<pkgrel> <arch> <license>[ <license>]
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
# Repo does not exist; skip it
if [[ ! -f ${FTP_BASE}/${repo}/os/${arch}/${repo}${DBEXT} ]]; then
continue
......@@ -39,9 +39,9 @@ for repo in ${PKGREPOS[@]}; do
done | sort -u > "${WORKDIR}/db-${repo}"
done
for repo in ${PKGREPOS[@]}; do
for arch in ${ARCHES[@]}; do
repo_unlock ${repo} ${arch}
for repo in "${PKGREPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_unlock "${repo}" "${arch}"
done
done
......@@ -53,7 +53,7 @@ for f in "${FTP_BASE}"/${SRCPOOL}/*${SRCEXT}; do
done | sort -u > "${WORKDIR}/available-src-pkgs"
# Check for all packages if we need to build a source package
for repo in ${PKGREPOS[@]}; do
for repo in "${PKGREPOS[@]}"; do
newpkgs=()
failedpkgs=()
while read -r pkgbase pkgver pkgarch pkglicense; do
......@@ -73,7 +73,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
......@@ -104,13 +104,13 @@ for repo in ${PKGREPOS[@]}; do
if [ ${#newpkgs[@]} -ge 1 ]; then
msg "Adding source packages for [%s]..." "$repo"
for new_pkg in ${newpkgs[@]}; do
for new_pkg in "${newpkgs[@]}"; do
msg2 '%s' "${new_pkg}"
done
fi
if [ ${#failedpkgs[@]} -ge 1 ]; then
msg "Failed to create source packages for [%s]..." "$repo"
for failed_pkg in ${failedpkgs[@]}; do
for failed_pkg in "${failedpkgs[@]}"; do
msg2 '%s' "${failed_pkg}"
done
fi
......@@ -124,7 +124,7 @@ old_pkgs=($(comm -23 "${WORKDIR}/available-src-pkgs.sort" "${WORKDIR}/expected-s
if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old source packages..."
[[ $SOURCE_CLEANUP_DRYRUN = true ]] && warning 'dry run mode is active'
for old_pkg in ${old_pkgs[@]}; do
for old_pkg in "${old_pkgs[@]}"; do
msg2 '%s' "${old_pkg}"
if [[ $SOURCE_CLEANUP_DRYRUN != true ]]; then
mv_acl "$FTP_BASE/${SRCPOOL}/${old_pkg}" "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
......@@ -143,7 +143,7 @@ done
if (( ${#old_pkgs[@]} >= 1 )); then
msg "Removing old source packages from the cleanup directory..."
for old_pkg in ${old_pkgs[@]}; do
for old_pkg in "${old_pkgs[@]}"; do
msg2 '%s' "${old_pkg}"
[[ $SOURCE_CLEANUP_DRYRUN = true ]] || rm -f "${SOURCE_CLEANUP_DESTDIR}/${old_pkg}"
done
......
#!/bin/bash
. "$(dirname $0)/../config"
. "$(dirname $0)/../db-functions"
. "$(dirname "$0")/../config"
. "$(dirname "$0")/../db-functions"
# setup paths
SPATH="/srv/http/archweb"
......@@ -43,26 +43,26 @@ case "$cmd" in
esac
# Lock the repos and get a copy of the db files to work on
for repo in ${REPOS[@]}; do
for arch in ${ARCHES[@]}; do
repo_lock ${repo} ${arch} || exit 1
for repo in "${REPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
repo_lock "${repo}" "${arch}" || exit 1
dbfile="/srv/ftp/${repo}/os/${arch}/${repo}${dbfileext}"
if [[ -f ${dbfile} ]]; then
mkdir -p "${WORKDIR}/${repo}/${arch}"
cp "${dbfile}" "${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
fi
repo_unlock ${repo} ${arch}
repo_unlock "${repo}" "${arch}"
done
done
# Run reporead on our db copy
pushd $SPATH >/dev/null
for repo in ${REPOS[@]}; do
for arch in ${ARCHES[@]}; do
pushd "$SPATH" >/dev/null
for repo in "${REPOS[@]}"; do
for arch in "${ARCHES[@]}"; do
dbcopy="${WORKDIR}/${repo}/${arch}/${repo}${dbfileext}"
if [[ -f ${dbcopy} ]]; then
echo "Updating ${repo}-${arch}" >> "${LOGOUT}"
./manage.py reporead ${flags} ${arch} "${dbcopy}" >> "${LOGOUT}" 2>&1
./manage.py reporead "${flags}" "${arch}" "${dbcopy}" >> "${LOGOUT}" 2>&1
echo "" >> "${LOGOUT}"
fi
done
......
......@@ -17,7 +17,7 @@ set_umask () {
}
restore_umask () {
umask $UMASK >/dev/null
umask "$UMASK" >/dev/null
}
# Proxy function to check if a file exists. Using [[ -f ... ]] directly is not
......@@ -50,7 +50,7 @@ REPO_MODIFIED=0
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 %s is already locked by %s." "${0##*/}" "$_owner"
exit 1
else
......@@ -78,12 +78,12 @@ cleanup() {
local arch
trap - EXIT INT QUIT TERM
for l in ${LOCKS[@]}; do
for l in "${LOCKS[@]}"; do
repo=${l%.*}
arch=${l#*.}
if [[ -d $TMPDIR/.repolock.$repo.$arch ]]; then
msg "Removing left over lock from [%s] (%s)" "$repo" "$arch"
repo_unlock $repo $arch
repo_unlock "$repo" "$arch"
fi
done
if [[ -d $TMPDIR/.scriptlock.${0##*/} ]]; then
......@@ -96,7 +96,7 @@ cleanup() {
date +%s > "${FTP_BASE}/lastupdate"
fi
[[ -n $1 ]] && exit $1
[[ -n $1 ]] && exit "$1"
}
abort() {
......@@ -125,7 +125,7 @@ repo_lock () {
# This is the lock file used by repo-add and repo-remove
if [[ -f ${DBLOCKFILE} ]]; then
error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(cat $DBLOCKFILE)"
error "Repo [%s] (%s) is already locked by repo-{add,remove} process %s" "$1" "$2" "$(cat "$DBLOCKFILE")"
return 1
fi
......@@ -141,7 +141,7 @@ repo_lock () {
_count=0
while (( _count <= _trial )) || [[ $_lockblock = true ]]; 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 [%s] (%s) is already locked by %s." "$1" "$2" "$_owner"
msg2 "Retrying in %s seconds..." "$LOCK_DELAY"
else
......@@ -149,7 +149,7 @@ repo_lock () {
set_umask
return 0
fi
sleep $LOCK_DELAY
sleep "$LOCK_DELAY"
let _count=$_count+1
done
......@@ -277,7 +277,7 @@ getpkgfile() {
exit 1
fi
echo ${1}
echo "${1}"
}
getpkgfiles() {
......@@ -291,30 +291,30 @@ getpkgfiles() {
files+=("$(getpkgfile "$f")") || exit 1
done
echo ${files[@]}
echo "${files[@]}"
}
check_pkgfile() {
local pkgfile=$1
local pkgname="$(getpkgname ${pkgfile})" || return 1
local pkgver="$(getpkgver ${pkgfile})" || return 1
local pkgarch="$(getpkgarch ${pkgfile})" || return 1
local pkgname="$(getpkgname "${pkgfile}")" || return 1
local pkgver="$(getpkgver "${pkgfile}")" || return 1
local pkgarch="$(getpkgarch "${pkgfile}")" || return 1
in_array "${pkgarch}" ${ARCHES[@]} 'any' || return 1
in_array "${pkgarch}" "${ARCHES[@]}" 'any' || return 1
[[ ${pkgfile##*/} = ${pkgname}-${pkgver}-${pkgarch}* ]]
[[ ${pkgfile##*/} = "${pkgname}-${pkgver}-${pkgarch}"* ]]
}
check_pkgsvn() {
local pkgfile="${1}"
local _pkgbase="$(getpkgbase ${pkgfile})" || return 1
local _pkgname="$(getpkgname ${pkgfile})" || return 1
local _pkgver="$(getpkgver ${pkgfile})" || return 1
local _pkgarch="$(getpkgarch ${pkgfile})" || return 1
local _pkgbase="$(getpkgbase "${pkgfile}")" || return 1
local _pkgname="$(getpkgname "${pkgfile}")" || return 1
local _pkgver="$(getpkgver "${pkgfile}")" || return 1
local _pkgarch="$(getpkgarch "${pkgfile}")" || return 1
local repo="${2}"
in_array "${repo}" ${PKGREPOS[@]} || return 1
in_array "${repo}" "${PKGREPOS[@]}" || return 1
if [[ ! -f ${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase} ]]; then
mkdir -p "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}"
......@@ -325,8 +325,8 @@ check_pkgsvn() {
local svnver="$(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; get_full_version)"
[[ "${svnver}" = "${_pkgver}" ]] || return 1
local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
in_array "${_pkgname}" ${svnnames[@]} || return 1
local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}"))
in_array "${_pkgname}" "${svnnames[@]}" || return 1
return 0
}
......@@ -334,7 +334,7 @@ check_pkgsvn() {
check_splitpkgs() {
local repo="${1}"
shift
local pkgfiles=(${@})
local pkgfiles=("${@}")
local pkgfile
local pkgdir
local svnname
......@@ -342,11 +342,11 @@ check_splitpkgs() {
mkdir -p "${WORKDIR}/check_splitpkgs/"
pushd "${WORKDIR}/check_splitpkgs" >/dev/null
for pkgfile in ${pkgfiles[@]}; do
for pkgfile in "${pkgfiles[@]}"; do
issplitpkg "${pkgfile}" || continue
local _pkgbase="$(getpkgbase ${pkgfile})"
local _pkgname="$(getpkgname ${pkgfile})"
local _pkgarch="$(getpkgarch ${pkgfile})"
local _pkgbase="$(getpkgbase "${pkgfile}")"
local _pkgname="$(getpkgname "${pkgfile}")"
local _pkgarch="$(getpkgarch "${pkgfile}")"
mkdir -p "${repo}/${_pkgarch}/${_pkgbase}"
echo "${_pkgname}" >> "${repo}/${_pkgarch}/${_pkgbase}/staging"
......@@ -356,7 +356,7 @@ check_splitpkgs() {
"${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}" >/dev/null || return 1
fi
local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo ${pkgname[@]}))
local svnnames=($(. "${WORKDIR}/pkgbuilds/${repo}-${_pkgarch}/${_pkgbase}"; echo "${pkgname[@]}"))
printf '%s\n' "${svnnames[@]}" >> "${repo}/${_pkgarch}/${_pkgbase}/svn"
done
popd >/dev/null
......@@ -376,9 +376,9 @@ check_splitpkgs() {
check_pkgrepos() {
local pkgfile=$1
local pkgname="$(getpkgname ${pkgfile})" || return 1
local pkgver="$(getpkgver ${pkgfile})" || return 1
local pkgarch="$(getpkgarch ${pkgfile})" || return 1
local pkgname="$(getpkgname "${pkgfile}")" || return 1
local pkgver="$(getpkgver "${pkgfile}")" || return 1
local pkgarch="$(getpkgarch "${pkgfile}")" || return 1
is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS} && return 1
is_globfile "${FTP_BASE}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXTS}.sig && return 1
......@@ -392,7 +392,7 @@ check_pkgrepos() {
chk_license() {
local l
for l in "${@}"; do
in_array ${l} ${ALLOWED_LICENSES[@]} && return 0
in_array "${l}" "${ALLOWED_LICENSES[@]}" && return 0
done
return 1
......@@ -404,12 +404,12 @@ check_repo_permission() {
(( ${#PKGREPOS[@]} == 0 )) && return 1
[[ -z "${PKGPOOL}" ]] && return 1
in_array "${repo}" ${PKGREPOS[@]} || return 1
in_array "${repo}" "${PKGREPOS[@]}" || return 1
[[ -w $FTP_BASE/${PKGPOOL} ]] || return 1
local arch
for arch in ${ARCHES[@]}; do
for arch in "${ARCHES[@]}"; do
local dir="${FTP_BASE}/${repo}/os/${arch}/"
[[ -w ${dir} ]] || return 1
[[ -f ${dir}${repo}${DBEXT} && ! -w ${dir}${repo}${DBEXT} ]] && return 1
......@@ -450,7 +450,7 @@ arch_repo_modify() {
# package files for repo-add might be relative to repo dir
pushd "${dbfile%/*}" >/dev/null
/usr/bin/repo-${action} -q "${dbfile}" "${pkgs[@]}" \
/usr/bin/"repo-${action}" -q "${dbfile}" "${pkgs[@]}" \
|| error '%s' "repo-${action} ${dbfile@Q} ${pkgs[*]@Q}"
set_repo_permission "${repo}" "${arch}"
popd >/dev/null
......
#!/bin/bash
. "$(dirname $0)/config"
. "$(dirname $0)/db-functions"
. "$(dirname "$0")/config"
. "$(dirname "$0")/db-functions"
if (( $# < 3 )); then
msg "usage: %s <repo-from> <repo-to> <pkgname|pkgbase> ..." "${0##*/}"
exit 1
fi
args=(${@})
args=("${@}")
repo_from="${args[0]}"
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 %s to %s" "$repo_from" "$repo_to"
fi
# TODO: this might lock too much (architectures)