evobackupctl: simplify the program path retrieval

This commit is contained in:
Jérémy Lecour 2024-05-02 10:17:22 +02:00 committed by Jérémy Lecour
parent ebad3bb8d9
commit be6ebdf415
Signed by: jlecour
SSH key fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY
2 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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}"