Skip to content

Commit a55b1a4

Browse files
Support running a script before sr3_pull for #17
1 parent c2248df commit a55b1a4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

bin/sr3_pull

+21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
#!/bin/bash
2+
3+
# shellcheck source=./bin/sr3_utils
4+
source "${BASH_SOURCE%/*}/sr3_utils"
5+
6+
# Pre-pull script: in _dsh_config/${pump_name}_pre_pull_script.
7+
# If it exists, run it. If the name ends in _bg, run in the background. You can have both.
8+
sr3_get_git_path_pump_name
9+
pre_script="${git_tld}/_dsh_config/${pump_name}_pre_pull_script"
10+
if [ -e "${pre_script}" ]; then
11+
"${pre_script}"
12+
fi
13+
if [ -e "${pre_script}_bg" ]; then
14+
"${pre_script}_bg" &
15+
pre_script_bg_pid="$!"
16+
fi
17+
218
# plugins could also be a Git repo
319
sr3r -bg "cd ~/.config/sr3; \
420
git reset --hard HEAD > /dev/null; git pull | awk '{ print \"Config Repo \" \$0 }' && if [ -d './plugins/.git' ]; then cd ./plugins && git reset --hard HEAD > /dev/null && git pull | awk '{ print \"Plugins Repo \" \$0 }'; fi"
21+
22+
# Stop the pre-pull script
23+
if [ -n "${pre_script_bg_pid}" ]; then
24+
kill "${pre_script_bg_pid}"
25+
fi

0 commit comments

Comments
 (0)