From 99493a15bde1b1c0d2d8f2ccc985da32570aacec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?coadde=20=5BM=C3=A1rcio=20Alexandre=20Silva=20Delgado=5D?= Date: Wed, 23 Sep 2015 19:29:53 -0300 Subject: rename generic variables --- db-functions | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'db-functions') diff --git a/db-functions b/db-functions index b993cd1..52676c7 100644 --- a/db-functions +++ b/db-functions @@ -95,7 +95,7 @@ get_full_version() { } script_lock() { - local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" + local LOCKDIR="$temporary_directory/.scriptlock.${0##*/}" if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then local _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" error "Script %s is already locked by %s." "${0##*/}" "$_owner" @@ -107,7 +107,7 @@ script_lock() { } script_unlock() { - local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}" + local LOCKDIR="$temporary_directory/.scriptlock.${0##*/}" if [ ! -d "$LOCKDIR" ]; then warning "Script %s was not locked!" "${0##*/}" restore_umask @@ -128,12 +128,12 @@ cleanup() { for l in "${LOCKS[@]}"; do repo=${l%.*} arch=${l#*.} - if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then + if [ -d "$temporary_directory/.repolock.$repo.$arch" ]; then msg "Removing left over lock from [%s] (%s)" "${repo}" "${arch}" repo_unlock "$repo" "$arch" fi done - if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then + if [ -d "$temporary_directory/.scriptlock.${0##*/}" ]; then msg "Removing left over lock from %s" "${0##*/}" script_unlock fi @@ -163,9 +163,9 @@ trap cleanup EXIT #repo_lock [timeout] repo_lock () { - local LOCKDIR="$TMPDIR/.repolock.$1.$2" - local DBLOCKFILE="${root_dir}/${1}/os/${2}/${1}${DBEXT}.lck" - local FILESLOCKFILE="${root_dir}/${1}/os/${2}/${1}${FILESEXT}.lck" + local LOCKDIR="$temporary_directory/.repolock.$1.$2" + local DBLOCKFILE="${root_dir}/${1}/os/${2}/${1}${database_extension_suffixfile}.lck" + local FILESLOCKFILE="${root_dir}/${1}/os/${2}/${1}${files_extension_suffixfile}.lck" local _count local _trial local _timeout @@ -188,7 +188,7 @@ repo_lock () { elif [ $# -eq 3 ]; then _lockblock=false _timeout=$3 - let _trial=$_timeout/$LOCK_DELAY + let _trial=$_timeout/$lock_delay fi _count=0 @@ -196,13 +196,13 @@ repo_lock () { if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then _owner="$(/usr/bin/stat -c %U "$LOCKDIR")" warning "Repo [%s] (%s) is already locked by %s." "${1}" "${2}" "$_owner" - msg2 "Retrying in %d seconds..." "$LOCK_DELAY" + msg2 "Retrying in %d seconds..." "$lock_delay" else LOCKS+=("$1.$2") set_umask return 0 fi - sleep "$LOCK_DELAY" + sleep "$lock_delay" let _count=$_count+1 done @@ -211,7 +211,7 @@ repo_lock () { } repo_unlock () { #repo_unlock - local LOCKDIR="$TMPDIR/.repolock.$1.$2" + local LOCKDIR="$temporary_directory/.repolock.$1.$2" if [ ! -d "$LOCKDIR" ]; then warning "Repo lock [%s] (%s) was not locked!" "${1}" "${2}" restore_umask @@ -300,7 +300,7 @@ getpkgfile() { elif [ ! -f "${1}" ]; then error "Package %s not found!" "${1}" exit 1 - elif "${REQUIRE_SIGNATURE}" && [ ! -f "${1}.sig" ]; then + elif "${require_signature}" && [ ! -f "${1}.sig" ]; then error "Package signature %s not found!" "${1}.sig" exit 1 fi @@ -319,7 +319,7 @@ getpkgfiles() { if [ ! -f "${f}" ]; then error "Package %s not found!" "${f}" exit 1 - elif "${REQUIRE_SIGNATURE}" && [ ! -f "${f}.sig" ]; then + elif "${require_signature}" && [ ! -f "${f}.sig" ]; then error "Package signature %s not found!" "${f}.sig" exit 1 fi @@ -417,8 +417,8 @@ check_pkgrepos() { local pkgarch="$(getpkgarch "${pkgfile}")" [ $? -ge 1 ] && return 1 - [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1 - [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1 + [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile} ] && return 1 + [ -f "${root_dir}/${PKGPOOL}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile}.sig ] && return 1 [ -f "${root_dir}/${PKGPOOL}/${pkgfile##*/}" ] && return 1 [ -f "${root_dir}/${PKGPOOL}/${pkgfile##*/}.sig" ] && return 1 @@ -426,8 +426,8 @@ check_pkgrepos() { local arch for repo in "${PKGREPOS[@]}"; do for arch in "${ARCHES[@]}"; do - [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT} ] && return 1 - [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${PKGEXT}.sig ] && return 1 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile} ] && return 1 + [ -f "${root_dir}/${repo}/os/${arch}/${pkgname}-${pkgver}-${pkgarch}"${package_extension_suffixfile}.sig ] && return 1 [ -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}" ] && return 1 [ -f "${root_dir}/${repo}/os/${arch}/${pkgfile##*/}.sig" ] && return 1 done @@ -460,8 +460,8 @@ check_repo_permission() { for arch in "${ARCHES[@]}"; do local dir="${root_dir}/${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}"${database_extension_suffixfile} -a ! -w "${dir}${repo}"${database_extension_suffixfile} ] && return 1 + [ -f "${dir}${repo}"${files_extension_suffixfile} -a ! -w "${dir}${repo}"${files_extension_suffixfile} ] && return 1 done return 0 @@ -470,8 +470,8 @@ check_repo_permission() { set_repo_permission() { local repo=$1 local arch=$2 - local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" - local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${FILESEXT}" + local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" + local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${files_extension_suffixfile}" if [ -w "${dbfile}" ]; then local group=$(/usr/bin/stat --printf='%G' "$(dirname "${dbfile}")") @@ -492,10 +492,10 @@ arch_repo_add() { printf -v pkgs_str -- '%q ' "${pkgs[@]}" # package files might be relative to repo dir pushd "${root_dir}/${repo}/os/${arch}" >/dev/null - /usr/bin/repo-add -q "${repo}${DBEXT}" "${pkgs[@]}" >/dev/null \ - || error 'repo-add %q %s' "${repo}${DBEXT}" "${pkgs_str% }" - /usr/bin/repo-add -f -q "${repo}${FILESEXT}" "${pkgs[@]}" \ - || error 'repo-add -f %q %s' "${repo}${FILESEXT}" "${pkgs_str% }" + /usr/bin/repo-add -q "${repo}${database_extension_suffixfile}" "${pkgs[@]}" >/dev/null \ + || error 'repo-add %q %s' "${repo}${database_extension_suffixfile}" "${pkgs_str% }" + /usr/bin/repo-add -f -q "${repo}${files_extension_suffixfile}" "${pkgs[@]}" \ + || error 'repo-add -f %q %s' "${repo}${files_extension_suffixfile}" "${pkgs_str% }" popd >/dev/null set_repo_permission "${repo}" "${arch}" @@ -506,8 +506,8 @@ arch_repo_remove() { local repo=$1 local arch=$2 local pkgs=("${@:3}") - local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${DBEXT}" - local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${FILESEXT}" + local dbfile="${root_dir}/${repo}/os/${arch}/${repo}${database_extension_suffixfile}" + local filesfile="${root_dir}/${repo}/os/${arch}/${repo}${files_extension_suffixfile}" if [ ! -f "${dbfile}" ]; then error "No database found at '%s'" "${dbfile}" -- cgit v1.2.3-2-g168b