summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-17 23:47:21 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-04-17 14:46:10 -0400
commite4e5a028843316edf73cae4ac70d9df3cf8e1565 (patch)
treeb51b782a9ecc247fb00c4164a43dd1b5019918ae
parenta2891a08c0cde48d966b037503c24b0d8f5b5f6d (diff)
Consistently use "$(dirname "$(readlink -e "$0")")"
This does correct handling of - executing a program by symlink - any weird characters in the full path - I'm sure there's another case I thought about when I originally did this.
-rwxr-xr-xcron-jobs/ftpdir-cleanup4
-rwxr-xr-xcron-jobs/integrity-check2
-rwxr-xr-xcron-jobs/update-web-db4
-rwxr-xr-xdb-move4
-rwxr-xr-xdb-remove4
-rwxr-xr-xdb-repo-add4
-rwxr-xr-xdb-repo-remove4
-rwxr-xr-xdb-update4
-rwxr-xr-xtest/test.d/create-filelists.sh2
-rwxr-xr-xtest/test.d/db-move.sh2
-rwxr-xr-xtest/test.d/db-remove.sh2
-rwxr-xr-xtest/test.d/db-repo-add.sh2
-rwxr-xr-xtest/test.d/db-repo-remove.sh2
-rwxr-xr-xtest/test.d/db-update.sh2
-rwxr-xr-xtest/test.d/ftpdir-cleanup.sh2
-rwxr-xr-xtest/test.d/packages.sh2
-rwxr-xr-xtest/test.d/signed-packages.sh2
-rwxr-xr-xtest/test.d/sourceballs.sh2
-rwxr-xr-xtest/test.d/testing2x.sh2
-rwxr-xr-xtesting2x6
20 files changed, 29 insertions, 29 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index f6487cf..4063c09 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/../config"
-. "$(dirname "$0")/../db-functions"
+. "$(dirname "$(readlink -e "$0")")/../config"
+. "$(dirname "$(readlink -e "$0")")/../db-functions"
clean_pkg() {
local pkg
diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check
index 677c0d3..7459380 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/update-web-db b/cron-jobs/update-web-db
index 88bf464..c8bf74a 100755
--- a/cron-jobs/update-web-db
+++ b/cron-jobs/update-web-db
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/../config"
-. "$(dirname "$0")/../db-functions"
+. "$(dirname "$(readlink -e "$0")")/../config"
+. "$(dirname "$(readlink -e "$0")")/../db-functions"
# setup paths
SPATH="/srv/http/archweb"
diff --git a/db-move b/db-move
index b589bca..a55dd50 100755
--- a/db-move
+++ b/db-move
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/config"
-. "$(dirname "$0")/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: %s <repo-from> <repo-to> <pkgname|pkgbase> ..." "${0##*/}"
diff --git a/db-remove b/db-remove
index ca56ecc..7e7fcb8 100755
--- a/db-remove
+++ b/db-remove
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/config"
-. "$(dirname "$0")/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: %s <repo> <arch> <pkgname|pkgbase> ..." "${0##*/}"
diff --git a/db-repo-add b/db-repo-add
index 09ce865..4611bdf 100755
--- a/db-repo-add
+++ b/db-repo-add
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/config"
-. "$(dirname "$0")/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: %s <repo> <arch> <pkgfile> ..." "${0##*/}"
diff --git a/db-repo-remove b/db-repo-remove
index 97a671b..aadc4ce 100755
--- a/db-repo-remove
+++ b/db-repo-remove
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/config"
-. "$(dirname "$0")/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 3 ]; then
msg "usage: %s <repo> <arch> <pkgname> ..." "${0##*/}"
diff --git a/db-update b/db-update
index 9fa9c1b..358c534 100755
--- a/db-update
+++ b/db-update
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/config"
-. "$(dirname "$0")/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -ge 1 ]; then
warning "Calling %s with a specific repository is no longer supported" "${0##*/}"
diff --git a/test/test.d/create-filelists.sh b/test/test.d/create-filelists.sh
index be66fc2..20dafc6 100755
--- a/test/test.d/create-filelists.sh
+++ b/test/test.d/create-filelists.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testCreateSimpleFileLists() {
diff --git a/test/test.d/db-move.sh b/test/test.d/db-move.sh
index 410e222..4b4120e 100755
--- a/test/test.d/db-move.sh
+++ b/test/test.d/db-move.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testMoveSimplePackages() {
diff --git a/test/test.d/db-remove.sh b/test/test.d/db-remove.sh
index 4fd5548..a391197 100755
--- a/test/test.d/db-remove.sh
+++ b/test/test.d/db-remove.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testRemovePackages() {
diff --git a/test/test.d/db-repo-add.sh b/test/test.d/db-repo-add.sh
index 776c0a2..266a696 100755
--- a/test/test.d/db-repo-add.sh
+++ b/test/test.d/db-repo-add.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testAddSimplePackages() {
diff --git a/test/test.d/db-repo-remove.sh b/test/test.d/db-repo-remove.sh
index fd69fa7..727188d 100755
--- a/test/test.d/db-repo-remove.sh
+++ b/test/test.d/db-repo-remove.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testRemovePackages() {
diff --git a/test/test.d/db-update.sh b/test/test.d/db-update.sh
index 9e44970..540eccf 100755
--- a/test/test.d/db-update.sh
+++ b/test/test.d/db-update.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testAddSimplePackages() {
diff --git a/test/test.d/ftpdir-cleanup.sh b/test/test.d/ftpdir-cleanup.sh
index 6902b9b..5a7afea 100755
--- a/test/test.d/ftpdir-cleanup.sh
+++ b/test/test.d/ftpdir-cleanup.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testCleanupSimplePackages() {
diff --git a/test/test.d/packages.sh b/test/test.d/packages.sh
index 1a31a41..18266eb 100755
--- a/test/test.d/packages.sh
+++ b/test/test.d/packages.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testPackages() {
diff --git a/test/test.d/signed-packages.sh b/test/test.d/signed-packages.sh
index 4eccb41..3ffe146 100755
--- a/test/test.d/signed-packages.sh
+++ b/test/test.d/signed-packages.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testAddSignedPackage() {
diff --git a/test/test.d/sourceballs.sh b/test/test.d/sourceballs.sh
index 561169e..81c9265 100755
--- a/test/test.d/sourceballs.sh
+++ b/test/test.d/sourceballs.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testSourceballs() {
diff --git a/test/test.d/testing2x.sh b/test/test.d/testing2x.sh
index 3bbd353..c611ce4 100755
--- a/test/test.d/testing2x.sh
+++ b/test/test.d/testing2x.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-curdir=$(readlink -e "$(dirname "$0")")
+curdir="$(dirname "$(readlink -e "$0")")"
. "${curdir}/../lib/common.inc"
testTesting2xAnyPackage() {
diff --git a/testing2x b/testing2x
index e269248..901c1b0 100755
--- a/testing2x
+++ b/testing2x
@@ -1,7 +1,7 @@
#!/bin/bash
-. "$(dirname "$0")/config"
-. "$(dirname "$0")/db-functions"
+. "$(dirname "$(readlink -e "$0")")/config"
+. "$(dirname "$(readlink -e "$0")")/db-functions"
if [ $# -lt 1 ]; then
msg "usage: %s <pkgname|pkgbase> ..." "${0##*/}"
@@ -54,7 +54,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