blob: 5a64b0ee7aac7689e9c5fcb6358b1e3c5077dc12 (
plain) (
blame)
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
|
#!/bin/bash
install_package() {
# These stacked ifs are just a stopgap until proper trapping.
echo -n "# Installing package $PACKAGE... "
apt-get $INSTALLOPTIONS install ${PACKAGE}
ERR=$?
if [ "$ERR" -ne 0 ]; then
echo
echo "# Could not install package $PACKAGE - Error number $ERR!"
echo -n "# Trying an apt-get update..."
apt-get update 2>/dev/null 1>&2
ERR=$?
if [ "$ERR" -ne 0 ]; then
echo
echo "# apt-get update has thrown error number $ERR. You need to take care"
echo "# of this by hand. Commencing installation."
else
echo " ok."
echo -n "# Retrying installing package $PACKAGE... "
apt-get $INSTALLOPTIONS install ${PACKAGE} 2>/dev/null 1>&2
ERR=$?
if [ "$ERR" -ne 0 ]; then
perror "Could not install $PACKAGE. Giving up."
else
echo "ok."
fi
fi
else
echo "ok."
fi
}
install_packages() {
local NEEDED_PACKAGES="$2"
echo "#"
echo "# Installing packages. This may take a while."
echo "#"
case "$1" in
NOREC) INSTALLOPTIONS="-qq -y --no-install-recommends"
for PACKAGE in $NEEDED_PACKAGES; do
install_package
done
;;
RECOM) INSTALLOPTIONS="-qq -y"
for PACKAGE in $NEEDED_PACKAGES; do
install_package
done
esac
}
|