blob: 1892ec2bae344190f95d0ab08be7a2807b57ae62 (
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
54
55
56
57
58
59
60
61
62
63
|
#!/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
}
# install_files <module_name>
install_files() {
local dir="${BASEDIR}/static_files/${1}"
[ -d "$dir" ] || perror "static files for module $1 not found"
tar -cpP --owner=root --group=root --transform "s,^\(./\)*${dir}/*,," "$dir" | tar -xp -C /
local ps=( ${PIPESTATUS[*]} )
[ "${ps[0]}" != 0 ] && perror "tarcopy: Read failed"
[ "${ps[1]}" != 0 ] && perror "tarcopy: Write failed"
return 0
}
|