install script
parent
9e5c0efee6
commit
549a0d767c
@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
usage $0: [-c]
|
||||
|
||||
Options:
|
||||
-c, --clean removes the service and binary
|
||||
EOF
|
||||
}
|
||||
|
||||
service="$HOME/.config/systemd/user/timesheet.service"
|
||||
bin="$HOME/.local/bin/timetracker"
|
||||
|
||||
if [ -n "$1" ] ; then
|
||||
# arguement given
|
||||
if [[ $1 =~ ^-(c|-clean)$ ]] ; then
|
||||
# clean
|
||||
[ -f "$service" ] && systemctl --user disable "timesheet.service" && rm -f "$service"
|
||||
[ -f "$bin" ] && rm -vf "$bin"
|
||||
exit 0
|
||||
else
|
||||
echo "option $1 not recognized" >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
install -vm 755 "timetracker.sh" "$bin"
|
||||
cp "timesheet.service" "$service"
|
||||
systemctl --user enable "timesheet.service"
|
||||
|
||||
echo "Timetracker installed successfully"
|
Loading…
Reference in New Issue