Skip to content

Commit

Permalink
scripts: Fix SCRIPT_TOP
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Levand <geoff@infradead.org>
  • Loading branch information
glevand committed Oct 1, 2021
1 parent 25903ea commit 9d75429
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 66 deletions.
6 changes: 2 additions & 4 deletions scripts/check-vfat-names.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/flac-add-tracktotal.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/flac-clean-tags.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/flac-meta-rename.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/flac-print-tags.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/flac-tag-switcher.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/flac-write-tag.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
17 changes: 11 additions & 6 deletions scripts/m4a-converter.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down Expand Up @@ -264,6 +262,15 @@ if [[ ${extra_args} ]]; then
exit 1
fi

if [[ ! ${arg_1} ]]; then
set +o xtrace
echo "${script_name}: ERROR: No input source provided." >&2
usage
exit 1
fi

arg_1="$(realpath -e "${arg_1}")"

fdkaac="${fdkaac:-fdkaac}"
check_program "fdkaac" "${fdkaac}"

Expand All @@ -276,8 +283,6 @@ check_program "parallel" "${parallel}"
sox="${sox:-sox}"
check_program "sox" "${sox}"

arg_1="$(realpath -e "${arg_1}")"

case "${input_type}" in
flac_file)
if [[ ${verbose} ]]; then echo "INFO: Using flac_file '${arg_1}'." >&2; fi
Expand Down
6 changes: 2 additions & 4 deletions scripts/make-age-list.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/make-inventory.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/make-playlists.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/make-shufflelist.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/play-m4a.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/rip-c-flac-tags.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/rip-c-to-flac.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down
6 changes: 2 additions & 4 deletions scripts/rip-c.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ script_name="${0##*/}"
SECONDS=0
start_time="$(date +%Y.%m.%d-%H.%M.%S)"

if [[ ! -d "${SCRIPT_TOP:-}" ]]; then
SCRIPT_TOP="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="${SCRIPT_TOP%/*}"
fi
real_source="$(realpath "${BASH_SOURCE}")"
SCRIPT_TOP="$(realpath "${SCRIPT_TOP:-${real_source%/*}}")"

trap "on_exit 'Failed'" EXIT
trap 'on_err ${FUNCNAME[0]:-main} ${LINENO} ${?}' ERR
Expand Down

0 comments on commit 9d75429

Please sign in to comment.