#!/bin/sh -e version="$1" if [ -f /boot/uEnv.txt ] ; then # passing the kernel version is required if [ -z "${version}" ]; then echo >&2 "W: zz-uenv_txt: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number" exit 2 fi unset older_kernel older_kernel=$(grep uname_r /boot/uEnv.txt | grep -v '#' | awk -F"=" '{print $2}' || true) if [ ! "x${older_kernel}" = "x" ] ; then if [ ! "x${older_kernel}" = "x${version}" ] ; then echo "zz-uenv_txt: Updating /boot/uEnv.txt [uname_r=${version}]" sed -i -e 's:uname_r='${older_kernel}':uname_r='${version}':g' /boot/uEnv.txt fi else echo "uname_r=${version}" >> /boot/uEnv.txt fi fi