-
Notifications
You must be signed in to change notification settings - Fork 1
/
update.sh
47 lines (36 loc) · 1.47 KB
/
update.sh
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
#!/bin/sh
set -e
if [ $# -eq 0 ]; then
latest_release_uri="https://api.github.com/repos/ericdrgn/drgn.nyxt/releases/latest"
echo "DOWNLOADING $latest_release_uri"
version=$( command curl -sSf "$latest_release_uri" |
command grep -Eo "tag_name\": .*" |
command grep -Eo "[0-9.]*" )
if [ ! "$version" ]; then exit 1; fi
else
version="${1}"
fi
download_uri="https://github.com/ericdrgn/drgn.nyxt/archive/refs/tags/${version}.zip"
nyxt_install="${NYXT_INSTALL:-$HOME/.config/nyxt}"
if [ ! -d "$nyxt_install" ]; then
echo "MAKING FOLDER $nyxt_install";
mkdir -p "$nyxt_install"
fi
tar_file="$nyxt_install/${version}.zip"
echo "DOWNLOADING v$version $download_uri"
curl --fail --location --progress-bar --output "$tar_file" "$download_uri"
cd "$nyxt_install"
echo "EXTRACTING $tar_file"
unzip "$tar_file"
echo "REMOVING $tar_file"
rm "$tar_file"
echo "COPYING"
cp -rf "$nyxt_install/drgn.nyxt-${version}/base" "$nyxt_install"
cp -rf "$nyxt_install/drgn.nyxt-${version}/ex" "$nyxt_install"
cp -rf "$nyxt_install/drgn.nyxt-${version}/scripts" "$nyxt_install"
cp -rf "$nyxt_install/drgn.nyxt-${version}/themes" "$nyxt_install"
cp -rf "$nyxt_install/drgn.nyxt-${version}/auto-config.lisp" "$nyxt_install"
cp -rf "$nyxt_install/drgn.nyxt-${version}/init.lisp" "$nyxt_install"
cp -rf "$nyxt_install/drgn.nyxt-${version}/update.sh" "$nyxt_install"
echo "REMOVING $nyxt_install/drgn.nyxt-${version}"
rm -r "$nyxt_install/drgn.nyxt-${version}"