From 2f80039de84cca2bd69fe8d657b1975306928347 Mon Sep 17 00:00:00 2001 From: robertmh Date: Thu, 10 Jan 2008 13:52:24 +0000 Subject: [PATCH] 2008-01-10 Robert Millan * util/update-grub_lib.in (grub_file_is_not_garbage): New function. Determines if a file is garbage left by packaging systems, etc. * util/update-grub.in: Use grub_file_is_not_garbage() as a condition for processing /etc/grub.d scripts. * util/grub.d/10_hurd.in: Fix `GRUB_DISTRIBUTOR' comparison. * util/grub.d/10_linux.in: Likewise. Use grub_file_is_not_garbage() as a condition for processing Linux images. --- ChangeLog | 10 ++++++++++ util/grub.d/10_hurd.in | 4 ++-- util/grub.d/10_linux.in | 9 ++++++--- util/update-grub.in | 4 ++-- util/update-grub_lib.in | 12 ++++++++++++ 5 files changed, 32 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0392f89e3..bee07ab5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-01-10 Robert Millan + + * util/update-grub_lib.in (grub_file_is_not_garbage): New function. + Determines if a file is garbage left by packaging systems, etc. + * util/update-grub.in: Use grub_file_is_not_garbage() as a condition + for processing /etc/grub.d scripts. + * util/grub.d/10_hurd.in: Fix `GRUB_DISTRIBUTOR' comparison. + * util/grub.d/10_linux.in: Likewise. Use grub_file_is_not_garbage() + as a condition for processing Linux images. + 2008-01-10 Pavel Roskin * include/grub/powerpc/libgcc.h (__ucmpdi2): New export. Needed diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index 1ec222542..dac54b12b 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -1,7 +1,7 @@ #! /bin/sh -e # update-grub helper script. -# Copyright (C) 2006,2007 Free Software Foundation, Inc. +# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with GRUB. If not, see . -if [ "x${GRUB_DISTRIBUTOR}" = "" ] ; then +if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU else OS="${GRUB_DISTRIBUTOR} GNU/Hurd" diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 7aaed19f8..390f4f619 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -1,7 +1,7 @@ #! /bin/sh -e # update-grub helper script. -# Copyright (C) 2006,2007 Free Software Foundation, Inc. +# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,10 @@ # You should have received a copy of the GNU General Public License # along with GRUB. If not, see . -if [ "x${GRUB_DISTRIBUTOR}" = "" ] ; then +libdir=@libdir@ +. ${libdir}/grub/update-grub_lib + +if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then OS=GNU/Linux else OS="${GRUB_DISTRIBUTOR} GNU/Linux" @@ -74,7 +77,7 @@ find_latest () } list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do - if test -e $i ; then echo -n "$i " ; fi + if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` while [ "x$list" != "x" ] ; do diff --git a/util/update-grub.in b/util/update-grub.in index f60e6287c..7e33eee11 100644 --- a/util/update-grub.in +++ b/util/update-grub.in @@ -1,7 +1,7 @@ #! /bin/sh -e # Generate grub.cfg by inspecting /boot contents. -# Copyright (C) 2006,2007 Free Software Foundation, Inc. +# Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. # # GRUB is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -145,7 +145,7 @@ for i in ${update_grub_dir}/* ; do # emacsen backup files. FIXME: support other editors *~) ;; *) - if test -f "$i" && test -x "$i" ; then + if grub_file_is_not_garbage "$i" && test -x "$i" ; then echo echo "### BEGIN $i ###" "$i" diff --git a/util/update-grub_lib.in b/util/update-grub_lib.in index fd46f2103..7e5d4393f 100644 --- a/util/update-grub_lib.in +++ b/util/update-grub_lib.in @@ -113,3 +113,15 @@ font_path () return 1 } + +grub_file_is_not_garbage () +{ + if test -f "$1" ; then + case "$1" in + *.dpkg-dist|*.dpkg-old|*.dpkg-tmp) return 1 ;; # debian dpkg + esac + else + return 1 + fi + return 0 +}