diff options
Diffstat (limited to 'remote/modules/kernel/kernel.build')
| -rw-r--r-- | remote/modules/kernel/kernel.build | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index dc789b36..e755023e 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -2,11 +2,13 @@ fetch_source() { # get the source according to the distro if [ "x$PACKET_MANAGER" == "xapt" ]; then pdebug "apt-ing kernel source" - apt-get source linux-image-${KERNEL_VERSION} - [ ! -e ksrc ] && ln -s $(ls -d linux-*/) ksrc + apt-get install -y dpkg-dev || perror "Installing dpkg-dev failed." + apt-get source linux-image-${KERNEL_VERSION} || perror "Fetching kernel source failed." + [ -z "$(ls -d linux-*/)" ] && perror "Source directory not found." + [ ! -e ksrc ] && ln -s "$(ls -d linux-*/)" "ksrc" elif [ "x$PACKET_MANAGER" == "xzypper" ]; then pdebug "zypping kernel source" - zypper --no-refresh install -y kernel-source + zypper --no-refresh install -y kernel-source || perror "Fetching kernel source failed." # find src directory local SOURCE_DIR=$(rpm -ql kernel-source |grep -E -o '^/.*src/linux-[^/]+/' |head -1) @@ -37,7 +39,7 @@ build() { # make kernel with the new config cd ksrc || perror "Could not cd to ksrc, was the kernel source fetched properly?" pinfo "Preparing kernel for new config ('make oldconfig')" - yes n | make oldconfig || perror "make oldconfig failed" + yes "" | make oldconfig || perror "make oldconfig failed" pinfo "Compiling kernel... (this will take some time)" make || perror "make failed" @@ -71,18 +73,19 @@ update_config() { cp "$BASE_CONFIG_FILE" "$TARGET_CONFIG_FILE" for WANTED_CONFIG in $(cat $OPENSLX_WANTED_CONFIG|sort -u); do - local CONFIG_PARAM_NAME=$(echo $WANTED_CONFIG | awk -F "=" '{print $1}') - local SEARCH_RESULT=$(grep "^$CONFIG_PARAM_NAME=" "$BASE_CONFIG_FILE") + local CONFIG_PARAM_NAME="$(echo $WANTED_CONFIG | awk -F "=" '{print $1}')" + local SEARCH_RESULT="$(grep -E "^\s*$(echo "$CONFIG_PARAM_NAME" | escape_search)=" "$BASE_CONFIG_FILE")" #echo "Process: $SEARCH_RESULT" # analyse results if [ "x$SEARCH_RESULT" == "x" ]; then # no match, add it - echo $WANTED_CONFIG >> $TARGET_CONFIG_FILE + sed -i -r "s/^\s*#.*\s$(echo "$CONFIG_PARAM_NAME" | escape_search)[^_A-Z0-9].*$//" "$TARGET_CONFIG_FILE" + echo "$WANTED_CONFIG" >> "$TARGET_CONFIG_FILE" else # match, change to our setting if they differ - if [ "x${SEARCH_RESULT: -1}" != "x${WANTED_CONFIG: -1}" ]; then - sed -i "s/$SEARCH_RESULT/$WANTED_CONFIG/" "$TARGET_CONFIG_FILE" + if [ "x$SEARCH_RESULT" != "x$WANTED_CONFIG" ]; then + sed -i "s/$(echo "$SEARCH_RESULT" | escape_search)/$(echo "$WANTED_CONFIG" | escape_replace)/" "$TARGET_CONFIG_FILE" fi fi done |
