diff options
Diffstat (limited to 'resteasy/libexec/resteasy-helper.sh')
-rw-r--r-- | resteasy/libexec/resteasy-helper.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/resteasy/libexec/resteasy-helper.sh b/resteasy/libexec/resteasy-helper.sh new file mode 100644 index 0000000..6547626 --- /dev/null +++ b/resteasy/libexec/resteasy-helper.sh @@ -0,0 +1,45 @@ +# shellcheck shell=bash +# shellcheck disable=SC2034 + +# This shell-scriptlet provides utility functions to other resteasy scripts. +# It is meant to be sourced, and should never be executed directly. + +# override $0 to the command's pretty name +BASH_ARGV0=$(basename "$0" | sed 's/-/ /') + +RESTEASY_TYPE_UUID=8e8e0bae-5627-4acd-8fd9-70873806d42e +RESTEASY_MOUNT_POINT=/run/resteasy/mount + +die() { + printf >&2 '%s\n' "$*" + exit 1 +} + +usage() { + echo "usage: $0 $USAGE" + exit 1 +} + +die_with_usage() { + printf >&2 '%s\n' "$*" + echo "usage: $0 $USAGE" >&2 + exit 1 +} + + +log_status() { + echo "status: $1" >&2 + # Send status to a dbus channel, useful for integration with desktop + # notifications. + # Note the "|| true" prevents this function from failing in case dbus is not + # available. + dbus-send --system --type=signal \ + /io/crashbox/resteasy/Main \ + "io.crashbox.resteasy.Info.Status" \ + "string:$1" || true +} + +if [[ ${1:-} == '-h' ]] || [[ ${1:-} == '--help' ]]; then + echo "usage: $0 $USAGE" + exit 0 +fi |