diff options
| author | Jonathan Bauer | 2014-07-04 15:03:06 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2014-07-04 15:03:06 +0200 |
| commit | ae42d45b4b46c70a9e1afa7bb2a36bb13e3e0070 (patch) | |
| tree | b795ae29a9cd5c0f41abada05aa99a5105d6a2e0 /remote/includes | |
| parent | [xdg] make sure xdg-user-dirs-update is disabled (diff) | |
| parent | Merge branch 'master' of git://git.openslx.org/openslx-ng/tm-scripts (diff) | |
| download | tm-scripts-ae42d45b4b46c70a9e1afa7bb2a36bb13e3e0070.tar.gz tm-scripts-ae42d45b4b46c70a9e1afa7bb2a36bb13e3e0070.tar.xz tm-scripts-ae42d45b4b46c70a9e1afa7bb2a36bb13e3e0070.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/includes')
| -rw-r--r-- | remote/includes/distribution.inc | 2 | ||||
| -rw-r--r-- | remote/includes/kernel.inc | 11 | ||||
| -rw-r--r-- | remote/includes/packagemanager.inc | 16 | ||||
| -rw-r--r-- | remote/includes/system.inc | 1 | ||||
| -rw-r--r-- | remote/includes/useradd.inc | 4 |
5 files changed, 20 insertions, 14 deletions
diff --git a/remote/includes/distribution.inc b/remote/includes/distribution.inc index 7a7be738..137da7ef 100644 --- a/remote/includes/distribution.inc +++ b/remote/includes/distribution.inc @@ -18,7 +18,7 @@ detect_distribution () { PACKET_MANAGER="zypper" PACKET_HANDLER="rpm" ;; - scientific) + scientific|fedora) PACKET_MANAGER="yum" PACKET_HANDLER="rpm" ;; diff --git a/remote/includes/kernel.inc b/remote/includes/kernel.inc index dc7f7f12..3acb1810 100644 --- a/remote/includes/kernel.inc +++ b/remote/includes/kernel.inc @@ -28,9 +28,12 @@ get_kernel_version () { # set empty SYS_UTS_RELEASE and SYS_KERNEL SYS_UTS_RELEASE="(unknown)" SYS_KERNEL="$(echo "$SYS_UTS_RELEASE" | grep -o -E '^[0-9\.]+')" + # System kernel version + SYSTEM_KERNEL_LONG=$(uname -r) + SYSTEM_KERNEL_SHORT=$(grep -o -E '^[0-9\.]+' <<<$SYSTEM_KERNEL_LONG) } -check_kernel_base_dir() { +check_kernel_base_dir () { # check if KERNEL_BASE_DIR was set, if not we don't know # whether kernel-openslx or kernel-system has been built @@ -46,7 +49,7 @@ check_kernel_base_dir() { } -copy_kernel_modules() { +copy_kernel_modules () { pinfo "Copying kernel modules for kernel ${KERNEL_CURRENT_VERSION}..." [ -z "${REQUIRED_KERNEL_MODULES}" ] && perror "REQUIRED_KERNEL_MODULES is empty. Check your config file." [ -z "${KERNEL_HEADERS_PATH}" ] && perror "KERNEL_HEADERS_PATH is empty. Kernel headers appears to be missing." @@ -128,7 +131,7 @@ copy_kernel_modules() { cd "${OLD_DIR}" || perror "Could not cd back to ${OLD_DIR}." } -copy_firmware() { +copy_firmware () { pinfo "Copying firmware for kernel ${KERNEL_CURRENT_VERSION}..." [ -z "${REQUIRED_FIRMWARE}" ] && perror "REQUIRED_FIRMWARE is empty. Check your config file." @@ -205,7 +208,7 @@ copy_firmware() { cd "${OLD_DIR}" || perror "Could not cd back to ${OLD_DIR}." } -copy_kernel() { +copy_kernel () { check_kernel_base_dir local TOOL_STR="$TOOL_STR copy_kernel:" diff --git a/remote/includes/packagemanager.inc b/remote/includes/packagemanager.inc index 66013807..63acf270 100644 --- a/remote/includes/packagemanager.inc +++ b/remote/includes/packagemanager.inc @@ -98,34 +98,36 @@ install_packages() { [ $# -eq 0 ] && perror "Sanity check failed: no argument given to install_package" local PACKAGE_LIST="$@" local INSTALLED_PACKAGES="" + local LRET="" for PKG in ${PACKAGE_LIST}; do # check if installed: # this is done mainly for performance reasons, even though - # reinstalling all packages is a valid possibility too... + # reinstalling all packages is a valid possibility too... if [ "x$PACKET_HANDLER" == "xdpkg" ]; then dpkg -l ${PKG} > /dev/null 2>&1 + LRET=$? elif [ "x$PACKET_HANDLER" == "xrpm" ]; then - rpm -ql ${PKG} > /dev/null 2>&1 + rpm -ql "${PKG}" > /dev/null 2>&1 + LRET=$? else perror "No packet manager / handler determined, this should not happen!" fi - local LRET=$? if [ "x$LRET" == "x0" ]; then # check if it is completly installed, not just leftover configuration files if [ "x$PACKET_HANDLER" == "xdpkg" ]; then - local INSTALL_STATUS=$(dpkg -l $PKG | grep $PKG | cut -c1-2) + local INSTALL_STATUS=$(dpkg -l "${PKG}" | grep "${PKG}" | cut -c1-2) if [[ $INSTALL_STATUS != "ii" ]]; then pinfo "$PKG is either missing or a meta-package! Installing it to be sure..." - install_package $PKG + install_package "${PKG}" else # package installed - pdebug "$PKG installed!" + pdebug "${PKG} installed!" fi elif [ "x$PACKET_HANDLER" == "xrpm" ]; then # TODO: blindly install again for now - install_package $PKG + rpm -q "${PKG}" >/dev/null 2>&1 || install_package "${PKG}" fi else # package not installed diff --git a/remote/includes/system.inc b/remote/includes/system.inc index bcdaed23..17a80761 100644 --- a/remote/includes/system.inc +++ b/remote/includes/system.inc @@ -21,6 +21,7 @@ if [ "$(uname -m)x" = "x86_64x" ]; then case $SYS_DISTRIBUTION in ubuntu | debian) LIB64="lib" ;; opensuse) LIB64="lib64" ;; + fedora) LIB64="lib64" ;; *) perror "Cannot set LIB64, SYS_DISTRIBUTION: $SYS_DISTRIBUTION unknown!" ;; esac AMD64_I386=amd64 diff --git a/remote/includes/useradd.inc b/remote/includes/useradd.inc index 352da606..29a9c39a 100644 --- a/remote/includes/useradd.inc +++ b/remote/includes/useradd.inc @@ -16,7 +16,7 @@ . "${ROOT_DIR}/helper/string.inc" -NAME_REGEX='^[a-z][-a-z0-9]*$' +declare -r NAME_REGEX='^[a-z][-a-z0-9]*$' # Generate a UID for a given USERNAME. Return existing UID if possible, generate new one otherwise generate_uid() @@ -150,7 +150,7 @@ add_user() { pinfo "Created user $USER" elif [ "$PASSWORD" != "*" ]; then # update user's password - sed -i -r "s#^${USER}:[^:]*:(.*)\$#${USER}:${PASSWORD}:\1#g" "${_SHADOW}" + sed -i -r "s#^${USER}:[^:]*:(.*)\$"'#'"${USER}:${PASSWORD}:\1#g" "${_SHADOW}" pinfo "Updated password of $USER" fi [ -z "${_GID}" ] && pinfo "Created group $GROUP" && echo "${GROUP}:x:${GROUPID}:" >> "${_GROUP}" |
