summaryrefslogtreecommitdiffstats
path: root/helper
diff options
context:
space:
mode:
authorJonathan Bauer2013-12-09 16:20:09 +0100
committerJonathan Bauer2013-12-09 16:20:09 +0100
commitec2eb842a9fa369fa9e3751c322d53077be90180 (patch)
tree5ad3900b12a9ee647ba83c6ddd159350d484b165 /helper
parent[pam] Tweak session close script as to not kill concurrent login sessions, al... (diff)
downloadtm-scripts-ec2eb842a9fa369fa9e3751c322d53077be90180.tar.gz
tm-scripts-ec2eb842a9fa369fa9e3751c322d53077be90180.tar.xz
tm-scripts-ec2eb842a9fa369fa9e3751c322d53077be90180.zip
[fileutil.inc] new: install_package generic install package function for
single packages. Refined checks to see if a package is installed entirely and not just some configuration files
Diffstat (limited to 'helper')
-rw-r--r--helper/fileutil.inc97
1 files changed, 58 insertions, 39 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc
index 027f5404..aae654bc 100644
--- a/helper/fileutil.inc
+++ b/helper/fileutil.inc
@@ -91,7 +91,7 @@ install_packages() {
for PKG in ${PACKAGE_LIST}; do
# check if installed
if [ "x$PACKET_HANDLER" == "xdpkg" ]; then
- dpkg -L ${PKG} > /dev/null 2>&1
+ dpkg -l ${PKG} > /dev/null 2>&1
elif [ "x$PACKET_HANDLER" == "xrpm" ]; then
rpm -ql ${PKG} > /dev/null 2>&1
else
@@ -100,53 +100,72 @@ install_packages() {
local LRET=$?
if [ "x$LRET" == "x0" ]; then
- # package installed
- pdebug "$PKG installed!"
+ # check if it is completly installed,
+ # not just leftover configuration files
+ local INSTALL_STATUS=$(dpkg -l $PKG | grep $PKG | cut -c1-2)
+ if [[ $INSTALL_STATUS != "ii" ]]; then
+ pinfo "$PKG not installed!"
+ install_package $PKG
+ else
+ # package installed
+ pdebug "$PKG installed!"
+ fi
else
# package not installed
pdebug "$PKG not installed!"
- if [ "x$PACKET_MANAGER" == "xapt" ]; then
- apt-get install -y ${PKG}
- local IRET=$?
- if [ "x$IRET" == "x0" ]; then
- # $PGK was installed successfully
- INSTALLED_PACKAGES+="$PKG "
- else
- # PKG was not installed
- # TODO error handling
- perror "install_packages: apt-get failed with '$IRET' for package '$PKG'"
- fi
- elif [ "x$PACKET_MANAGER" == "xzypper" ]; then
- zypper --no-refresh --non-interactive install ${PKG}
- local IRET=$?
- if [ "x$IRET" == "x0" ]; then
- # $PGK was installed successfully
- INSTALLED_PACKAGES+="$PKG "
- else
- # PKG was not installed
- # TODO error handling
- perror "install_packages: zypper failed with '$IRET' for package '$PKG'"
- fi
- elif [ "x$PACKET_MANAGER" == "xyum" ]; then
- yum --assumeyes install ${PKG}
- local IRET=$?
- if [ "x$IRET" == "x0" ]; then
- # $PGK was installed successfully
- INSTALLED_PACKAGES+="$PKG "
- else
- # PKG was not installed
- # TODO error handling
- perror "install_packages: yum failed with '$IRET' for package '$PKG'"
- fi
- else
- perror "No packet manager determined, this should not happen!"
- fi
+ install_package $PKG
fi
done
[ ! -z "$INSTALLED_PACKAGES" ] && pinfo "Packages installed: ${INSTALLED_PACKAGES}"
}
#
+# install individual package depending on package manager
+#
+install_package() {
+ if [ "$#" -ne 1 ]; then
+ perror "Only call install_package with one argument!"
+ fi
+
+ if [ "x$PACKET_MANAGER" == "xapt" ]; then
+ apt-get install -y ${PKG}
+ local IRET=$?
+ if [ "x$IRET" == "x0" ]; then
+ # $PGK was installed successfully
+ INSTALLED_PACKAGES+="$PKG "
+ else
+ # PKG was not installed
+ # TODO error handling
+ perror "install_packages: apt-get failed with '$IRET' for package '$PKG'"
+ fi
+ elif [ "x$PACKET_MANAGER" == "xzypper" ]; then
+ zypper --no-refresh --non-interactive install ${PKG}
+ local IRET=$?
+ if [ "x$IRET" == "x0" ]; then
+ # $PGK was installed successfully
+ INSTALLED_PACKAGES+="$PKG "
+ else
+ # PKG was not installed
+ # TODO error handling
+ perror "install_packages: zypper failed with '$IRET' for package '$PKG'"
+ fi
+ elif [ "x$PACKET_MANAGER" == "xyum" ]; then
+ yum --assumeyes install ${PKG}
+ local IRET=$?
+ if [ "x$IRET" == "x0" ]; then
+ # $PGK was installed successfully
+ INSTALLED_PACKAGES+="$PKG "
+ else
+ # PKG was not installed
+ # TODO error handling
+ perror "install_packages: yum failed with '$IRET' for package '$PKG'"
+ fi
+ else
+ perror "No packet manager determined, this should not happen!"
+ fi
+}
+
+#
# copies static data files from <MODULE>/data/ to <TARGET_BUILD_DIR>
#
copy_static_data() {