Skip to content

Commit

Permalink
Consistently use "$(dirname "$(readlink -e "$0")")"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LukeShu authored and eli-schwartz committed Apr 8, 2018
1 parent 5b4b19c commit 0cf2ac4
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cron-jobs/ftpdir-cleanup
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion cron-jobs/integrity-check
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

dirname="$(dirname "$0")"
dirname="$(dirname "$(readlink -e "$0")")"

. "${dirname}/../config"
. "${dirname}/../db-functions"
Expand Down
4 changes: 2 additions & 2 deletions cron-jobs/update-web-db
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions db-move
Original file line number Diff line number Diff line change
@@ -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##*/}"
Expand Down
4 changes: 2 additions & 2 deletions db-remove
Original file line number Diff line number Diff line change
@@ -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##*/}"
Expand Down
4 changes: 2 additions & 2 deletions db-repo-add
Original file line number Diff line number Diff line change
@@ -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##*/}"
Expand Down
4 changes: 2 additions & 2 deletions db-repo-remove
Original file line number Diff line number Diff line change
@@ -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##*/}"
Expand Down
4 changes: 2 additions & 2 deletions db-update
Original file line number Diff line number Diff line change
@@ -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##*/}"
Expand Down
6 changes: 3 additions & 3 deletions testing2x
Original file line number Diff line number Diff line change
@@ -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##*/}"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 0cf2ac4

Please sign in to comment.