install script
This commit is contained in:
parent
9e5c0efee6
commit
549a0d767c
35
install
Executable file
35
install
Executable file
@ -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"
|
@ -4,8 +4,8 @@ Description=Timesheet manager
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
ExecStart=/home/keegan/bin/timetracker -i
|
ExecStart=/home/keegan/.local/bin/timetracker -i
|
||||||
ExecStop=/home/keegan/bin/timetracker -o
|
ExecStop=/home/keegan/.local/bin/timetracker -o
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Time sheet creator
|
# Time sheet creator
|
||||||
# Stores clock in and outs to timesheet named for the ending date of the ts
|
# Stores clock in and outs to timesheet named for the ending date of the ts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user