summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2014-06-17 23:47:21 -0400
committerEli Schwartz <eschwartz@archlinux.org>2018-04-08 16:18:40 -0400
commit0cf2ac49c18a71c050f5a9a9ff42e8dff89c2375 (patch)
treeade1b3ba2b922ac834af75e093ab722b05f9b190
parent5b4b19cd7f4c0ef7a479306b73a4db3733df9c44 (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-xtesting2x6
9 files changed, 18 insertions, 18 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index e742536..9df5f99 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 17153c7..904dfc1 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 87e8bb0..39ed765 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 1fa2055..63e5c14 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 (( $# < 3 )); then
msg "usage: %s <repo-from> <repo-to> <pkgname|pkgbase> ..." "${0##*/}"
diff --git a/db-remove b/db-remove
index e42a977..ac9a168 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 (( $# < 3 )); then
msg "usage: %s <repo> <arch> <pkgname|pkgbase> ..." "${0##*/}"
diff --git a/db-repo-add b/db-repo-add
index 1cc63af..6109d84 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 (( $# < 3 )); then
msg "usage: %s <repo> <arch> <pkgfile> ..." "${0##*/}"
diff --git a/db-repo-remove b/db-repo-remove
index 40c1ac8..8d2c6c7 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 (( $# < 3 )); then
msg "usage: %s <repo> <arch> <pkgname> ..." "${0##*/}"
diff --git a/db-update b/db-update
index 536f7fd..8eb27df 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 (( $# >= 1 )); then
warning "Calling %s with a specific repository is no longer supported" "${0##*/}"
diff --git a/testing2x b/testing2x
index c2bd6d4..d3b096b 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 (( $# < 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