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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env fish
cd (dirname (status filename))
source utils/helpers.fish; or exit
source utils/constants.fish; or exit
update_origin_url 'https://github.com/cloudrac3r/bibliogram-updater(?:.git)?' 'https://git.sr.ht/~cadence/bibliogram-updater'; or exit
if do_update
echo 'Self-update successful.'
exec ./run.fish
end
if not test -e state/is_installed
exec ./install.fish
end
# ---
if test -e state/use_local_node
set -a PATH $PWD/$node_folder/bin
end
set pull_interval 10m
set update_applied false
cd bibliogram/src/site
update_origin_url 'https://github.com/cloudrac3r/bibliogram(?:.git)?' 'https://git.sr.ht/~cadence/bibliogram'; or exit
if do_update
npm install --no-optional
end
while true
set update_applied false
echo '' | node server.js &
set -l b_pid (jobs -p)
while not $update_applied
sleep $pull_interval
if do_update
npm install --no-optional
set update_applied true
kill $b_pid
else
echo '[ ] ['(date +%H%M%S)'] [UPD] No updates available yet.'
end
end
end