Commit patch for bug #139866 by Martin Parm.

git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@417 67a159dc-881f-0410-a524-ba9dfbe2cb84
cleanup-cruft
Tim Yamin 19 years ago
parent a57ccf07e7
commit 2376b18742

@ -10,7 +10,7 @@ set_bootloader() {
} }
set_grub_bootloader() { set_grub_bootloader() {
local GRUB_CONF='/boot/grub/grub.conf' local GRUB_CONF='${BOOTDIR}/grub/grub.conf'
print_info 1 '' print_info 1 ''
print_info 1 "Adding kernel to $GRUB_CONF..." print_info 1 "Adding kernel to $GRUB_CONF..."
@ -20,9 +20,9 @@ set_grub_bootloader() {
else else
# Extract block device information from /etc/fstab # Extract block device information from /etc/fstab
GRUB_ROOTFS=$(awk '/^[^#].+[[:space:]]\/[[:space:]]/ { print $1 }' /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 [ "x$GRUB_BOOTFS" == 'x' ] && GRUB_BOOTFS=$GRUB_ROOTFS
fi fi
@ -70,8 +70,8 @@ EOF
fi fi
echo >> $GRUB_CONF echo >> $GRUB_CONF
else else
print_error 1 'Error! /boot/grub/grub.conf does not exist and the correct settings can not be automatically detected.' 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 /boot/grub/grub.conf file.' print_error 1 'Please manually create your ${BOOTDIR}/grub/grub.conf file.'
fi fi
else else
# grub.conf already exists; so... # grub.conf already exists; so...

@ -63,8 +63,9 @@ longusage() {
echo " --utils-arch=<arch> Force to arch for utils only instead of" echo " --utils-arch=<arch> Force to arch for utils only instead of"
echo " autodetect." echo " autodetect."
echo " --makeopts=<makeopts> Make options such as -j2, etc..." echo " --makeopts=<makeopts> Make options such as -j2, etc..."
echo " --mountboot Mount /boot automatically" echo " --mountboot Mount BOOTDIR automatically if mountable"
echo " --no-mountboot Don't mount /boot automatically" echo " --no-mountboot Don't mount BOOTDIR automatically"
echo " --bootdir=<dir> Set the location of the boot-directory, default is /boot"
echo " Initialization" echo " Initialization"
echo " --bootsplash=<theme> Force bootsplash using <theme>" echo " --bootsplash=<theme> Force bootsplash using <theme>"
echo " --gensplash=<theme> Force gensplash using <theme>" echo " --gensplash=<theme> Force gensplash using <theme>"
@ -193,6 +194,10 @@ parse_cmdline() {
CMD_MOUNTBOOT=0 CMD_MOUNTBOOT=0
print_info 2 "CMD_MOUNTBOOT: $CMD_MOUNTBOOT" print_info 2 "CMD_MOUNTBOOT: $CMD_MOUNTBOOT"
;; ;;
--bootdir=*)
BOOTDIR=`parse_opt "$*"`
print_info 2 "BOOTDIR: $BOOTDIR"
;;
--do-keymap-auto) --do-keymap-auto)
CMD_DOKEYMAPAUTO=1 CMD_DOKEYMAPAUTO=1
print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO" print_info 2 "CMD_DOKEYMAPAUTO: $CMD_DOKEYMAPAUTO"

@ -295,14 +295,14 @@ compile_kernel() {
fi fi
if ! isTrue "${CMD_NOINSTALL}" if ! isTrue "${CMD_NOINSTALL}"
then then
cp "${KERNEL_BINARY}" "/boot/kernel-${KNAME}-${ARCH}-${KV}" || cp "${KERNEL_BINARY}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||
gen_die 'Could not copy the kernel binary to /boot!' gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
cp "System.map" "/boot/System.map-${KNAME}-${ARCH}-${KV}" || cp "System.map" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" ||
gen_die 'Could not copy System.map to /boot!' gen_die 'Could not copy System.map to ${BOOTDIR}!'
if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ] if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
then then
cp "${KERNEL_BINARY_2}" "/boot/kernelz-${KV}" || cp "${KERNEL_BINARY_2}" "${BOOTDIR}/kernelz-${KV}" ||
gen_die 'Could not copy the kernelz binary to /boot!' gen_die 'Could not copy the kernelz binary to ${BOOTDIR}!'
fi fi
else else
cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" || cp "${KERNEL_BINARY}" "${TMPDIR}/kernel-${KNAME}-${ARCH}-${KV}" ||

@ -177,6 +177,14 @@ determine_real_args() {
UTILS_CROSS_COMPILE="${CMD_UTILS_CROSS_COMPILE}" UTILS_CROSS_COMPILE="${CMD_UTILS_CROSS_COMPILE}"
fi 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_DIR=`arch_replace "${CACHE_DIR}"`
CACHE_CPIO_DIR="${CACHE_DIR}/cpio" CACHE_CPIO_DIR="${CACHE_DIR}/cpio"
BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"` BUSYBOX_BINCACHE=`cache_replace "${BUSYBOX_BINCACHE}"`

@ -252,7 +252,7 @@ has_loop() {
isBootRO() 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 do
if [ "x${mo}x" == "xrox" ] if [ "x${mo}x" == "xrox" ]
then then

@ -663,8 +663,8 @@ create_initramfs() {
then then
if [ "${GENERATE_Z_IMAGE}" != '1' ] if [ "${GENERATE_Z_IMAGE}" != '1' ]
then then
cp ${TMPDIR}/initramfs-${KV} /boot/initramfs-${KNAME}-${ARCH}-${KV} || cp ${TMPDIR}/initramfs-${KV} ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ||
gen_die 'Could not copy the initramfs to /boot!' gen_die 'Could not copy the initramfs to ${BOOTDIR}!'
fi fi
fi fi
} }

@ -427,8 +427,8 @@ create_initrd() {
fi fi
if ! isTrue "${CMD_NOINSTALL}" if ! isTrue "${CMD_NOINSTALL}"
then then
cp ${TMPDIR}/initrd-${KV} /boot/initrd-${KNAME}-${ARCH}-${KV} || cp ${TMPDIR}/initrd-${KV} ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ||
gen_die 'Could not copy the initrd to /boot!' gen_die 'Could not copy the initrd to ${BOOTDIR}!'
fi fi
# Pegasos hack for merging the initrd into the kernel at compile time # Pegasos hack for merging the initrd into the kernel at compile time

@ -89,12 +89,12 @@ gen_kerncache()
gen_kerncache_extract_kernel() gen_kerncache_extract_kernel()
{ {
/bin/tar -f ${KERNCACHE} -C ${TEMP} -xj /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' ] if [ "${KERNEL_BINARY_2}" != '' -a "${GENERATE_Z_IMAGE}" = '1' ]
then 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 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() gen_kerncache_extract_modules()

@ -2,7 +2,7 @@
# Genkernel v3 # Genkernel v3
PATH="/bin:/usr/bin:/sbin:/usr/sbin" PATH="/bin:/usr/bin:/sbin:/usr/sbin"
GK_V='3.4.0_pre1' GK_V='3.4.0_pre2'
TMPDIR='/var/tmp/genkernel' TMPDIR='/var/tmp/genkernel'
TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$ TEMP=${TMPDIR}/$RANDOM.$RANDOM.$RANDOM.$$
@ -126,27 +126,29 @@ then
fi fi
fi fi
# Check /boot is mounted # Check BOOTDIR is mounted
if isTrue ${CMD_NOINSTALL} if isTrue ${CMD_NOINSTALL}
then then
isTrue ${MOUNTBOOT} && print_info 2 'Skipping automatic mount of boot' isTrue ${MOUNTBOOT} && print_info 2 'Skipping automatic mount of boot'
else else
if ! egrep -q ' /boot ' /proc/mounts [[ -d ${BOOTDIR} ]] || gen_die "${BOOTDIR} is not a directory"
if ! egrep -q ' ${BOOTDIR} ' /proc/mounts
then then
if egrep -q '^[^#].+ /boot ' /etc/fstab if egrep -q '^[^#].+[ \t]${BOOTDIR}[ \t]' /etc/fstab
then then
if isTrue ${MOUNTBOOT} if isTrue ${MOUNTBOOT}
then then
if ! mount /boot if ! mount ${BOOTDIR}
then then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount /boot!" print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount ${BOOTDIR}!"
echo echo
else else
print_info 1 'mount: /boot mounted successfully!' print_info 1 'mount: ${BOOTDIR} mounted successfully!'
fi fi
else else
print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted /boot partition detected!" print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted ${BOOTDIR} partition detected!"
print_warning 1 ' Run ``mount /boot`` to mount it!' print_warning 1 ' Run ``mount ${BOOTDIR}`` to mount it!'
echo echo
fi fi
fi fi
@ -154,12 +156,12 @@ else
then then
if isTrue ${MOUNTBOOT} if isTrue ${MOUNTBOOT}
then then
if ! mount -o remount,rw /boot if ! mount -o remount,rw ${BOOTDIR}
then then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to remount /boot RW!" print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to remount ${BOOTDIR} RW!"
echo echo
else else
print_info 1 "mount: /boot remounted read/write successfully!" print_info 1 "mount: ${BOOTDIR} remounted read/write successfully!"
BOOTRW=1 BOOTRW=1
fi fi
fi fi
@ -407,10 +409,10 @@ then
print_info 1 ' creating kernel name symlink!' print_info 1 ' creating kernel name symlink!'
if [ -e /boot/kernel-${KNAME}-${ARCH}-${KV} ] if [ -e ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ]
then then
/bin/rm /boot/kernel /bin/rm ${BOOTDIR}/kernel
ln -s /boot/kernel-${KNAME}-${ARCH}-${KV} /boot/kernel ln -s ${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/kernel
ret=$? ret=$?
[ ${ret} = '1' ] && print_error 1 'kernel link failed' [ ${ret} = '1' ] && print_error 1 'kernel link failed'
fi fi
@ -418,19 +420,19 @@ then
if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ] if [ "${KERN_24}" != '1' -a "${CMD_BOOTSPLASH}" != '1' ]
then then
print_info 1 ' creating initramfs name symlink!' print_info 1 ' creating initramfs name symlink!'
if [ -e /boot/initramfs-${KNAME}-${ARCH}-${KV} ] if [ -e ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ]
then then
/bin/rm /boot/initramfs /bin/rm ${BOOTDIR}/initramfs
ln -s /boot/initramfs-${KNAME}-${ARCH}-${KV} /boot/initramfs ln -s ${BOOTDIR}/initramfs-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initramfs
ret=$? ret=$?
[ ${ret} = '1' ] && print_error 1 'initramfs link failed' [ ${ret} = '1' ] && print_error 1 'initramfs link failed'
fi fi
else else
print_info 1 ' creating initrd name symlink!' print_info 1 ' creating initrd name symlink!'
if [ -e /boot/initrd-${KNAME}-${ARCH}-${KV} ] if [ -e ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ]
then then
/bin/rm /boot/initrd /bin/rm ${BOOTDIR}/initrd
ln -s /boot/initrd-${KNAME}-${ARCH}-${KV} /boot/initrd ln -s ${BOOTDIR}/initrd-${KNAME}-${ARCH}-${KV} ${BOOTDIR}/initrd
ret=$? ret=$?
[ ${ret} = '1' ] && print_error 1 'initrd link failed' [ ${ret} = '1' ] && print_error 1 'initrd link failed'
fi fi
@ -438,7 +440,7 @@ then
fi fi
[ "${BOOTRW}" != '' ] && mount -o remount,ro /boot [ "${BOOTRW}" != '' ] && mount -o remount,ro ${BOOTDIR}
echo echo
print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug' print_info 1 'Do NOT report kernel bugs as genkernel bugs unless your bug'

@ -20,7 +20,7 @@ BOOTSPLASH="yes"
# Override the arch detection? # Override the arch detection?
# ARCH_OVERRIDE="x86" # ARCH_OVERRIDE="x86"
# Mount /boot automatically if it isn't mounted? # Mount BOOTDIR automatically if it isn't mounted?
MOUNTBOOT="yes" MOUNTBOOT="yes"
# Save the new configuration in /etc/kernels upon # Save the new configuration in /etc/kernels upon
@ -45,6 +45,9 @@ USECOLOR="yes"
# %%ARCH%% - Final determined architecture # %%ARCH%% - Final determined architecture
# %%CACHE%% - Final determined cache location # %%CACHE%% - Final determined cache location
# Set the boot directory, default is /boot
#BOOTDIR="/boot"
# Default share directory location # Default share directory location
GK_SHARE="/usr/share/genkernel" GK_SHARE="/usr/share/genkernel"

Loading…
Cancel
Save