| 1 |
#!/bin/bash |
| 2 |
# install images are specified with |
| 3 |
# root=install:CDLABEL=label |
| 4 |
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh |
| 5 |
|
| 6 |
[ -z "${root}" ] && root=$(getarg root=) |
| 7 |
|
| 8 |
if getargbool 0 rd.kiwi.install.pxe; then |
| 9 |
root="install:REMOTE" |
| 10 |
echo "rd.neednet=1" > /etc/cmdline.d/kiwi-generated.conf |
| 11 |
if ! getarg "ip="; then |
| 12 |
echo "ip=dhcp" >> /etc/cmdline.d/kiwi-generated.conf |
| 13 |
fi |
| 14 |
fi |
| 15 |
|
| 16 |
if [ "${root%%:*}" = "install" ] ; then |
| 17 |
installroot=${root} |
| 18 |
fi |
| 19 |
|
| 20 |
[ "${installroot%%:*}" = "install" ] || return 1 |
| 21 |
|
| 22 |
modprobe -q loop |
| 23 |
|
| 24 |
case "${installroot}" in |
| 25 |
install:CDLABEL=*|CDLABEL=*) \ |
| 26 |
root="${root#install:}" |
| 27 |
root="${root//\//\\x2f}" |
| 28 |
root="install:/dev/disk/by-label/${root#CDLABEL=}" |
| 29 |
rootok=1 ;; |
| 30 |
|
| 31 |
install:REMOTE) \ |
| 32 |
rootok=1 ;; |
| 33 |
esac |
| 34 |
|
| 35 |
[ "$rootok" = "1" ] || return 1 |
| 36 |
|
| 37 |
info "root was ${installroot}, is now ${root}" |
| 38 |
|
| 39 |
# make sure that init doesn't complain |
| 40 |
[ -z "${root}" ] && root="install" |
| 41 |
|
| 42 |
return 0 |