forked from evolix/evobackup
evobackupctl: simplify the program path retrieval
This commit is contained in:
parent
ebad3bb8d9
commit
be6ebdf415
|
@ -15,6 +15,8 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* evobackupctl: simplify the program path retrieval
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
readonly PROGNAME=$(basename "${0}")
|
readonly PROGPATH=$(readlink -m "${0}")
|
||||||
# shellcheck disable=SC2155
|
readonly PROGNAME=$(basename "${PROGPATH}")
|
||||||
readonly PROGDIR=$(readlink -m "$(dirname "${0}")")
|
|
||||||
# shellcheck disable=SC2124
|
# shellcheck disable=SC2124
|
||||||
readonly ARGS=$@
|
readonly ARGS=$@
|
||||||
|
|
||||||
|
@ -78,7 +77,8 @@ copy_template() {
|
||||||
if cp "${LIBDIR}/zzz_evobackup.sh" "${dest_path}"; then
|
if cp "${LIBDIR}/zzz_evobackup.sh" "${dest_path}"; then
|
||||||
chmod 750 "${dest_path}"
|
chmod 750 "${dest_path}"
|
||||||
|
|
||||||
sed -i "s|@COMMAND@|${PROGDIR}/${PROGNAME} ${ARGS}|" "${dest_path}"
|
# Insert metadata about the template
|
||||||
|
sed -i "s|@COMMAND@|${PROGPATH} ${ARGS}|" "${dest_path}"
|
||||||
sed -i "s|@DATE@|$(date --iso-8601=seconds)|" "${dest_path}"
|
sed -i "s|@DATE@|$(date --iso-8601=seconds)|" "${dest_path}"
|
||||||
sed -i "s|@VERSION@|${VERSION}|" "${dest_path}"
|
sed -i "s|@VERSION@|${VERSION}|" "${dest_path}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue