summaryrefslogtreecommitdiffstats
path: root/helper/fileutil.inc
diff options
context:
space:
mode:
authorJonathan Bauer2013-06-12 13:43:44 +0200
committerJonathan Bauer2013-06-12 13:43:44 +0200
commitb8280ebbaa54b602d66bbfff83b13cf577f15428 (patch)
tree3bb57afcda55fcc5a3ce2357f060abda04879c07 /helper/fileutil.inc
parentMerge branch 'master' of git:openslx-ng/tm-scripts (diff)
downloadtm-scripts-b8280ebbaa54b602d66bbfff83b13cf577f15428.tar.gz
tm-scripts-b8280ebbaa54b602d66bbfff83b13cf577f15428.tar.xz
tm-scripts-b8280ebbaa54b602d66bbfff83b13cf577f15428.zip
[fileutil.inc] generic install_package function, to be used in scripts. Installs a package using the platform's packet manager
Diffstat (limited to 'helper/fileutil.inc')
-rw-r--r--helper/fileutil.inc39
1 files changed, 19 insertions, 20 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc
index fb1c8382..d4965b5b 100644
--- a/helper/fileutil.inc
+++ b/helper/fileutil.inc
@@ -9,20 +9,7 @@ else
perror "Could not determine this platform's packet manager"
fi
-# install given packet through system's packet manager
-install_package() {
- [ $# -eq 0 ] && perror "Sanity check failed: no argument given to install_package"
- local PACKAGE_LIST="$@"
- for PACKAGE in $PACKAGE_LIST; do
- if [ "x$PACKET_MANAGER" == "xapt" ]; then
- apt-get install -y $PACKAGE
- elif [ "x$PACKET_MANAGER" == "xzypper" ]; then
- zypper --no-refresh install -y $PACKAGE
- fi
- # TODO finish...
- done
-}
-
+#
# copy list of files using tar
tarcopy () {
if [ $# -gt 0 -a "x$1" == "x-i" ]; then
@@ -85,14 +72,26 @@ list_packet_files() {
# goes through all package as given in the variable REQUIRED_INSTALLED_PACKAGES
install_dependencies() {
[ -z "$REQUIRED_INSTALLED_PACKAGES" ] && return
- if [ "$PACKET_MANAGER" = "apt" ]; then
- # install package, only if not already installed, TODO fix me
- #dpkg -l $(echo $(echo "$REQUIRED_INSTALLED_PACKAGES")) &> /dev/null && return
- apt-get install -y $REQUIRED_INSTALLED_PACKAGES || perror "Could not apt-get install $REQUIRED_INSTALLED_PACKAGES"
- elif [ "$PACKET_MANAGER" = "zypper" ]; then
- zypper --no-refresh install -y -n $REQUIRED_INSTALLED_PACKAGES || perror "Could not zypper install $REQUIRED_INSTALLED_PACKAGES"
+ install_packages "$REQUIRED_INSTALLED_PACKAGES"
+}
+#
+# install given packet through system's packet manager
+# uses PACKET_MANAGER as determined in helper/system.inc
+#
+install_packages() {
+ [ $# -eq 0 ] && perror "Sanity check failed: no argument given to install_package"
+ pdebug "ARGS: $@"
+ local PACKAGE_LIST="$@"
+ if [ "x$PACKET_MANAGER" == "xapt" ]; then
+ apt-get install -y ${PACKAGE_LIST}
+ local IRET="$?"
+ [ "x$IRET" != "x0" ] && pwarning "install_package: apt-get failed with '$IRET' for package '$PACKAGE_LIST'"
+ elif [ "x$PACKET_MANAGER" == "xzypper" ]; then
+ local IRET=$(zypper --no-refresh --non-interactive install ${PACKAGE_LIST})
+ [ "x$IRET" != "x0" ] && pwarning "install_package: zypper failed with '$IRET' for package '$PACKAGE_LIST'"
fi
}
+
#
# copies static data files from <MODULE>/data/ to <TARGET_BUILD_DIR>
#