blob: 0d96cfa76a9e4807ac4fd7dbf404543e749763ce (
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
|
#!/bin/bash
install_package() {
echo "# Installing packages $* ... "
apt-get $INSTALLOPTIONS install "$@" && return 0
echo
echo "# Could not install $*"
echo "# Trying an apt-get update..."
if ! apt-get update; then
perror "apt-get update failed. Abort."
fi
echo "# Retrying installing package $* ... "
apt-get $INSTALLOPTIONS install "$@" && return 0
perror "Could not install $* - Giving up."
}
install_packages() {
local NEEDED_PACKAGES="$2"
local INSTALLOPTIONS=
echo "#"
echo "# Installing packages. This may take a while."
echo "#"
case "$1" in
NOREC) INSTALLOPTIONS="-qq -y --no-install-recommends"
;;
RECOM) INSTALLOPTIONS="-qq -y"
;;
esac
install_package $NEEDED_PACKAGES # No quotes
}
# 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
}
|