then
continue
fi
- good_msg "Attempting to mount media:- ${x}" ${CRYPT_SILENT}
+ good_msg "Attempting to mount media: ${x}" ${CRYPT_SILENT}
mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
if [ "$?" = '0' ]
DEVICES="$DEVICES /dev/mmcblk* /dev/mmcblk*/*"
# fallback scanning, this might scan something twice, but it's better than
# failing to boot.
- [ -e /proc/partitions ] && DEVICES="${DEVICES} $(awk -r '/([0-9]+[[:space:]]+)/{print "/dev/" $4}' /proc/partitions)"
+ [ -e /proc/partitions ] && DEVICES="${DEVICES} $(awk '/([0-9]+[[:space:]]+)/{print "/dev/" $4}' /proc/partitions)"
echo ${DEVICES}
}
cp -a ${CDROOT_PATH}/${LOOP} ${NEW_ROOT}/mnt/${LOOP}
if [ $? -ne 0 ]
then
- bad_msg "Failed to cache the loop file! Lack of space?"
+ warn_msg "Failed to cache the loop file! Lack of RAM?"
+ rm -rf ${NEW_ROOT}/mnt/${LOOP} 2>/dev/null
rm -rf ${NEW_ROOT}/mnt/livecd.* 2>/dev/null
rm -rf ${NEW_ROOT}/mnt/image.* 2>/dev/null
rm -rf ${NEW_ROOT}/mnt/zisofs 2>/dev/null
- else
- LOOPEXT='../'
fi
fi
fi
/bin/ash
}
-runmdev() {
+mount_devfs () {
# Use devtmpfs if enabled in kernel,
# else tmpfs. Always run mdev just in case
devfs=tmpfs
# http://git.busybox.net/busybox/plain/docs/mdev.txt
mkdir -m 0755 /dev/pts
mount -t devpts -o gid=5,mode=0620 devpts /dev/pts || bad_msg "Failed to mount /dev/pts"
- mdev -s || bad_msg "Failed to receive dynamic updates from mdev"
}
test_success() {
esac
}
-setup_hotplug() {
- if [ "${KV_2_6_OR_GREATER}" ]
- then
- echo /sbin/mdev > /proc/sys/kernel/hotplug
- fi
-}
-
setup_slowusb() {
# This function removes unset DO_slowusb if there is no usb-storage attached.
# If noslowusb is set, skip this function
done
}
-start_dev_mgr() {
- if [ "${KV_2_6_OR_GREATER}" ]
- then
- cd /sys
- good_msg 'Activating mdev'
- runmdev
- cd /
- fi
-}
-
cmdline_hwopts() {
# Scan CMDLINE for any "doscsi" or "noscsi"-type arguments
local FOUND
40|uk) keymap=uk ;;
41|us) keymap=us ;;
42|wangbe) keymap=wangbe ;;
+ 43|sf|ch*) keymap=sf ;;
esac
fi
if [ -e /lib/keymaps/${keymap}.map ]
# echo ${keymap} | egrep -e "[0-9]+" >/dev/null 2>&1
# if [ $? -eq 0 ]
# then
-# xkeymap=`tail -n 7 /lib/keymaps/keymapList | grep ${keymap} | sed -r "s/.*\s+${keymap}\s+([a-z-]+).*/\1/g" | egrep -v 1`
+# xkeymap=`tail -n 8 /lib/keymaps/keymapList | grep ${keymap} | sed -r "s/.*\s+${keymap}\s+([a-z-]+).*/\1/g" | egrep -v 1`
# fi
mkdir -p /etc/sysconfig
# echo "XKEYBOARD=${xkeymap}" > /etc/sysconfig/keyboard
if [ "${USE_MDADM}" = '1' ]
then
- /sbin/mdadm --assemble --scan
+ if [ -e '/sbin/mdadm' ]
+ then
+ /sbin/mdadm --assemble --scan
+ else
+ bad_msg "mdadm not found: skipping mdadm raid assembly!"
+ fi
fi
if [ "${USE_DMRAID_NORMAL}" = '1' ]
bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
fi
fi
+
+ if [ "${USE_ZFS}" = '1' ]
+ then
+ if [ -z "${ZFS_POOL}" ]
+ then
+ good_msg "Importing ZFS pools"
+
+ /sbin/zpool import -N -a "${ZPOOL_FORCE}"
+
+ if [ "$?" = '0' ]
+ then
+ good_msg "Importing ZFS pools succeeded"
+ else
+ bad_msg "Imported ZFS pools failed"
+ fi
+ else
+
+ if [ "$(zpool list -H -o name ${ZFS_POOL} 2>&1)" = "$ZFS_POOL" ]
+ then
+ good_msg "ZFS pool ${ZFS_POOL} already imported"
+ else
+ good_msg "Importing ZFS pool ${ZFS_POOL}"
+
+ /sbin/zpool import -N "${ZPOOL_FORCE}" "${ZFS_POOL}"
+
+ if [ "$?" = '0' ]
+ then
+ good_msg "Importing ${ZFS_POOL} succeeded"
+ else
+ bad_msg "Importing ${ZFS_POOL} failed"
+ fi
+ fi
+ fi
+ fi
}
startiscsi() {
fi
if [ "${retval}" -ne 0 ]; then
- REAL_LUKS=`blkid -l -t "${LUKS_DEVICE}" | cut -d ":" -f 1 2>/dev/null`
+ REAL_LUKS=`blkid -o device -l -t "${LUKS_DEVICE}"`
retval=$?
fi
fi
# At this point, keyfile or not, we're ready!
crypt_filter "${gpg_cmd}cryptsetup ${cryptsetup_options} luksOpen ${LUKS_DEVICE} ${LUKS_NAME}"
- if [ $? -eq 0 ]
+ crypt_filter_ret=$?
+
+ [ -e /dev/tty.org ] \
+ && rm -f /dev/tty \
+ && mv /dev/tty.org /dev/tty
+
+ if [ ${crypt_filter_ret} -eq 0 ]
then
good_msg "LUKS device ${LUKS_DEVICE} opened" ${CRYPT_SILENT}
break
fi
}
+do_rundebugshell() {
+ good_msg 'Type "exit" to continue with normal bootup.'
+ [ -x /bin/sh ] && /bin/sh || /bin/ash
+}
+
rundebugshell() {
if [ -n "$DEBUG" ]
then
good_msg 'Starting debug shell as requested by "debug" option.'
- good_msg 'Type "exit" to continue with normal bootup.'
- [ -x /bin/sh ] && /bin/sh || /bin/ash
+ do_rundebugshell
fi
}
' ${NEW_ROOT}/etc/initramfs.mounts
}
-get_mount_options()
+get_mount_fstype()
{
+ [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
awk -v fs="$1" '
/^[[:blank:]]*#/ { next }
$2 == fs { print $3 }
' ${NEW_ROOT}/etc/fstab
}
+get_mount_options()
+{
+ [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
+ awk -v fs="$1" '
+ /^[[:blank:]]*#/ { next }
+ $2 == fs { print $4 }
+ ' ${NEW_ROOT}/etc/fstab
+}
+
get_mount_device()
{
+ [ -e "${NEW_ROOT}"/etc/fstab ] || return 1
awk -v fs="$1" '
/^[[:blank:]]*#/ { next }
$2 == fs { print $1 }
' ${NEW_ROOT}/etc/fstab
}
+# If the kernel is handed a mount option is does not recognize, it WILL fail to
+# mount. util-linux handles auto/noauto, but busybox passes it straight to the kernel
+# which then rejects the mount.
+# To make like a little easier, busybox mount does not care about leading,
+# trailing or duplicate commas.
+strip_mount_options()
+{
+ sed -r 's/(,|^)(no)?auto(,|$)/,/g'
+}