-
Notifications
You must be signed in to change notification settings - Fork 1
/
bleeding
executable file
·173 lines (144 loc) · 5.05 KB
/
bleeding
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
DISTRO="bullseye"
RELEASE="bleeding"
NODEREPO="node_20.x"
try() {
bash -c "$1"
}
catch() {
echo "error executing command"
exit 1
}
execute() {
try "$1" || catch
}
alternates() {
if [ "|${DISTRO}|" == "|${1}|" ]; then
DISTRO="${2}"
fi
}
reset() {
rm -f /usr/share/keyrings/nodesource.gpg
rm -f /usr/share/keyrings/yarnkey.gpg
rm -f /usr/share/keyrings/hoobs.gpg
rm -f /etc/apt/sources.list.d/nodesource.list
rm -f /etc/apt/sources.list.d/yarn.list
rm -f /etc/apt/sources.list.d/hoobs.list
}
validate() {
if $(uname -m | grep -Eq ^armv6); then
echo "device specifies an unsupported architecture"
exit 1
fi
DISTRO=$(lsb_release -c -s)
alternates "solydxk-9" "stretch"
alternates "sana" "jessie"
alternates "kali-rolling" "bullseye"
alternates "Tyche" "stretch"
alternates "Nibiru" "buster"
alternates "Horizon" "stretch"
alternates "Continuum" "stretch"
alternates "patito feo" "buster"
alternates "maya" "precise"
alternates "qiana" "trusty"
alternates "rafaela" "trusty"
alternates "rebecca" "trusty"
alternates "rosa" "trusty"
alternates "sarah" "xenial"
alternates "serena" "xenial"
alternates "sonya" "xenial"
alternates "sylvia" "xenial"
alternates "tara" "bionic"
alternates "tessa" "bionic"
alternates "tina" "bionic"
alternates "tricia" "bionic"
alternates "ulyana" "focal"
alternates "ulyssa" "focal"
alternates "uma" "focal"
alternates "betsy" "jessie"
alternates "cindy" "stretch"
alternates "debbie" "buster"
alternates "luna" "precise"
alternates "freya" "trusty"
alternates "loki" "xenial"
alternates "juno" "bionic"
alternates "hera" "bionic"
alternates "odin" "focal"
alternates "toutatis" "precise"
alternates "belenos" "trusty"
alternates "flidas" "xenial"
alternates "etiona" "bionic"
alternates "lugalbanda" "xenial"
alternates "anokha" "wheezy"
alternates "anoop" "jessie"
alternates "drishti" "stretch"
alternates "unnati" "buster"
alternates "bunsen-hydrogen" "jessie"
alternates "helium" "stretch"
alternates "lithium" "buster"
alternates "chromodoris" "jessie"
alternates "green" "sid"
alternates "amber" "buster"
alternates "jessie" "jessie"
alternates "ascii" "stretch"
alternates "beowulf" "buster"
alternates "ceres" "sid"
alternates "panda" "sid"
alternates "unstable" "sid"
alternates "stable" "buster"
alternates "onyedi" "stretch"
alternates "lemur-3" "stretch"
alternates "orel" "stretch"
alternates "dolcetto" "stretch"
if [ "|${DISTRO}|" == "|debian|" ]; then
FOUND=$([ -e /etc/debian_version ] && cut -d/ -f1 < /etc/debian_version)
if [ "|${NEWDISTRO}|" != "||" ]; then
DISTRO=$FOUND
fi
fi
}
availability() {
try "curl -sLf -o /dev/null 'https://deb.nodesource.com/${NODEREPO}/dists/${DISTRO}/Release'"
if [[ $? != 0 ]]; then
DISTRO="bullseye"
fi
}
prerequisites() {
PREREQUISITES=" ca-certificates libgnutls30"
if [ ! -e /usr/lib/apt/methods/https ]; then
PREREQUISITES="${PREREQUISITES} apt-transport-https"
fi
if [ ! -x /usr/bin/lsb_release ]; then
PREREQUISITES="${PREREQUISITES} lsb-release"
fi
if [ ! -x /usr/bin/curl ]; then
PREREQUISITES="${PREREQUISITES} curl"
fi
if [ ! -x /usr/bin/gpg ]; then
PREREQUISITES="${PREREQUISITES} gnupg"
fi
execute "apt-get update --allow-releaseinfo-change"
if [ "|${PREREQUISITES}|" != "||" ]; then
execute "apt-get install -y${PREREQUISITES} > /dev/null 2>&1"
fi
}
setup() {
if [ -f "/etc/apt/sources.list.d/chris-lea-node_js-$DISTRO.list" ]; then
try "add-apt-repository -y -r ppa:chris-lea/node.js"
execute "rm -f /etc/apt/sources.list.d/chris-lea-node_js-${DISTRO}.list"
fi
execute "curl -ks https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg > /dev/null"
execute "curl -ks https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg > /dev/null"
execute "curl -ks https://dl.hoobs.org/debian/pubkey.gpg.key | gpg --dearmor | tee /usr/share/keyrings/hoobs.gpg > /dev/null"
execute "echo 'deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' | tee /etc/apt/sources.list.d/nodesource.list"
execute "echo 'deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' | tee -a /etc/apt/sources.list.d/nodesource.list"
execute "echo 'deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list"
execute "echo 'deb [signed-by=/usr/share/keyrings/hoobs.gpg] https://dl.hoobs.org/debian/ ${RELEASE} main' | tee /etc/apt/sources.list.d/hoobs.list"
execute 'apt-get update'
}
validate
reset
prerequisites
availability
setup