bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] grub-install --just-copy


From: Jeremy Katz
Subject: [PATCH] grub-install --just-copy
Date: Wed, 8 Aug 2001 02:03:54 -0400
User-agent: Mutt/1.2.5i

grub-install unfortunately relies upon df for doing its drive mappings
which is a bit unreliable if you're in an environment without an mtab.
This patch makes it so that grub-install can be used at least to just
install the stages into the grubdir

Index: ChangeLog
===================================================================
RCS file: /cvsroot/grub/grub/ChangeLog,v
retrieving revision 1.428
diff -u -r1.428 ChangeLog
--- ChangeLog   2001/08/08 05:17:20     1.428
+++ ChangeLog   2001/08/08 05:56:00
@@ -1,3 +1,8 @@
+2001-08-08  Jeremy Katz  <address@hidden>
+
+       * util/grub-install.in:
+       add --just-copy for just copying images to grubdir
+
 2001-08-08  OKUJI Yoshinori  <address@hidden>
 
        * util/grub-md5-crypt.in: Prefix backquotes with backslashes in
Index: util/grub-install.in
===================================================================
RCS file: /cvsroot/grub/grub/util/grub-install.in,v
retrieving revision 1.28
diff -u -r1.28 grub-install.in
--- util/grub-install.in        2001/07/13 11:51:24     1.28
+++ util/grub-install.in        2001/08/08 05:56:01
@@ -38,6 +38,7 @@
 force_lba=
 recheck=no
 debug=no
+justcopy=no
 
 # Usage: usage
 # Print the usage.
@@ -150,6 +151,17 @@
     fi
 }
 
+copy_images() {
+    # Copy the GRUB images to the GRUB directory.
+    for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
+       rm -f $file || exit 1
+    done
+    for file in \
+       ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do
+       cp -f $file ${grubdir} || exit 1
+    done
+}
+
 # Check the arguments.
 for option in "$@"; do
     case "$option" in
@@ -167,6 +179,8 @@
        force_lba="--force-lba" ;;
     --recheck)
        recheck=yes ;;
+    --just-copy)
+        justcopy=yes ;;
     # This is an undocumented feature...
     --debug)
        debug=yes ;;
@@ -180,12 +194,6 @@
     esac
 done
 
-if test "x$install_device" = x; then
-    echo "install_device not specified." 1>&2
-    usage
-    exit 1
-fi
-
 # If the debugging feature is enabled, print commands.
 if test $debug = yes; then
     set -x
@@ -196,6 +204,18 @@
 grubdir=${bootdir}/grub
 device_map=${grubdir}/device.map
 
+# if they just want the images copied, copy the images and then exit
+if test $justcopy = yes; then
+    copy_images
+    exit 0
+fi
+
+if test "x$install_device" = x; then
+    echo "install_device not specified." 1>&2
+    usage
+    exit 1
+fi
+
 # Check if GRUB is installed
 if test -f "$grub_shell"; then
     :
@@ -299,14 +319,7 @@
     exit 1
 fi
 
-# Copy the GRUB images to the GRUB directory.
-for file in ${grubdir}/stage1 ${grubdir}/stage2 ${grubdir}/*stage1_5; do
-    rm -f $file || exit 1
-done
-for file in \
-    ${pkgdatadir}/stage1 ${pkgdatadir}/stage2 ${pkgdatadir}/*stage1_5; do
-    cp -f $file ${grubdir} || exit 1
-done
+copy_images
 
 # Create a safe temporary file.
 test -x /bin/tempfile && log_file=`tempfile --prefix=grub`




reply via email to

[Prev in Thread] Current Thread [Next in Thread]