From 6a093f1dc6bd5398115544dd229b520f9432e122 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 Dec 2013 15:49:06 -0500 Subject: use `readlink -e` on $0 --- any-to-ours | 6 +++--- create-repo | 6 +++--- createrepos | 4 ++-- cron-jobs/integrity-check | 2 +- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs2 | 2 +- cron-jobs/update-abs-tarballs | 2 +- db-check-nonfree | 4 ++-- db-cleanup | 6 +++--- db-list-unsigned-packages | 6 +++--- db-sync | 6 +++--- get-repos | 6 +++--- migrate-repo | 2 +- mkrepo | 4 ++-- repo-restore-to-normal | 4 ++-- testing2x | 2 +- yf-update | 12 ++++++------ 17 files changed, 39 insertions(+), 39 deletions(-) diff --git a/any-to-ours b/any-to-ours index a1d6686..31fea5f 100755 --- a/any-to-ours +++ b/any-to-ours @@ -7,9 +7,9 @@ trap_exit() { exit 1 } -source $(dirname $0)/config -source $(dirname $0)/local_config -source $(dirname $0)/libremessages +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/local_config" +source "$(dirname "$(readlink -e "$0")")/libremessages" # From makepkg set -E diff --git a/create-repo b/create-repo index 58842c3..f77fa24 100755 --- a/create-repo +++ b/create-repo @@ -1,8 +1,8 @@ #!/bin/bash # Creates repository structure -. "$(dirname $0)/db-functions" -. "$(dirname $0)/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" if [ $# -eq 0 ]; then msg "Usage: $0 repo1 [repo2 ... repoX]" @@ -21,4 +21,4 @@ for _repo in $@; do done done -msg "Don't forget to add them to the PKGREPOS array on $(dirname $0)/config" +msg "Don't forget to add them to the PKGREPOS array on %s/config" "$(dirname "$(readlink -e "$0")")" diff --git a/createrepos b/createrepos index eec26e0..cd17e4e 100755 --- a/createrepos +++ b/createrepos @@ -1,8 +1,8 @@ #!/bin/bash # Creates the repo structure defined in config -source $(dirname $0)/config +source "$(dirname "$(readlink -e "$0")")/config" mkdir -p -- "${FTP_BASE}"/{"${PKGPOOL}","${SRCPOOL}"} "${CLEANUP_DESTDIR}" "${SOURCE_CLEANUP_DESTDIR} ${STAGING}" -$(dirname $0)/create-repo "${PKGREPOS[@]}" +"$(dirname "$(readlink -e "$0")")/create-repo" "${PKGREPOS[@]}" diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index f6c26cf..86a8f1d 100755 --- a/cron-jobs/integrity-check +++ b/cron-jobs/integrity-check @@ -1,6 +1,6 @@ #!/bin/bash -dirname="$(dirname $0)" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../config" . "${dirname}/../db-functions" diff --git a/cron-jobs/repo-sanity-check b/cron-jobs/repo-sanity-check index 1ba90a6..2aa7892 100755 --- a/cron-jobs/repo-sanity-check +++ b/cron-jobs/repo-sanity-check @@ -1,8 +1,8 @@ #!/bin/bash # Solves issue165 -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" # Traverse all repos for _repo in ${PKGREPOS[@]}; do diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 5b14d07..bbe227d 100755 --- a/cron-jobs/sourceballs2 +++ b/cron-jobs/sourceballs2 @@ -4,7 +4,7 @@ # Makepkg --allsource every package # Remove the old sourceballs -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../db-functions" . "${dirname}/../config" . "${MAKEPKGCONF}" diff --git a/cron-jobs/update-abs-tarballs b/cron-jobs/update-abs-tarballs index 824ac34..901cc4b 100755 --- a/cron-jobs/update-abs-tarballs +++ b/cron-jobs/update-abs-tarballs @@ -1,6 +1,6 @@ #!/bin/bash -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../config" rsync -av --exclude=staging/ parabolagnulinux.org::abstar/ ${FTP_BASE}/ diff --git a/db-check-nonfree b/db-check-nonfree index ecad3b9..ba5f5aa 100755 --- a/db-check-nonfree +++ b/db-check-nonfree @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/db-functions" -. "$(dirname $0)/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" if [ $# -ge 1 ]; then warning "Calling $(basename $0) with a specific repository is not supported" diff --git a/db-cleanup b/db-cleanup index 904c06e..c6e4f1c 100755 --- a/db-cleanup +++ b/db-cleanup @@ -15,9 +15,9 @@ trap_exit() { exit 1 } -source $(dirname $0)/config -source $(dirname $0)/local_config -source $(dirname $0)/libremessages +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/local_config" +source "$(dirname "$(readlink -e "$0")")/libremessages" # From makepkg set -E diff --git a/db-list-unsigned-packages b/db-list-unsigned-packages index 3b5a5bd..4e90d42 100755 --- a/db-list-unsigned-packages +++ b/db-list-unsigned-packages @@ -20,8 +20,8 @@ set -e # unsigned packages available for architecture $1 and specified for # architecture $2 (usually $1 or any, default is to list all). -. "$(dirname $0)/db-functions" -. "$(dirname $0)/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" if [ $# -lt 1 ]; then msg "usage: $(basename $0) " @@ -34,5 +34,5 @@ shift for repo in ${PKGREPOS[@]} do db="${FTP_BASE}/${repo}/os/${arch}/${repo}.db" - [ -f "$db" ] && "$(dirname $0)/db-list-unsigned-packages.py" "$repo" "$@" < "$db" + [ -f "$db" ] && "$(dirname "$(readlink -e "$0")")/db-list-unsigned-packages.py" "$repo" "$@" < "$db" done diff --git a/db-sync b/db-sync index 0acfbc1..e4b6966 100755 --- a/db-sync +++ b/db-sync @@ -178,9 +178,9 @@ trap_exit() { } -source $(dirname $0)/config -source $(dirname $0)/local_config -source $(dirname $0)/libremessages +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/local_config" +source "$(dirname "$(readlink -e "$0")")/libremessages" # From makepkg set -E diff --git a/get-repos b/get-repos index bfc08ff..40d7205 100755 --- a/get-repos +++ b/get-repos @@ -9,9 +9,9 @@ trap_exit() { exit 1 } -source $(dirname $0)/config -source $(dirname $0)/local_config -source $(dirname $0)/libremessages +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/local_config" +source "$(dirname "$(readlink -e "$0")")/libremessages" # From makepkg set -E diff --git a/migrate-repo b/migrate-repo index 2e44adb..751d5bd 100755 --- a/migrate-repo +++ b/migrate-repo @@ -1,6 +1,6 @@ #!/bin/bash -source $(dirname $0)/config +source "$(dirname "$(readlink -e "$0")")/config" #dryrun="--dry-run" diff --git a/mkrepo b/mkrepo index 5f704cc..10d014b 100755 --- a/mkrepo +++ b/mkrepo @@ -3,8 +3,8 @@ # License: GPLv3+ # Description: A script to quickly create new [repos] -source $(dirname $0)/config -source $(dirname $0)/local_config +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/local_config" # TODO it would be simpler to expand arrays to {element1,element2,etc} for repo in $@; do diff --git a/repo-restore-to-normal b/repo-restore-to-normal index 9463731..3636920 100755 --- a/repo-restore-to-normal +++ b/repo-restore-to-normal @@ -1,8 +1,8 @@ #!/bin/bash # Solves issue165 -. "$(dirname $0)/db-functions" -. "$(dirname $0)/config" +. "$(dirname "$(readlink -e "$0")")/db-functions" +. "$(dirname "$(readlink -e "$0")")/config" CLEANUP_DESTDIR=/home/parabolavnx/repo/pool/restore PKGREPOS=(community) diff --git a/testing2x b/testing2x index 14610c2..6646179 100755 --- a/testing2x +++ b/testing2x @@ -52,7 +52,7 @@ for repo in ${STABLE_REPOS[@]}; do repo_unlock ${repo} ${pkgarch} done if [ -n "${pkgs[${repo}]}" ]; then - "$(dirname $0)/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]} + "$(dirname "$(readlink -e "$0")")/db-move" ${TESTING_REPO} "${repo}" ${pkgs[${repo}]} fi done diff --git a/yf-update b/yf-update index 9c2131e..ee5d3eb 100755 --- a/yf-update +++ b/yf-update @@ -1,17 +1,17 @@ #!/bin/bash -source $(dirname $0)/local_config -source $(dirname $0)/config -source $(dirname $0)/libremessages +source "$(dirname "$(readlink -e "$0")")/local_config" +source "$(dirname "$(readlink -e "$0")")/config" +source "$(dirname "$(readlink -e "$0")")/libremessages" blacklist_mtime=$(printf "%.0f" $(find ${blacklist} -printf "%T@")) -last_bl_mtime=$(cat $(dirname $0)/yftime) +last_bl_mtime=$(< "$(dirname "$(readlink -e "$0")")/yftime") if [ $blacklist_mtime -gt $last_bl_mtime ]; then - pushd $(dirname $0)/yf + pushd "$(dirname "$(readlink -e "$0")")/yf" makepkg -f find . -name "*${PKGEXT}" -exec mv {} ${STAGING}/libre \; popd - echo ${blacklist_mtime} > $(dirname $0)/yftime + echo ${blacklist_mtime} > "$(dirname "$(readlink -e "$0")")/yftime" msg2 "built and staged" else msg2 "nothing to do" -- cgit v1.2.3-2-g168b