|
|
@ -1,4 +1,4 @@
|
|
|
|
#!/bin/ash
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
|
|
. /etc/initrd.defaults
|
|
|
|
. /etc/initrd.defaults
|
|
|
|
|
|
|
|
|
|
|
@ -169,7 +169,7 @@ findmediamount() {
|
|
|
|
# $2 = recognition file
|
|
|
|
# $2 = recognition file
|
|
|
|
# $3 = variable to have the device path
|
|
|
|
# $3 = variable to have the device path
|
|
|
|
# $4 = actual mount dir path (full path)
|
|
|
|
# $4 = actual mount dir path (full path)
|
|
|
|
# args remaining are possible devices
|
|
|
|
# args remaining are possible devices
|
|
|
|
|
|
|
|
|
|
|
|
local media=$1 recon=$2 vrbl=$3 mntdir=$4
|
|
|
|
local media=$1 recon=$2 vrbl=$3 mntdir=$4
|
|
|
|
shift 4
|
|
|
|
shift 4
|
|
|
@ -196,14 +196,14 @@ findmediamount() {
|
|
|
|
if [ -b "${x}" ]
|
|
|
|
if [ -b "${x}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
skip=0
|
|
|
|
skip=0
|
|
|
|
bsn=`basename "${x}"`
|
|
|
|
bsn=$(basename "${x}")
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# If disk and it has at least one partition, skip.
|
|
|
|
# If disk and it has at least one partition, skip.
|
|
|
|
# We use /sys/block/${bsn}/${bsn}[0-9]* to make sure that we
|
|
|
|
# We use /sys/block/${bsn}/${bsn}[0-9]* to make sure that we
|
|
|
|
# don't skip device mapper devices. Even the craziest scenario
|
|
|
|
# don't skip device mapper devices. Even the craziest scenario
|
|
|
|
# deserves a fair chance.
|
|
|
|
# deserves a fair chance.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
for part in `ls /sys/block/${bsn}/${bsn}*[0-9]* 2>/dev/null`
|
|
|
|
for part in $(ls /sys/block/${bsn}/${bsn}*[0-9]* 2>/dev/null)
|
|
|
|
do
|
|
|
|
do
|
|
|
|
skip=1
|
|
|
|
skip=1
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -282,7 +282,7 @@ bootstrapCD() {
|
|
|
|
|
|
|
|
|
|
|
|
bootstrapKey() {
|
|
|
|
bootstrapKey() {
|
|
|
|
# $1 = ROOT/SWAP
|
|
|
|
# $1 = ROOT/SWAP
|
|
|
|
local KEYDEVS=`devicelist`
|
|
|
|
local KEYDEVS=$(devicelist)
|
|
|
|
eval local keyloc='"${CRYPT_'${1}'_KEY}"'
|
|
|
|
eval local keyloc='"${CRYPT_'${1}'_KEY}"'
|
|
|
|
|
|
|
|
|
|
|
|
findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "/mnt/key" ${KEYDEVS}
|
|
|
|
findmediamount "key" "${keyloc}" "CRYPT_${1}_KEYDEV" "/mnt/key" ${KEYDEVS}
|
|
|
@ -328,27 +328,26 @@ mount_sysfs() {
|
|
|
|
findnfsmount() {
|
|
|
|
findnfsmount() {
|
|
|
|
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
|
|
|
|
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
|
|
|
|
then
|
|
|
|
then
|
|
|
|
[ -e /rootpath ] && NFSROOT=`cat /rootpath`
|
|
|
|
[ -e /rootpath ] && NFSROOT=$(cat /rootpath)
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${NFSROOT}" = '' ]
|
|
|
|
if [ "${NFSROOT}" = '' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
# Obtain NFSIP
|
|
|
|
# Obtain NFSIP
|
|
|
|
OPTIONS=`busybox dmesg | grep rootserver | sed -e "s/,/ /g"`
|
|
|
|
OPTIONS=$(busybox dmesg | grep rootserver | sed -e "s/,/ /g")
|
|
|
|
for OPTION in $OPTIONS
|
|
|
|
for OPTION in $OPTIONS
|
|
|
|
do
|
|
|
|
do
|
|
|
|
if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootserver' ]
|
|
|
|
if [ $(echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1) = 'rootserver' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
NFSIP=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`
|
|
|
|
NFSIP=$(echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Obtain NFSPATH
|
|
|
|
# Obtain NFSPATH
|
|
|
|
OPTIONS=`busybox dmesg | grep rootpath | sed -e "s/,/ /g"`
|
|
|
|
OPTIONS=$(busybox dmesg | grep rootpath | sed -e "s/,/ /g")
|
|
|
|
for OPTION in $OPTIONS
|
|
|
|
for OPTION in $OPTIONS
|
|
|
|
do
|
|
|
|
do
|
|
|
|
if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootpath' ]
|
|
|
|
if [ $(echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1) = 'rootpath' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
NFSPATH=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`
|
|
|
|
NFSPATH=$(echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
@ -383,7 +382,7 @@ findnfsmount() {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
bad_msg "NFS Mounting failed. Is the path corrent ?"
|
|
|
|
bad_msg "NFS Mounting failed. Is the path corrent ?"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
else
|
|
|
|
good_msg "Attempting to mount NFS root on ${NFSROOT} with options ${NFSOPTIONS}"
|
|
|
|
good_msg "Attempting to mount NFS root on ${NFSROOT} with options ${NFSOPTIONS}"
|
|
|
|
mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${NEW_ROOT}
|
|
|
|
mount -t nfs -o ${NFSOPTIONS} ${NFSROOT} ${NEW_ROOT}
|
|
|
|
if [ "$?" = '0' ]
|
|
|
|
if [ "$?" = '0' ]
|
|
|
@ -408,17 +407,17 @@ find_real_device() {
|
|
|
|
local retval=1
|
|
|
|
local retval=1
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${retval}" -ne 0 ]; then
|
|
|
|
if [ "${retval}" -ne 0 ]; then
|
|
|
|
REAL_DEVICE=`findfs "${DEVICE}" 2>/dev/null`
|
|
|
|
REAL_DEVICE=$(findfs "${DEVICE}" 2>/dev/null)
|
|
|
|
retval=$?
|
|
|
|
retval=$?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$retval" -ne 0 ]; then
|
|
|
|
if [ "$retval" -ne 0 ]; then
|
|
|
|
REAL_DEVICE=`busybox findfs "${DEVICE}" 2>/dev/null`
|
|
|
|
REAL_DEVICE=$(busybox findfs "${DEVICE}" 2>/dev/null)
|
|
|
|
retval=$?
|
|
|
|
retval=$?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${retval}" -ne 0 ]; then
|
|
|
|
if [ "${retval}" -ne 0 ]; then
|
|
|
|
REAL_DEVICE=`blkid -o device -l -t "${DEVICE}"`
|
|
|
|
REAL_DEVICE=$(blkid -o device -l -t "${DEVICE}")
|
|
|
|
retval=$?
|
|
|
|
retval=$?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
@ -433,11 +432,9 @@ find_real_device() {
|
|
|
|
check_loop() {
|
|
|
|
check_loop() {
|
|
|
|
if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ]
|
|
|
|
if [ "${LOOP}" = '' -o ! -e "${CDROOT_PATH}/${LOOP}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
|
|
|
|
|
|
|
|
bad_msg "Invalid loop location: ${LOOP}"
|
|
|
|
bad_msg "Invalid loop location: ${LOOP}"
|
|
|
|
bad_msg 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
|
|
|
|
bad_msg 'Please export LOOP with a valid location, or reboot and pass a proper loop=...'
|
|
|
|
bad_msg 'kernel command line!'
|
|
|
|
bad_msg 'kernel command line!'
|
|
|
|
|
|
|
|
|
|
|
|
run_shell
|
|
|
|
run_shell
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -487,7 +484,7 @@ mount_devfs () {
|
|
|
|
|
|
|
|
|
|
|
|
test_success() {
|
|
|
|
test_success() {
|
|
|
|
retcode=$?
|
|
|
|
retcode=$?
|
|
|
|
# If last command failed send error message and fall back to a shell
|
|
|
|
# If last command failed send error message and fall back to a shell
|
|
|
|
if [ "$retcode" != '0' ]
|
|
|
|
if [ "$retcode" != '0' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
error_string=$1
|
|
|
|
error_string=$1
|
|
|
@ -518,7 +515,7 @@ bad_msg() {
|
|
|
|
splashcmd verbose
|
|
|
|
splashcmd verbose
|
|
|
|
echo -e "${BAD}!!${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
|
|
|
|
echo -e "${BAD}!!${NORMAL}${BOLD} ${msg_string} ${NORMAL}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
warn_msg() {
|
|
|
|
warn_msg() {
|
|
|
|
msg_string=$1
|
|
|
|
msg_string=$1
|
|
|
@ -645,7 +642,7 @@ prompt_user(){
|
|
|
|
bad_msg '- type "q" to skip...'
|
|
|
|
bad_msg '- type "q" to skip...'
|
|
|
|
echo -n "${2}(${oldvalue}) :: "
|
|
|
|
echo -n "${2}(${oldvalue}) :: "
|
|
|
|
read ${1}
|
|
|
|
read ${1}
|
|
|
|
case `eval echo '$'${1}` in
|
|
|
|
case $(eval echo '$'${1}) in
|
|
|
|
'q')
|
|
|
|
'q')
|
|
|
|
eval ${1}'='${oldvalue}
|
|
|
|
eval ${1}'='${oldvalue}
|
|
|
|
warn_msg "Skipping step, this will likely cause a boot failure."
|
|
|
|
warn_msg "Skipping step, this will likely cause a boot failure."
|
|
|
@ -677,7 +674,7 @@ cmdline_hwopts() {
|
|
|
|
MY_HWOPTS="${MY_HWOPTS} $x"
|
|
|
|
MY_HWOPTS="${MY_HWOPTS} $x"
|
|
|
|
elif [ "${y}" = "no${x}" ]
|
|
|
|
elif [ "${y}" = "no${x}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
MY_HWOPTS="`echo ${MY_HWOPTS} | sed -e \"s/${x}//g\" -`"
|
|
|
|
MY_HWOPTS="$(echo ${MY_HWOPTS} | sed -e \"s/${x}//g\" -)"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ "$(echo ${y} | cut -b -7)" = "keymap=" ]
|
|
|
|
if [ "$(echo ${y} | cut -b -7)" = "keymap=" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
@ -685,23 +682,22 @@ cmdline_hwopts() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Shouldnt need to sort this as the following loop should figure out the
|
|
|
|
# Shouldnt need to sort this as the following loop should figure out the
|
|
|
|
# duplicates and strip them out
|
|
|
|
# duplicates and strip them out
|
|
|
|
#MY_HWOPTS=`echo ${MY_HWOPTS}| sort`
|
|
|
|
#MY_HWOPTS=$(echo ${MY_HWOPTS}| sort)
|
|
|
|
|
|
|
|
|
|
|
|
for x in ${MY_HWOPTS}
|
|
|
|
for x in ${MY_HWOPTS}
|
|
|
|
do
|
|
|
|
do
|
|
|
|
FOUND=0
|
|
|
|
FOUND=0
|
|
|
|
for y in ${TMP_HWOPTS}
|
|
|
|
for y in ${TMP_HWOPTS}
|
|
|
|
do
|
|
|
|
do
|
|
|
|
if [ "${y}" = "${x}" ]
|
|
|
|
if [ "${y}" = "${x}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
continue 2
|
|
|
|
continue 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
TMP_HWOPTS="${TMP_HWOPTS} ${x}"
|
|
|
|
TMP_HWOPTS="${TMP_HWOPTS} ${x}"
|
|
|
|
eval DO_`echo ${x} | sed 's/-//'`=1
|
|
|
|
eval DO_$(echo ${x} | sed 's/-//')=1
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
MY_HWOPTS=${TMP_HWOPTS}
|
|
|
|
MY_HWOPTS=${TMP_HWOPTS}
|
|
|
@ -736,7 +732,7 @@ setup_keymap() {
|
|
|
|
[ -f /lib/keymaps/keymapList ] && chooseKeymap
|
|
|
|
[ -f /lib/keymaps/keymapList ] && chooseKeymap
|
|
|
|
|
|
|
|
|
|
|
|
[ "${DEVBIND}" = '1' ] && umount /dev
|
|
|
|
[ "${DEVBIND}" = '1' ] && umount /dev
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e /etc/sysconfig/keyboard -a "${CDROOT}" = '1' ]
|
|
|
|
if [ -e /etc/sysconfig/keyboard -a "${CDROOT}" = '1' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
mkdir -p ${NEW_ROOT}/etc/sysconfig/
|
|
|
|
mkdir -p ${NEW_ROOT}/etc/sysconfig/
|
|
|
@ -827,7 +823,7 @@ startVolumes() {
|
|
|
|
mkdir -p /dev/mapper
|
|
|
|
mkdir -p /dev/mapper
|
|
|
|
ln -sf /dev/device-mapper /dev/mapper/control
|
|
|
|
ln -sf /dev/device-mapper /dev/mapper/control
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${USE_MDADM}" = '1' ]
|
|
|
|
if [ "${USE_MDADM}" = '1' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
if [ -e '/sbin/mdadm' ]
|
|
|
|
if [ -e '/sbin/mdadm' ]
|
|
|
@ -838,15 +834,15 @@ startVolumes() {
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
|
|
|
|
if [ "${USE_MULTIPATH_NORMAL}" = '1' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
good_msg "Scanning for multipath devices"
|
|
|
|
good_msg "Scanning for multipath devices"
|
|
|
|
/sbin/multipath -v 0
|
|
|
|
/sbin/multipath -v 0
|
|
|
|
sleep 2
|
|
|
|
sleep 2
|
|
|
|
good_msg "Activating multipath devices"
|
|
|
|
good_msg "Activating multipath devices"
|
|
|
|
/sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -v"
|
|
|
|
/sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -a -v"
|
|
|
|
#for MULTIPATH_VOLUMES in /dev/mapper/*; do kpartx -a $MULTIPATH_VOLUMES; done
|
|
|
|
#for MULTIPATH_VOLUMES in /dev/mapper/*; do kpartx -a $MULTIPATH_VOLUMES; done
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${USE_DMRAID_NORMAL}" = '1' ]
|
|
|
|
if [ "${USE_DMRAID_NORMAL}" = '1' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
@ -899,7 +895,7 @@ startVolumes() {
|
|
|
|
bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
|
|
|
|
bad_msg "vgscan or vgchange not found: skipping LVM volume group activation!"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${USE_ZFS}" = '1' ]
|
|
|
|
if [ "${USE_ZFS}" = '1' ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
if [ -z "${ZFS_POOL}" ]
|
|
|
|
if [ -z "${ZFS_POOL}" ]
|
|
|
@ -1005,7 +1001,7 @@ startiscsi() {
|
|
|
|
# $1 - root/swap
|
|
|
|
# $1 - root/swap
|
|
|
|
openLUKS() {
|
|
|
|
openLUKS() {
|
|
|
|
# please use 'tr' and this line, or remove it
|
|
|
|
# please use 'tr' and this line, or remove it
|
|
|
|
# eval local TYPE=`uppercase $1`
|
|
|
|
# eval local TYPE=$(uppercase $1)
|
|
|
|
|
|
|
|
|
|
|
|
case $1 in
|
|
|
|
case $1 in
|
|
|
|
root)
|
|
|
|
root)
|
|
|
@ -1058,10 +1054,10 @@ openLUKS() {
|
|
|
|
cryptsetup_options="${cryptsetup_options} --allow-discards"
|
|
|
|
cryptsetup_options="${cryptsetup_options} --allow-discards"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ -n "${LUKS_KEY}" ]
|
|
|
|
if [ -n "${LUKS_KEY}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
local REAL_LUKS_KEYDEV="${LUKS_KEYDEV}"
|
|
|
|
local REAL_LUKS_KEYDEV="${LUKS_KEYDEV}"
|
|
|
|
if [ ! -e "${mntkey}${LUKS_KEY}" ]
|
|
|
|
if [ ! -e "${mntkey}${LUKS_KEY}" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
REAL_LUKS_KEYDEV=$(find_real_device "${LUKS_KEYDEV}")
|
|
|
|
REAL_LUKS_KEYDEV=$(find_real_device "${LUKS_KEYDEV}")
|
|
|
|
if [ -b "${REAL_LUKS_KEYDEV}" ]
|
|
|
|
if [ -b "${REAL_LUKS_KEYDEV}" ]
|
|
|
@ -1155,9 +1151,7 @@ openLUKS() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
startLUKS() {
|
|
|
|
startLUKS() {
|
|
|
|
|
|
|
|
|
|
|
|
# if key is set but key device isn't, find it
|
|
|
|
# if key is set but key device isn't, find it
|
|
|
|
|
|
|
|
|
|
|
|
[ -n "${CRYPT_ROOT_KEY}" ] && [ -z "${CRYPT_ROOT_KEYDEV}" ] \
|
|
|
|
[ -n "${CRYPT_ROOT_KEY}" ] && [ -z "${CRYPT_ROOT_KEYDEV}" ] \
|
|
|
|
&& sleep 6 && bootstrapKey "ROOT"
|
|
|
|
&& sleep 6 && bootstrapKey "ROOT"
|
|
|
|
|
|
|
|
|
|
|
@ -1238,10 +1232,10 @@ setup_md_device() {
|
|
|
|
[ -z "$1" ] && device="${REAL_ROOT}" || device="$1"
|
|
|
|
[ -z "$1" ] && device="${REAL_ROOT}" || device="$1"
|
|
|
|
[ -z "${device}" ] && return # LiveCD
|
|
|
|
[ -z "${device}" ] && return # LiveCD
|
|
|
|
|
|
|
|
|
|
|
|
if [ `echo ${device}|sed -e 's#\(luks:\)\?\(/dev/md\)[[:digit:]]\+#\2#'` = "/dev/md" ]
|
|
|
|
if [ $(echo ${device}|sed -e 's#\(luks:\)\?\(/dev/md\)[[:digit:]]\+#\2#') = "/dev/md" ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
good_msg 'Detected real_root as a md device. Setting up the device node...'
|
|
|
|
good_msg 'Detected real_root as a md device. Setting up the device node...'
|
|
|
|
MD_NUMBER=`echo ${device}|sed -e 's#\(luks:\)\?/dev/md\([[:digit:]]\+\)#\2#'`
|
|
|
|
MD_NUMBER=$(echo ${device}|sed -e 's#\(luks:\)\?/dev/md\([[:digit:]]\+\)#\2#')
|
|
|
|
if [ ! -e /dev/md${MD_NUMBER} ]
|
|
|
|
if [ ! -e /dev/md${MD_NUMBER} ]
|
|
|
|
then
|
|
|
|
then
|
|
|
|
mknod /dev/md${MD_NUMBER} b 9 ${MD_NUMBER} >/dev/null 2>&1
|
|
|
|
mknod /dev/md${MD_NUMBER} b 9 ${MD_NUMBER} >/dev/null 2>&1
|
|
|
|