forked from tal-zvon/vimrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DEV
25 lines (21 loc) · 1.05 KB
/
DEV
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
I need a way to keep this file synced.
This would either involve:
SystemD
Cron
An entry in ~/.bashrc that would run every time bash starts
Since I need it to work on MacOS as well, which doesn't have SystemD, or cron, the .bashrc entry sounds like a good starting point.
I'd need it to do something like this:
(
LATEST_VERSION=$(curl -s "https://api.github.com/repos/tal-zvon/vimrc/commits?path=vimrc&page=1&per_page=1" | grep '^[ ]\{4\}"sha"' | cut -d '"' -f 4)
CURRENT_VERSION=$(...)
if [[ "$LATEST_VERSION" != "$CURRENT_VERSION" ]]
then
...
echo "vimrc updated"
fi
) & disown
The disown is so that bash doesn't report that the task is done when it completes.
The background process is so that it doesn't slow down bash from opening.
There are 2 problems:
1. Printing with echo from a background process isn't ideal. Maybe I can use wall.
2. My vimrc install script requires sudo. I can't run a subprocess with sudo. Maybe instead of doing the full install, I should just make it sync the vimrc file, and nothing else