summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-08-18 08:46:55 +0200
committerErich Eckner <git@eckner.net>2023-08-18 08:46:55 +0200
commit6c0f3bb67ac4fd1fb71b35834f14e72e1b74c7b0 (patch)
tree470fe3816ba6e63ce8e20529b2fea6474b56dd6b
parentfd29c532d1e757cb0db24ac09910423dee274ada (diff)
downloadcomputer-time-limit-6c0f3bb67ac4fd1fb71b35834f14e72e1b74c7b0.tar.xz
auto-update
-rwxr-xr-xcomputer-time-limit10
1 files changed, 10 insertions, 0 deletions
diff --git a/computer-time-limit b/computer-time-limit
index 87ee9d1..6fb89c9 100755
--- a/computer-time-limit
+++ b/computer-time-limit
@@ -1,5 +1,7 @@
#!/bin/bash
+dir=$(dirname "$(readlink -e "${0}")")
+
lock_file=~/.computer-time-limit.lock
exec 9> "${lock_file}"
@@ -7,6 +9,14 @@ if ! flock -n 9; then
exit
fi
+if [ -d "${dir}"'/.git' ] && [ $# -eq 0 ]; then
+ git -C "${dir}" fetch --all -p 2>/dev/null
+ if [ -n "$(git -C "${dir}" status --porcelain)" ]; then
+ git -C "${dir}" pull --ff-only 2>/dev/null
+ exec "$0" '-'
+ fi
+fi
+
time_file=~/.computer-time-limit
time_per_week=$((3*60*60))
max_time=$((4*60*60))