}
set_grub_bootloader() {
- local GRUB_CONF='${BOOTDIR}/grub/grub.conf'
+ local GRUB_CONF="${BOOTDIR}/grub/grub.conf"
print_info 1 ''
print_info 1 "Adding kernel to $GRUB_CONF..."
GRUB_BOOTFS=${BOOTFS}
else
# Extract block device information from /etc/fstab
- GRUB_ROOTFS=$(awk '/^[^#].+[[:space:]]\/[[:space:]]/ { print $1 }' /etc/fstab)
- GRUB_BOOTFS=$(awk '/^[^#].+[[:space:]]\${BOOTDIR}[[:space:]]/ { print $1 }' /etc/fstab)
+ GRUB_ROOTFS=$(awk 'BEGIN{RS="((#[^\n]*)?\n)"}( $2 == "/" ) { print $1; exit }' /etc/fstab)
+ GRUB_BOOTFS=$(awk 'BEGIN{RS="((#[^\n]*)?\n)"}( $2 == "'${BOOTDIR}'") { print $1; exit }' /etc/fstab)
# If ${BOOTDIR} is not defined in /etc/fstab, it must be the same as /
[ "x$GRUB_BOOTFS" == 'x' ] && GRUB_BOOTFS=$GRUB_ROOTFS
fi
echo >> $GRUB_CONF
else
- 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.'
+ 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...
isBootRO()
{
- for mo in `grep ' ${BOOTDIR} ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'`
- do
- if [ "x${mo}x" == "xrox" ]
- then
- return 0
- fi
- done
- return 1
+ return $(awk '( $2 == "'${BOOTDIR}'" && $4 ~ /(^|,)ro(,|$)/){ I=1; exit }END{print !I }' /proc/mounts);
}
setup_cache_dir()
gen_kerncache_extract_kernel()
{
/bin/tar -f ${KERNCACHE} -C ${TEMP} -xj
- cp "${TEMP}/kernel-${ARCH}-${KV}" "${BOOTDIR}/kernel-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
+ 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}" "${BOOTDIR}/kernelz-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy the kernel binary to ${BOOTDIR}!'
+ 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}" "${BOOTDIR}/System.map-${KNAME}-${ARCH}-${KV}" || gen_die 'Could not copy System.map to ${BOOTDIR}!'
+ 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()
else
[[ -d ${BOOTDIR} ]] || gen_die "${BOOTDIR} is not a directory"
- if ! egrep -q ' ${BOOTDIR} ' /proc/mounts
+ if ! egrep -q "[[:space:]]${BOOTDIR}[[:space:]]" /proc/mounts
then
- if egrep -q '^[^#].+[ \t]${BOOTDIR}[ \t]' /etc/fstab
+ if egrep -q "^[^#].+[[:space:]]${BOOTDIR}[[:space:]]" /etc/fstab
then
if isTrue ${MOUNTBOOT}
then
print_warning 1 "${BOLD}WARNING${NORMAL}: Failed to mount ${BOOTDIR}!"
echo
else
- print_info 1 'mount: ${BOOTDIR} mounted successfully!'
+ print_info 1 "mount: ${BOOTDIR} mounted successfully!"
fi
else
print_warning 1 "${BOLD}WARNING${NORMAL}: No mounted ${BOOTDIR} partition detected!"
- print_warning 1 ' Run ``mount ${BOOTDIR}`` to mount it!'
+ print_warning 1 " Run ``mount ${BOOTDIR}`` to mount it!"
echo
fi
fi