Kaydet (Commit) e34291af authored tarafından Your Name's avatar Your Name

boot=live düzeltildi

üst 611c261c
if [ -t 0 ] && [ "$nocolor" == "false" ] ;then
if [ -t 0 ] && [ "$nocolor" != "true" ] ;then
C_BLACK='\e[1;30m'
C_RED='\e[1;31m'
C_GREEN='\e[1;32m'
......
......@@ -31,7 +31,7 @@ mount_handler(){
parse_cmdline(){
for i in $(cat /proc/cmdline)
do
export $i
export $i || true
done
}
......@@ -74,7 +74,8 @@ detect_root(){
/dev/* ) device=$root ;;
UUID=* ) eval $root; device="/dev/disk/by-uuid/$UUID" ;;
LABEL=*) eval $root; device="/dev/disk/by-label/$LABEL" ;;
"" ) err "No root device specified."
"" ) [ "$boot" == "live" ] && return 0
err "No root device specified."
echo -ne "\033[33;1m * Where is the root > \033[;0m"
while read root
do
......
......@@ -9,11 +9,12 @@ common_boot(){
mount --move /run /rootfs/run
}
live_boot(){
[ "$sfs" == "" ] && sfs="/main.sfs"
list=$(ls /sys/class/block/ | grep ".*[0-9]$" | grep -v loop | grep -v ram | grep -v nbd | sed "s|^|/dev/|g")
for part in $list
do
debug "Looking for $part"
if is_file_avaiable "$part" "main.sfs"
if is_file_avaiable "$part" "${sfs}"
then
debug "Detected live media: $part"
export root=$part
......@@ -21,19 +22,19 @@ live_boot(){
done
mkdir -p /root/a # upper
mkdir -p /root/b # workdir
mkdir -p /live_root/
mkdir -p /rootfs/
mkdir -p /source/ # lower
mkdir -p /output
debug "Mounting live media"
mount -t auto $root /output
mount /output/main.sfs /source
mount /output/${sfs} /source
umount /root/a 2>/dev/null
umount /root/b 2>/dev/null
debug "Creating overlayfs"
mount -t overlay -o lowerdir=/source/,upperdir=/root/a/,workdir=/root/b overlay /rootfs
mount -t tmpfs -o size=100% none /root/a
mount -t tmpfs -o size=100% none /root/b
common_boot
common_boot || fallback_shell
}
normal_boot(){
debug "Mounting rootfs"
......@@ -54,24 +55,23 @@ normal_boot(){
mkdir -p /rootfs/$i
mount --bind /newroot/$i /rootfs/$i
done
common_boot
common_boot || fallback_shell
}
classic_boot(){
debug "Mounting rootfs"
mkdir -p /rootfs
mount -t auto $root /rootfs
common_boot
common_boot || fallback_shell
}
if [ "$boot" == "live" ]; then
msg "Booting from live-media"
live_boot
fi
if [ "$boot" == "normal" ]; then
live_boot || fallback_shell
elif [ "$boot" == "normal" ]; then
msg "Booting from $root"
normal_boot
normal_boot || fallback_shell
else
msg "Booting from $root (classic)"
classic_boot
classic_boot || fallback_shell
fi
if [ -f /new_root/etc/os-release ]; then
msg "Wellcome to $(cat /new_root/etc/os-release | grep '^NAME=' | head -n 1 | sed 's/^.*=//g')"
else
msg "Wellcome to GNU/Linux..."
fi
[ -d "/new_root/$subdir" ] || subdir="/"
[ -d "/rootfs/$subdir" ] || subdir="/"
debug "Subdir=$subdir"
[ "$init" != "" ] || init=/sbin/init
debug "init=$init"
if [ -f /new_root/$subdir/etc/initrd.local ]; then
if [ -f /rootfs/$subdir/etc/os-release ]; then
msg "Wellcome to ${C_PURPLE}$(cat /rootfs/$subdir/etc/os-release | grep '^NAME=' | head -n 1 | sed 's/^.*=//g')$C_CLEAR"
else
msg "Wellcome to ${C_PURPLE}GNU/Linux...${C_CLEAR}"
fi
sleep 2
if [ -f /rootfs/$subdir/etc/initrd.local ]; then
inf "Running local initrd scripts"
. /new_root/$subdir/etc/initrd.local || true
. /rootfs/$subdir/etc/initrd.local || true
fi
debug "Switching root"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment