Bug#583695: update-initramfs: bind variables before use
Initialize local variables before use to avoid hard-to-debug problems
when they happen to be set in the environment. These can cause initramfs-tools to error out since 0.95~29 (update-initramfs: Use nounset, 2010-04-07). Closes: #583695 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- update-initramfs | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/update-initramfs b/update-initramfs index 33c568b..a49ea20 100755 --- a/update-initramfs +++ b/update-initramfs @@ -7,6 +7,8 @@ KPKGCONF=/etc/kernel-img.conf USETRIGGERS=true mode="" version="" +update_initramfs=yes +backup_initramfs=no set -eu @@ -26,7 +28,7 @@ fi usage() { - if [ -n "${1}" ]; then + if [ -n "${1:+set}" ]; then printf "${*} " >&2 fi cat >&2 << EOF @@ -61,7 +63,7 @@ chrooted() mild_panic() { - if [ -n "${1}" ]; then + if [ -n "${1:+set}" ]; then printf "${*} " >&2 fi exit 0 @@ -69,7 +71,7 @@ mild_panic() panic() { - if [ -n "${1}" ]; then + if [ -n "${1:+set}" ]; then printf "${*} " >&2 fi exit 1 @@ -127,6 +129,7 @@ backup_booted_initramfs() fi # keep booted initramfs + boot_initramfs= uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime) if [ -n "$uptime_days" ]; then boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days}) @@ -295,6 +298,7 @@ set_current_version() set_linked_version() { + linktarget= if [ -e /initrd.img ] && [ -L /initrd.img ]; then linktarget="$(basename "$(readlink /initrd.img)")" fi @@ -313,6 +317,10 @@ set_linked_version() set_highest_version() { get_sorted_versions + if [ -z "${version_list}" ]; then + version= + return + fi set -- ${version_list} version=${1} } -- 1.7.1 -- To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 20100530071841.GC31469@progeny.tock">http://lists.debian.org/20100530071841.GC31469@progeny.tock |
| All times are GMT. The time now is 08:14 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.