Skip to content

Commit c8d0800

Browse files
committed
Move auto-sync/commit stuff here from pim repo
1 parent b088355 commit c8d0800

File tree

12 files changed

+472
-0
lines changed

12 files changed

+472
-0
lines changed

bin/auj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
# if ! groups | grep -q systemd-journal; then
4+
# echo >&2 "Need to be in systemd-journal group; aborting!"
5+
# exit 1
6+
# fi
7+
8+
jcfuu 'auto-*' -n 1000 | \
9+
lnavf \
10+
-f $0.filters \
11+
"$@"

bin/auj.filters

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# These are (at least mostly) not needed now we have git-annex-clean-sync
2+
3+
# :filter-out auto-sync-org\[\d+\]: remote: error: refusing to update checked out branch: refs/heads/master
4+
# :filter-out auto-sync-org\[\d+\]: To ssh://aegean-wifi/home/adam/org
5+
# :filter-out auto-sync-org\[\d+\]: ! \[remote rejected\] master -> master \(branch is currently checked out\)
6+
# :filter-out auto-sync-org\[\d+\]: error: failed to push some refs to 'ssh://adam@aegean-wifi/home/adam/org'
7+
8+
# These are the kinds of errors seen from auto-sync-org when there are
9+
# merge conflicts:
10+
#
11+
# push aegean
12+
# To ssh://aegean-wifi/home/adam/org
13+
# ! [rejected] master -> synced/master (non-fast-forward)
14+
# error: failed to push some refs to 'ssh://adam@aegean-wifi/home/adam/org'
15+
# hint: Updates were rejected because a pushed branch tip is behind its remote
16+
# hint: counterpart. Check out this branch and integrate the remote changes
17+
# hint: (e.g. 'git pull ...') before pushing again.
18+
# hint: See the 'Note about fast-forwards' in 'git push --help' for details.
19+
# To ssh://aegean-wifi/home/adam/org
20+
# ! [rejected] master -> master (non-fast-forward)
21+
# error: failed to push some refs to 'ssh://adam@aegean-wifi/home/adam/org'
22+
# hint: Updates were rejected because the tip of your current branch is behind
23+
# hint: its remote counterpart. Integrate the remote changes (e.g.
24+
# hint: 'git pull ...') before pushing again.
25+
# hint: See the 'Note about fast-forwards' in 'git push --help' for details.
26+
# Pushing to aegean failed.
27+
# (non-fast-forward problems can be solved by setting receive.denyNonFastforwards to false in the remote's git config)
28+
# failed
29+
# push adamspiers.org

bin/auls

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
if name=$( mrname 2>/dev/null ); then
5+
set -- "$name"
6+
else
7+
set -- org
8+
fi
9+
fi
10+
11+
for repo in "$@"; do
12+
systemctl list-unit-files --user |
13+
awk '/^auto-(sync|commit)-'"$repo"'\.service/ {print $1}'
14+
done

bin/aus

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
austa
4+
5+
cd ~/org
6+
echo
7+
export GIT_PAGER_MODE=none
8+
ggl1 -n5

bin/ausp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
ausys stop
4+

bin/ausre

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
ausys restart
4+

bin/aust

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
ausys start

bin/austa

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
ausys status

bin/ausys

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
systemctl list-unit-files --user |
4+
awk '/^auto-(sync|commit)-[^ ]+\.service/ {print $1}' |
5+
xargs systemctl --user --no-pager "$@"

bin/auto-commit-daemon

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env zsh
2+
3+
debug=
4+
if [[ "$1" == '-d' ]]; then
5+
debug=-d
6+
shift
7+
fi
8+
9+
if [ $# != 3 ]; then
10+
cat <<EOF >&2
11+
Usage: $(basename $0) [-d] REPO-DIR SLEEP MIN-AGE
12+
EOF
13+
exit 1
14+
fi
15+
16+
repo_dir="$1"
17+
sleep="$2"
18+
min_age="$3"
19+
20+
cd "$repo_dir"
21+
22+
for var in name email; do
23+
if ! git config user.$var >/dev/null; then
24+
echo >&2 "Error: user.$var not set in git config; aborting"
25+
exit 1
26+
fi
27+
done
28+
29+
while true; do
30+
git auto-commit $debug -m "$min_age"
31+
sleep "$sleep"
32+
done

0 commit comments

Comments
 (0)