diff options
| -rw-r--r-- | helper/fileutil.inc | 40 | ||||
| -rw-r--r-- | helper/kernel.inc | 26 | ||||
| -rwxr-xr-x | mltk | 2 | ||||
| -rwxr-xr-x | remote/setup_target | 10 |
4 files changed, 47 insertions, 31 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc index fb1c8382..9a3c5aff 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,27 @@ 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} || \ + pwarning "install_package: apt-get failed with '$IRET' for package '$PACKAGE_LIST'" + elif [ "x$PACKET_MANAGER" == "xzypper" ]; then + zypper --no-refresh --non-interactive install ${PACKAGE_LIST} || \ + pwarning "install_package: zypper failed with '$IRET' for package '$PACKAGE_LIST'" + else + pinfo "No packet manager determined, this should not happen!" fi } + # # copies static data files from <MODULE>/data/ to <TARGET_BUILD_DIR> # diff --git a/helper/kernel.inc b/helper/kernel.inc index 6901c4b4..70294357 100644 --- a/helper/kernel.inc +++ b/helper/kernel.inc @@ -114,14 +114,31 @@ copy_firmware() { local FIRMWARE_LIST="" for FIRMWARE in ${REQUIRED_FIRMWARE}; do local FOUND=0 + # check for firmware in the build directory of the kernel for CANDIDATE in "${FIRMWARE_DIR}/${FIRMWARE}" "${FIRMWARE_DIR}/${KERNEL_NEW_VERSION}/${FIRMWARE}"; do if [ -e "${CANDIDATE}" ]; then - pdebug "Copying '${CANDIDATE}'" + pdebug "Copying from kernel build dir: '${CANDIDATE}'" FIRMWARE_LIST+=" ${CANDIDATE}" FOUND=1 fi done + # if we didn't found it in the kernel build directory, check for firmware in the system firmware directory + if [ $FOUND -ne 1 ]; then + for CANDIDATE in "/${FIRMWARE_DIR}/${FIRMWARE}" "/${FIRMWARE_DIR}/${KERNEL_VERSION}/${FIRMWARE}"; do + if [ -e "${CANDIDATE}" ]; then + if [ $(echo "${CANDIDATE}" | grep -c "${KERNEL_VERSION}") -eq 0 ]; then + pdebug "Copying from system: '${CANDIDATE}'" + FIRMWARE_LIST+=" ${CANDIDATE}" + else + pdebug "Copying from system: '${CANDIDATE}' to ${FIRMWARE_DIR}/${KERNEL_NEW_VERSION}/${FIRMWARE}" + FIRMWARE_LIST+=" /${FIRMWARE_DIR}/${KERNEL_VERSION}/${FIRMWARE}" + fi + FOUND=1 + fi + done + fi + [ $FOUND -ne 1 ] && pwarning "Neither '${FIRMWARE_DIR}/${FIRMWARE}' nor '${FIRMWARE_DIR}/${KERNEL_NEW_VERSION}/${FIRMWARE}' "\ " was found on the system. Skipping. (might cause problems on certain clients!)" done @@ -131,6 +148,13 @@ copy_firmware() { pinfo "Copying $COUNT firmware to target directory." tarcopy "${FIRMWARE_LIST}" "${TARGET_BUILD_DIR}" fi + + # post-process to fix the path of the firmwares found on the system unter /lib/firmware/$(uname -r) + # which have to be copied to /lib/firmware/${KERNEL_NEW_VERSION} + mkdir -p "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_NEW_VERSION}/" + mv "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION}/"* "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_NEW_VERSION}/" + rmdir "${TARGET_BUILD_DIR}/lib/firmware/${KERNEL_VERSION}/" || perror "something went very wrong..." + cd - >/dev/null } @@ -22,7 +22,7 @@ MLTK_PID="$$" # Checking for needed development tools, compilers etc. # Required: m4 make gcc g++ binutils -DEVTOOLS="gcc c++ g++ make m4 strip" # 'strip' as marker for binutils +DEVTOOLS="gcc c++ g++ make m4 strip git locate depmod" # 'strip' as marker for binutils for i in $DEVTOOLS; do which "$i" 2>/dev/null 1>&2 || { echo "Essential development tool $i not found - exiting."; exit 1; } done diff --git a/remote/setup_target b/remote/setup_target index 286daf3a..46c1d978 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -7,18 +7,10 @@ MODULES_DIR="${MODE_DIR}/modules" PROCESSED_MODULES="" initial_checks () { - - # check for required tools - for BIN in git locate depmod - do - local TEST=$(which ${BIN}) - [ -z "$TEST" ] && pinfo "Installing $BIN..." && apt-get install $BIN - done - + : } read_config () { - # unset previous variables from other config files for VARNAME in ${!REQUIRED_*}; do unset $VARNAME |
