-
Notifications
You must be signed in to change notification settings - Fork 1
/
update
executable file
·35 lines (29 loc) · 1.23 KB
/
update
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
#!/bin/bash
function ensure_if_exists {
filename="$1"
url="$2"
sha="$3"
test -f $filename || return
chmod 644 "$filename"
echo "$sha $filename" | sha256sum --check && return
tmpfile=$(mktemp)
curl -ks "$url" | gpg --dearmor > "$tmpfile"
if (echo "$sha $tmpfile" | sha256sum --check)
then
mv "$tmpfile" "$filename"
chmod 644 "$filename"
else
echo "$url has wrong sha256. $sha vs $(sha256sum $tmpfile)"
fi
rm -f "$tmpfile"
}
ensure_if_exists /usr/share/keyrings/yarnkey.gpg https://dl.yarnpkg.com/debian/pubkey.gpg 6a75fb89ee4ce8899e232dd23f1acdde55b8de89aefae474aed35f0e19ac79f2
ensure_if_exists /usr/share/keyrings/hoobs.gpg https://dl.hoobs.org/debian/pubkey.gpg.key f1ff8b2b652022f4e7a22621db9b748ca3fb02d83ac03f4ec18e69b1c4c7d746
if [ -f /etc/apt/sources.list.d/nodesource.list ]; then
rm -f /etc/apt/sources.list.d/nodesource.new.list
sed 's/node_14.x/node_20.x/g; s/node_16.x/node_20.x/g; s/node_18.x/node_20.x/g' /etc/apt/sources.list.d/nodesource.list | tee /etc/apt/sources.list.d/nodesource.new.list
cp /etc/apt/sources.list.d/nodesource.new.list /etc/apt/sources.list.d/nodesource.list
rm -f /etc/apt/sources.list.d/nodesource.new.list
fi
apt-get update --allow-releaseinfo-change
dpkg --configure -a --force-confnew