-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbd-pkgs
executable file
·47 lines (38 loc) · 1.19 KB
/
bd-pkgs
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/bash
set -eo pipefail
. ./dist.conf
if [ -z "$1" ]; then
echo "Please provide the module name!"
exit 1
fi
if [ -f "modules/$1/${DISTRIBUTION}_repos" ]; then
while read -r line; do
IFS=';' read -ra ELEMS <<< "$line"
echo "* Adding an external repo: ${ELEMS[1]}"
# PPA (no key)
if [ "$(echo "${ELEMS[0]}" | cut -c 1-4)" = "ppa:" ]; then
add-apt-repository "${ELEMS[0]}"
else
curl -fsSL "${ELEMS[0]}" | apt-key add -
if [ "${#ELEMS[@]}" -eq "3" ]; then
add-apt-repository "${ELEMS[1]} $(lsb_release -cs) ${ELEMS[2]}"
else
add-apt-repository "${ELEMS[1]} ${ELEMS[3]} ${ELEMS[2]}"
fi
fi
done < <(cat "modules/$1/${DISTRIBUTION}_repos")
apt-get update
fi
if [ -f "modules/$1/${DISTRIBUTION}_preinstall" ]; then
sh "modules/$1/${DISTRIBUTION}_preinstall"
fi
if [ -f "modules/$1/${DISTRIBUTION}_packages" ]; then
packages=$(cat "modules/$1/${DISTRIBUTION}_packages" | tr '\n' ' ')
apt-get -y install $packages
fi
if [ -x "$(command -v snap)" ] && [ -f "modules/$1/snaps" ]; then
while read -r line; do
IFS=';' read -ra ELEMS <<< "$line"
snap install ${ELEMS[0]} --"${ELEMS[1]}"
done < <(cat "modules/$1/snaps")
fi