From b6e8ebd66d22abf5439485985a7851e768c71e8a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 8 Jan 2014 21:04:43 -0500 Subject: Be very careful about using $0. --- cron-jobs/ftpdir-cleanup | 4 ++-- cron-jobs/integrity-check | 4 ++-- cron-jobs/repo-sanity-check | 4 ++-- cron-jobs/sourceballs | 2 +- cron-jobs/sourceballs2 | 2 +- cron-jobs/update-abs-tarballs | 2 +- cron-jobs/update-web-db | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) (limited to 'cron-jobs') diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup index 83e6e17..8d691b5 100755 --- a/cron-jobs/ftpdir-cleanup +++ b/cron-jobs/ftpdir-cleanup @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" clean_pkg() { local pkg diff --git a/cron-jobs/integrity-check b/cron-jobs/integrity-check index d4f9694..05a56a5 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}/../db-functions" . "${dirname}/../config" @@ -8,7 +8,7 @@ dirname="$(dirname $0)" script_lock if [ $# -ne 1 ]; then - die "usage: $(basename $0) " + die "usage: ${0##*/} " fi mailto=$1 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/sourceballs b/cron-jobs/sourceballs index ee074bd..73d8432 100755 --- a/cron-jobs/sourceballs +++ b/cron-jobs/sourceballs @@ -1,6 +1,6 @@ #!/bin/bash -dirname="$(dirname $(readlink -e $0))" +dirname="$(dirname "$(readlink -e "$0")")" . "${dirname}/../db-functions" . "${dirname}/../config" pushd "${WORKDIR}" >/dev/null diff --git a/cron-jobs/sourceballs2 b/cron-jobs/sourceballs2 index 5644268..eb46579 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/cron-jobs/update-web-db b/cron-jobs/update-web-db index 6ced4c1..825eea6 100755 --- a/cron-jobs/update-web-db +++ b/cron-jobs/update-web-db @@ -1,7 +1,7 @@ #!/bin/bash -. "$(dirname $0)/../db-functions" -. "$(dirname $0)/../config" +. "$(dirname "$(readlink -e "$0")")/../db-functions" +. "$(dirname "$(readlink -e "$0")")/../config" # setup paths SPATH="/srv/http/archweb" @@ -14,7 +14,7 @@ REPOS=('community-testing' 'multilib-testing' 'multilib' 'community' 'extra' 'te LOGOUT="/tmp/archweb_update.log" # figure out what operation to perform -cmd="$(basename $0)" +cmd="${0##*/}" if [[ $cmd != "update-web-db" && $cmd != "update-web-files-db" ]]; then die "Invalid command name '$cmd' specified!" fi -- cgit v1.2.3-2-g168b