Commit patch for bug #139866 by Martin Parm.
authorTim Yamin <plasmaroo@gentoo.org>
Tue, 11 Jul 2006 11:33:09 +0000 (11:33 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Tue, 11 Jul 2006 11:33:09 +0000 (11:33 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@417 67a159dc-881f-0410-a524-ba9dfbe2cb84

gen_bootloader.sh
gen_cmdline.sh
gen_compile.sh
gen_determineargs.sh
gen_funcs.sh
gen_initramfs.sh
gen_initrd.sh
gen_package.sh
genkernel
genkernel.conf

index 878abff7ab841f99583cc3e18ed399a64424214f..51ada96e9abc25d74f0f64c7f577235b2ae4c173 100644 (file)
@@ -10,7 +10,7 @@ set_bootloader() {
 }
 
 set_grub_bootloader() {
-       local GRUB_CONF='/boot/grub/grub.conf'
+       local GRUB_CONF='${BOOTDIR}/grub/grub.conf'
 
        print_info 1 ''
        print_info 1 "Adding kernel to $GRUB_CONF..."
@@ -20,9 +20,9 @@ set_grub_bootloader() {
        else    
                # Extract block device information from /etc/fstab
                GRUB_ROOTFS=$(awk '/^[^#].+[[:space:]]\/[[:space:]]/ { print $1 }' /etc/fstab)
-               GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\/boot[[:space:]]/ { print $1 }' /etc/fstab)
+               GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\${BOOTDIR}[[:space:]]/ { print $1 }' /etc/fstab)
 
-               # If /boot is not defined in /etc/fstab, it must be the same as /
+               # If ${BOOTDIR} is not defined in /etc/fstab, it must be the same as /
                [ "x$GRUB_BOOTFS" == 'x' ] && GRUB_BOOTFS=$GRUB_ROOTFS
        fi
 
@@ -70,8 +70,8 @@ EOF
                        fi
                        echo >> $GRUB_CONF
                else
-                       print_error 1 'Error! /boot/grub/grub.conf does not exist and the correct settings can not be automatically detected.'
-                       print_error 1 'Please manually create your /boot/grub/grub.conf file.'
+                       print_error 1 'Error! ${BOOTDIR}/grub/grub.conf does not exist and the correct settings can not be automatically detected.'
+                       print_error 1 'Please manually create your ${BOOTDIR}/grub/grub.conf file.'
                fi
        else
                # grub.conf already exists; so...
index 998378ac50fd62b6e315fcf1b24f6a9358fec64b..308028f12bd7aea0793787a8520cb191a8300b25 100755 (executable)
@@ -63,8 +63,9 @@ longusage() {
   echo "       --utils-arch=<arch>     Force to arch for utils only instead of"
   echo "                               autodetect."
   echo "       --makeopts=<makeopts>   Make options such as -j2, etc..."
-  echo "       --mountboot             Mount /boot automatically"
-  echo "       --no-mountboot          Don't mount /boot automatically"  
+  echo "       --mountboot             Mount BOOTDIR automatically if mountable"
+  echo "       --no-mountboot          Don't mount BOOTDIR automatically"  
+  echo "       --bootdir=<dir>         Set the location of the boot-directory, default is /boot"
   echo "  Initialization"
   echo "       --bootsplash=<theme>    Force bootsplash using <theme>"
   echo "       --gensplash=<theme>     Force gensplash using <theme>"
@@ -193,6 +194,10 @@ parse_cmdline() {
                      CMD_MOUNTBOOT=0
                      print_info 2 "CMD_MOUNTBOOT: $CMD_MOUNTBOOT"
              ;;
+             --bootdir=*)
+                     BOOTDIR=`parse_opt "$*"`
+                     print_info 2 "BOOTDIR: $BOOTDIR"
+             ;;
              --do-keymap-auto)
                      CMD_DOKEYMAPAUTO=1
                      print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO"
index 7a42ed8a5d25be7b65d26332188b576af5d0caff..dd6ea58ecf7895fa80d41a3ff8b0b133d0b7afac 100644 (file)
@@ -295,14 +295,14 @@ compile_kernel() {
        fi
        if ! isTrue "${CMD_NOINSTALL}"
        then
-               cp "${KERNEL_BINARY}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" ||
-                       gen_die 'Could not copy the kernel binary to /boot!'
-               cp "System.map" "/boot/System.map-${KNAME}-${ARCH}-${KV}" ||
-                       gen_die 'Could not copy System.map to /boot!'
+               cp "${KERNEL_BINARY}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
+                       gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
+               cp "System.map" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
+                       gen_die 'Could not copy System.map to ${BOOTDIR}!'
                if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
                then
-                       cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" ||
-                               gen_die 'Could not copy the kernelz binary to /boot!'
+                       cp "${KERNEL_BINARY_2}" "${BOOTDIR}/kernelz-${KV}" ||
+                               gen_die 'Could not copy the kernelz binary to ${BOOTDIR}!'
                fi
        else
                cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
index 93e5babee2c1246d99c5ec6cabc63c3969a93734..11e94d6e6d6b9a90f4cac7de8a917cb4958e1d7e 100644 (file)
@@ -177,6 +177,14 @@ determine_real_args() {
                UTILS_CROSS_COMPILE="${CMD_UTILS_CROSS_COMPILE}"
        fi
 
+       if [ "${BOOTDIR}" != '' ]
+       then
+               BOOTDIR=`arch_replace "${BOOTDIR}"`
+               BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash
+       else
+               BOOTDIR="/boot"
+       fi
+
        CACHE_DIR=`arch_replace "${CACHE_DIR}"`
        CACHE_CPIO_DIR="${CACHE_DIR}/cpio"
        BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`
index 79773399eaec5b946dbf246c5e0f55d860dcbc99..7143bef3a6ec84c873cf67b9fa7d2a9be7b8c02b 100755 (executable)
@@ -252,7 +252,7 @@ has_loop() {
 
 isBootRO()
 {
-       for mo in `grep ' /boot ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'`
+       for mo in `grep ' ${BOOTDIR} ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'`
        do
                if [ "x${mo}x" == "xrox" ]
                then
index 3b764d85b5c25339484e15b32d041c0ad1b41ec9..97bc315658b8cc8a1da83e1e4337c6d53c588618 100644 (file)
@@ -663,8 +663,8 @@ create_initramfs() {
        then
                if [ "${GENERATE_Z_IMAGE}" != '1' ]
                then
-                       cp ${TMPDIR}/initramfs-${KV} /boot/initramfs-${KNAME}-${ARCH}-${KV} ||
-                               gen_die 'Could not copy the initramfs to /boot!'
+                       cp ${TMPDIR}/initramfs-${KV} ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ||
+                               gen_die 'Could not copy the initramfs to ${BOOTDIR}!'
                fi
        fi
 }
index d2147dd95f07415b0f1a4e77b618a773952e2de9..7c7cc07658925f13033ebe69d4d4c0c51df8c90b 100644 (file)
@@ -427,8 +427,8 @@ create_initrd() {
        fi
        if ! isTrue "${CMD_NOINSTALL}"
        then
-               cp ${TMPDIR}/initrd-${KV} /boot/initrd-${KNAME}-${ARCH}-${KV} ||
-                       gen_die 'Could not copy the initrd to /boot!'
+               cp ${TMPDIR}/initrd-${KV} ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ||
+                       gen_die 'Could not copy the initrd to ${BOOTDIR}!'
        fi
 
        # Pegasos hack for merging the initrd into the kernel at compile time
index 86c8f752b04bcd37f97199e0f50985e27787305e..8f172f19eb6164683c0ed6596720f90a76acd233 100644 (file)
@@ -89,12 +89,12 @@ gen_kerncache()
 gen_kerncache_extract_kernel()
 {
                /bin/tar -f ${KERNCACHE} -C ${TEMP} -xj 
-       cp "${TEMP}/kernel-${ARCH}-${KV}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to /boot!'
+       cp "${TEMP}/kernel-${ARCH}-${KV}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
        if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
         then
-               cp "${TEMP}/kernelz-${ARCH}-${KV}" "/boot/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to /boot!'
+               cp "${TEMP}/kernelz-${ARCH}-${KV}" "${BOOTDIR}/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
         fi
-        cp "${TEMP}/System.map-${ARCH}-${KV}" "/boot/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to /boot!'
+        cp "${TEMP}/System.map-${ARCH}-${KV}" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to ${BOOTDIR}!'
 }
 
 gen_kerncache_extract_modules()
index 3706cc4b27db2fd1abc73256b6c558f241168be1..9bca48bf0527b7918ff5407429397a79a6a1ad52 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -2,7 +2,7 @@
 # Genkernel v3
 
 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
-GK_V='3.4.0_pre1'
+GK_V='3.4.0_pre2'
 
 TMPDIR='/var/tmp/genkernel'
 TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
@@ -126,27 +126,29 @@ then
        fi
 fi
 
-# Check /boot is mounted
+# Check BOOTDIR is mounted
 if isTrue ${CMD_NOINSTALL}
 then
        isTrue ${MOUNTBOOT} && print_info 2 'Skipping automatic mount of boot'
 else
-       if ! egrep -q ' /boot ' /proc/mounts
+       [[ -d ${BOOTDIR} ]] || gen_die "${BOOTDIR} is not a directory"
+       
+       if ! egrep -q ' ${BOOTDIR} ' /proc/mounts
        then
-               if egrep -q '^[^#].+    /boot   ' /etc/fstab
+               if egrep -q '^[^#].+[ \t]${BOOTDIR}[ \t]' /etc/fstab
                then
                        if isTrue ${MOUNTBOOT}
                        then
-                               if ! mount /boot
+                               if ! mount ${BOOTDIR}
                                then
-                                       print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!"
+                                       print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount ${BOOTDIR}!"
                                        echo
                                else
-                                       print_info 1 'mount: /boot mounted successfully!'
+                                       print_info 1 'mount: ${BOOTDIR} mounted successfully!'
                                fi
                        else
-                               print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted /boot partition detected!"
-                               print_warning 1 '         Run ``mount /boot`` to mount it!'
+                               print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted ${BOOTDIR} partition detected!"
+                               print_warning 1 '         Run ``mount ${BOOTDIR}`` to mount it!'
                                echo
                        fi
                fi
@@ -154,12 +156,12 @@ else
        then
                if isTrue ${MOUNTBOOT}
                then
-                       if ! mount -o remount,rw /boot
+                       if ! mount -o remount,rw ${BOOTDIR}
                        then
-                               print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to remount /boot RW!"
+                               print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to remount ${BOOTDIR} RW!"
                                echo
                        else
-                               print_info 1 "mount: /boot remounted read/write successfully!"
+                               print_info 1 "mount: ${BOOTDIR} remounted read/write successfully!"
                                BOOTRW=1
                        fi
                fi
@@ -407,10 +409,10 @@ then
     
     
     print_info 1 '         creating kernel name symlink!'
-    if [ -e /boot/kernel-${KNAME}-${ARCH}-${KV} ]
+    if [ -e ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ]
     then
-       /bin/rm /boot/kernel
-        ln -s /boot/kernel-${KNAME}-${ARCH}-${KV} /boot/kernel
+       /bin/rm ${BOOTDIR}/kernel
+        ln -s ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/kernel
         ret=$?
         [ ${ret} = '1' ] && print_error 1 'kernel link failed'
     fi
@@ -418,19 +420,19 @@ then
     if [ "${KERN_24}" != '1' -a  "${CMD_BOOTSPLASH}" != '1' ]
     then
        print_info 1 '      creating initramfs name symlink!'
-       if [ -e /boot/initramfs-${KNAME}-${ARCH}-${KV} ]
+       if [ -e ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ]
        then
-           /bin/rm /boot/initramfs
-           ln -s /boot/initramfs-${KNAME}-${ARCH}-${KV} /boot/initramfs
+           /bin/rm ${BOOTDIR}/initramfs
+           ln -s ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initramfs
            ret=$?
            [ ${ret} = '1' ] && print_error 1 'initramfs link failed'
        fi
     else
        print_info 1 '      creating initrd name symlink!'
-       if [ -e /boot/initrd-${KNAME}-${ARCH}-${KV} ]
+       if [ -e ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ]
        then
-           /bin/rm /boot/initrd
-           ln -s /boot/initrd-${KNAME}-${ARCH}-${KV} /boot/initrd
+           /bin/rm ${BOOTDIR}/initrd
+           ln -s ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initrd
            ret=$?
            [ ${ret} = '1' ] && print_error 1 'initrd link failed'
        fi
@@ -438,7 +440,7 @@ then
 fi
 
 
-[ "${BOOTRW}" != '' ] && mount -o remount,ro /boot
+[ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}
 
 echo
 print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug'
index 2bd868889135314a465d87f29e0cde8d73c2a410..d0f857a94cc5ce3d2d431eab242e858b9c4f44ab 100755 (executable)
@@ -20,7 +20,7 @@ BOOTSPLASH="yes"
 # Override the arch detection?
 # ARCH_OVERRIDE="x86"
 
-# Mount /boot automatically if it isn't mounted?
+# Mount BOOTDIR automatically if it isn't mounted?
 MOUNTBOOT="yes"
 
 # Save the new configuration in /etc/kernels upon
@@ -45,6 +45,9 @@ USECOLOR="yes"
 #   %%ARCH%%  - Final determined architecture
 #   %%CACHE%% - Final determined cache location
 
+# Set the boot directory, default is /boot
+#BOOTDIR="/boot"
+
 # Default share directory location
 GK_SHARE="/usr/share/genkernel"