diff options
-rwxr-xr-x | .local/bin/signal | 66 |
1 files changed, 25 insertions, 41 deletions
diff --git a/.local/bin/signal b/.local/bin/signal index 452b556..bf8d198 100755 --- a/.local/bin/signal +++ b/.local/bin/signal @@ -1,53 +1,37 @@ -#! /usr/bin/env sh +#!/bin/sh + +# This program is free software: you can redistribute it and/or modify it under +# the terms of the GNU Affero General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. + +readonly BINS=" + /usr/bin/signal-desktop +" main() { - # Handle opts - opts "$@" - shift "$OPTS" - unset OPTS - - # Show help - [ "$OPT_HELP_ONLY" ] && usage && exit 0 - - export TMPDIR=${XDG_CACHE_HOME:-$HOME/.local/tmp} + for bin in $BINS + do + [ -x "$bin" ] || continue - mkdir -p -- "/run/user/$UID/doc/by-app/org.signal.Signal" + export TMPDIR="${XDG_CACHE_HOME:-$HOME/.local/tmp}" + mkdir -p -- "/run/user/$UID/doc/by-app/org.signal.Signal" - exec signal-desktop -} + exec "$bin" "$@" + done -opts() -{ - OPTS=0 + printf "No underlying executable found for %s:\n" "${0##*/}" >&2 - while getopts ":h" opt + for bin in $BINS do - case "$opt" in - h) OPT_HELP_ONLY=1 ;; - *) - printf "Invalid option passed: %s\n" "$OPTARG" >&2 - ;; - esac + printf "\t%s\n" "$bin" >&2 done - - unset opt -} - -usage() -{ - cat <<EOF -Usage: - $(basename "$0") -h - -Wrapper for signal[-desktop]. This starts the Signal desktop client, but -applying some fixes here and there to make it actually start. Daily reminder -that Electron is a cancer on our society, and people using it should be -receiving electro-shock therapy. - -Options: - -h Show this help text and exit. -EOF } main "$@" |