]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
From Yann Dirson <dirson@debian.org>:
authorrobertmh <robertmh@localhost>
Thu, 29 Apr 2004 19:45:11 +0000 (19:45 +0000)
committerrobertmh <robertmh@localhost>
Thu, 29 Apr 2004 19:45:11 +0000 (19:45 +0000)
        * util/mkbimage: Misc syntax fixes.

ChangeLog
util/mkbimage

index 717b2947582d6e6e60b2ecf40a96b683ddfc1d40..ca150f11bf9d8064355340c0ac14c9dd8ca18d52 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-29  Robert Millan  <robertmh@gnu.org>
+
+       From Yann Dirson  <dirson@debian.org>:
+       * util/mkbimage: Misc syntax fixes.
+
 2004-04-29  Jeroen Dekkers  <jeroen@dekkers.cx>
 
        * stage2/char_io.c (grub_memcmp): Define for stage1.5 too.
index ee132d38c908a03d45fcc5ef3254c3b9d9c29b52..52c229c04d7912981b0760f1e997fdfbde61819c 100644 (file)
@@ -178,9 +178,12 @@ mkbimage_cp ()
   esac
 
   if [ "$offset" = 0 ] && which $cp > /dev/null ; then
-    $mkdir ${image}:/boot
-    $mkdir ${image}:/boot/grub
-    $cp ${image}1/boot/grub/* ${image}:/boot/grub/
+    for dir in $(cd ${image}1 && find -type d) ; do
+       $mkdir ${image}:$dir
+    done
+    for file in $(cd ${image}1 && find -type f) ; do
+       $cp ${image}1/$file ${image}:$file
+    done
   elif [ "`id -u`" = "0" ] ; then
     losetup $lo_options /dev/loop1 $image
     mkdir ${image}.mnt
@@ -345,7 +348,7 @@ if [ "$image_type" = "hd" ]; then
 
 
 EOT
-  offset="-o $(($sectors * $block_size))" 
+  offset="$(($sectors * $block_size))" 
   type_option=
 else
   offset="0"
@@ -355,7 +358,8 @@ fi
 mkbimage_mkfs
 
 # then untar the files
-mkdir ${image}1 2>/dev/null
+[ ! -e ${image}1 ] || { echo "${image}1 exists, please remove it first"; exit 1;}
+mkdir -p ${image}1
 $decompress $tarfile | tar -C ${image}1 $debug -xf -
 
 # copy the untarred files into the filesystem image
@@ -364,7 +368,7 @@ mkbimage_cp
 #We verify that the stage2 exists and we search the name
 stage2_os_name=`find ${image}1 -name stage2 -type f`
 
-[ ! $stage2_os_name ] && { echo "I can't find stage2!"; exit 1;}
+[ -r "$stage2_os_name" ] || { echo "I can't find stage2!"; exit 1;}
 
 #------------------------- GRUB stuff
 if [ "$image_type" = "hd" ]; then
@@ -408,4 +412,6 @@ mkisofs -b <image> -hard-disk-boot -c boot.catalog -o raw.iso <dir>
 Enjoy!
 EOF
 
+rm -rf ${image}1
+
 exit 0