}
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..."
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
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...
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>"
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"
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}" ||
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}"`
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
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
}
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
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()
# 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.$$
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
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
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
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
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'
# 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
# %%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"