diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2014-06-17 23:47:21 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2018-04-08 16:18:40 -0400 |
commit | 0cf2ac49c18a71c050f5a9a9ff42e8dff89c2375 (patch) | |
tree | ade1b3ba2b922ac834af75e093ab722b05f9b190 | |
parent | 5b4b19cd7f4c0ef7a479306b73a4db3733df9c44 (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-x | cron-jobs/ftpdir-cleanup | 4 | ||||
-rwxr-xr-x | cron-jobs/integrity-check | 2 | ||||
-rwxr-xr-x | cron-jobs/update-web-db | 4 | ||||
-rwxr-xr-x | db-move | 4 | ||||
-rwxr-xr-x | db-remove | 4 | ||||
-rwxr-xr-x | db-repo-add | 4 | ||||
-rwxr-xr-x | db-repo-remove | 4 | ||||
-rwxr-xr-x | db-update | 4 | ||||
-rwxr-xr-x | testing2x | 6 |
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" @@ -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##*/}" @@ -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##*/}" @@ -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##*/}" @@ -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 |