case "${ARGUMENT}" in
skipconfig)
NOACCESSIBILITY="Yes"
- NOAUTOLOGIN="Yes"
- NOCONSOLEKEYBOARD="Yes"
NOFASTBOOT="Yes"
NOFSTAB="Yes"
NONETWORKING="Yes"
- NOXAUTOCONFIG="Yes"
- export NOACCESSIBILITY NOAUTOLOGIN NOCONSOLEKEYBOARD NOFASTBOOT NOFSTAB NONETWORKING NOXAUTOCONFIG
+ export NOACCESSIBILITY NOFASTBOOT NOFSTAB NONETWORKING
;;
access=*)
ethdevice=*)
DEVICE="${ARGUMENT#ethdevice=}"
- export DEVICE
- ;;
-
- ethdevice=*)
- ETHDEVICE="${ARGUMENT#ethdevice=}"
- export ETHDEVICE
+ ETHDEVICE="${DEVICE}"
+ export DEVICE ETHDEVICE
;;
ethdevice-timeout=*)
httpfs=*)
HTTPFS="${ARGUMENT#httpfs=}"
export HTTPFS
+ ;;
+
+ iscsi=*)
+ ISCSI="${ARGUMENT#iscsi=}"
+ #ip:port - separated by ;
+ ISCSI_PORTAL="${ISCSI%;*}"
+ if echo "${ISCSI_PORTAL}" | grep -q , ; then
+ ISCSI_SERVER="${ISCSI_PORTAL%,*}"
+ ISCSI_PORT="${ISCSI_PORTAL#*,}"
+ fi
+ #target name
+ ISCSI_TARGET="${ISCSI#*;}"
+ export ISCSI ISCSI_PORTAL ISCSI_TARGET ISCSI_SERVER ISCSI_PORT
;;
isofrom=*|fromiso=*)
export NOACCESSIBILITY
;;
- noautologin)
- NOAUTOLOGIN="Yes"
- export NOAUTOLOGIN
- ;;
-
nofastboot)
NOFASTBOOT="Yes"
export NOFASTBOOT
export SWAPON
;;
- noxautoconfig)
- NOXAUTOCONFIG="Yes"
- export NOXAUTOCONFIG
- ;;
-
persistent)
PERSISTENT="Yes"
export PERSISTENT
UNIONTYPE="${ARGUMENT#union=}"
export UNIONTYPE
;;
-
- xdebconf)
- XDEBCONF="Yes"
- export XDEBCONF
- ;;
-
- xdriver=*)
- XDRIVER="${ARGUMENT#xdriver=}"
- export XDRIVER
- ;;
-
- xvideomode=*)
- XVIDEOMODE="${ARGUMENT#xvideomode=}"
- export XVIDEOMODE
- ;;
esac
done
return 0
}
-do_netmount ()
+do_netsetup ()
{
modprobe -q af_packet # For DHCP
[ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
export HOSTNAME
+ if [ -n "${DEVICE}" ]
+ then
+ HWADDR="$(cat /sys/class/net/${DEVICE}/address)"
+ fi
+
# Check if we have a network device at all
if ! ls /sys/class/net/"$DEVICE" > /dev/null 2>&1 && \
! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
then
panic "No supported network device found, maybe a non-mainline driver is required."
fi
+}
+
+do_netmount()
+{
+ do_netsetup
if [ "${NFSROOT}" = "auto" ]
then
return ${rc}
}
+do_iscsi()
+{
+ do_netsetup
+ #modprobe ib_iser
+ modprobe iscsi_tcp
+ local debugopt=""
+ [ "${DEBUG}" == "Yes" ] && debugopt="-d 8"
+ #FIXME this name is supposed to be unique - some date + ifconfig hash?
+ ISCSI_INITIATORNAME="iqn.1993-08.org.debian.live:01:$(echo "${HWADDR}" | sed -e s/://g)"
+ export ISCSI_INITIATORNAME
+ if [ -n "${ISCSI_SERVER}" ] ; then
+ iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_SERVER}" -p "${ISCSI_PORT}"
+ else
+ iscsistart $debugopt -i "${ISCSI_INITIATORNAME}" -t "${ISCSI_TARGET}" -g 1 -a "${ISCSI_PORTAL}" -p 3260
+ fi
+ if [ $? != 0 ]
+ then
+ panic "Failed to log into iscsi target"
+ fi
+ local host="$(ls -d /sys/class/scsi_host/host*/device/iscsi_host:host* \
+ /sys/class/scsi_host/host*/device/iscsi_host/host* | sed -e 's:/device.*::' -e 's:.*host::')"
+ if [ -n "${host}" ]
+ then
+ local devices=""
+ local i=0
+ while [ -z "${devices}" -a $i -lt 60 ]
+ do
+ sleep 1
+ devices="$(ls -d /sys/class/scsi_device/${host}*/device/block:* \
+ /sys/class/scsi_device/${host}*/device/block/* | sed -e 's!.*[:/]!!')"
+ i=$(expr $i + 1)
+ echo -ne $i\\r
+ done
+ for dev in $devices
+ do
+ if check_dev "null" "/dev/$dev"
+ then
+ NETBOOT="iscsi"
+ export NETBOOT
+ return 0;
+ fi
+ done
+ panic "Failed to locate a live device on iSCSI devices (tried: $devices)."
+ else
+ panic "Failed to locate iSCSI host in /sys"
+ fi
+}
+
do_httpmount ()
{
rc=1
fi
modprobe fuse
$FUSE_MOUNT "${url}" "${dest}"
+ FUSE_PID="$(minips h -C "$FUSE_MOUNT" | { read x y ; echo "$x" ; } )"
fi
[ ${?} -eq 0 ] && rc=0
[ "${extension}" = "tgz" ] && live_dest="ram"
elif [ "${webfile}" != "FETCH" ] ; then
NETBOOT="${webfile}"
export NETBOOT
+ if [ -n "${FUSE_PID}" ] ; then
+ echo "${FUSE_PID}" > ${mountpoint}/root.pid
+ fi
fi
return ${rc}
snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
- RES=""
if ! try_mount "${snapdev}" "${snapback}" "ro"
then
break
fi
+ RES="0"
+
if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|ext4\|jffs2\)'
then
# squashfs, jffs2 or ext2/ext3/ext4 snapshot
dev=$(get_backing_device "${snapback}/${snapfile}")
do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
- RES=$?
+ RES="$?"
else
# cpio.gz snapshot
cpioargs='--unconditional --make-directories'
fi
- if ! (cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | cpio $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null)
+ cd "${snap_mount}" && zcat "${snapback}/${snapfile}" | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse 2>/dev/null
+ RES="$?"
+
+ if [ "${RES}" != "0" ]
then
- log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | cpio $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\""
+ log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | $cpiopath $cpioargs --extract --preserve-modification-time --no-absolute-filenames --sparse\""
fi
fi
fi
done
elif [ "${fstype}" = "squashfs" -o \
+ "${fstype}" = "btrfs" -o \
"${fstype}" = "ext2" -o \
"${fstype}" = "ext3" -o \
"${fstype}" = "ext4" -o \
panic "Unable to find a live file system on the network"
fi
else
- if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
+ if [ -n "${ISCSI_PORTAL}" ]
+ then
+ do_iscsi && livefs_root="${mountpoint}"
+ elif [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
then
# Do a local boot from hd
livefs_root=${ROOT}
else
+ if [ -x /usr/bin/memdiskfind ]
+ then
+ MEMDISK=$(/usr/bin/memdiskfind)
+
+ if [ $? -eq 0 ]
+ then
+ # We found a memdisk, set up phram
+ modprobe phram phram=memdisk,${MEMDISK}
+
+ # Load mtdblock, the memdisk will be /dev/mtdblock0
+ modprobe mtdblock
+ fi
+ fi
+
# Scan local devices for the image
i=0
while [ "$i" -lt 60 ]