Browse Source

Lower-case uname -r output in kernel autoremove helper

This is needed on FreeBSD which has versions like 11.0-RC1,
otherwise the tests would fail.
Julian Andres Klode 7 years ago
parent
commit
15134a8e54
2 changed files with 3 additions and 3 deletions
  1. 1 1
      debian/apt.auto-removal.sh
  2. 2 2
      test/integration/test-kernel-helper-autoremove

+ 1 - 1
debian/apt.auto-removal.sh

@@ -25,7 +25,7 @@ debverlist="$(echo "$list" | cut -d' ' -f 2 | sort --unique --reverse --version-
 if [ -n "$1" ]; then
 	installed_version="$(echo "$list" | awk "\$1 == \"$1\" { print \$2;exit; }")"
 fi
-unamer="$(uname -r)"
+unamer="$(uname -r | tr '[A-Z]' '[a-z]')"
 if [ -n "$unamer" ]; then
 	running_version="$(echo "$list" | awk "\$1 == \"$unamer\" { print \$2;exit; }")"
 fi

+ 2 - 2
test/integration/test-kernel-helper-autoremove

@@ -6,7 +6,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")"
 setupenvironment
 configarchitecture 'amd64'
 
-CURRENTKERNEL="linux-image-$(uname -r)"
+CURRENTKERNEL="linux-image-$(uname -r | tr '[A-Z]' '[a-z]')"
 insertinstalledpackage "$CURRENTKERNEL" 'amd64' '5-1'
 # debug packages do not need our protection
 insertinstalledpackage "${CURRENTKERNEL}-dbg" 'amd64' '5-1'
@@ -49,7 +49,7 @@ testprotected() {
 	testsuccess --nomsg grep '^\^linux-image-100\\\.0\\\.0-1-generic\$$' protected.list
 
 	msgtest 'Check kernel autoremoval protection list includes' 'running kernel'
-	testsuccess --nomsg grep "^\\^linux-image-$(uname -r | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list
+	testsuccess --nomsg grep "^\\^linux-image-$(uname -r | tr '[A-Z]' '[a-z]' | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list
 
 	msgtest 'Check kernel autoremoval protection list does not include' 'metapackages'
 	testfailure --nomsg grep -e '^\^linux-image-amd64\$$' -e '^\^linux-image-686-pae\$$' -e ':i386' protected.list