mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-02 07:27:49 +00:00
busybox-initramfs: init: cleanup, improve readability
Use consistent whitespace for all `progress "..."` lines. Don't mount $disk if it is not set (e.g. in the installer). Don't check for /storage/$OVERLAY_DIR, just create it. Move the overlay functionality into an if statement. Don't move /storage if $disk is not set (e.g. in the installer). Signed-off-by: Alain Kalker <a.c.kalker@gmail.com>
This commit is contained in:
parent
56b29979f6
commit
16a3f22836
@ -168,9 +168,9 @@ NBD_DEVS="0"
|
||||
mount_part() {
|
||||
# Mount a local or network filesystem
|
||||
# $1:[TYPE=]target, $2:mountpoint, $3:mount options, [$4:fs type]
|
||||
MOUNT_TARGET="${1#*=}"
|
||||
|
||||
progress "mount filesystem $1 ..."
|
||||
|
||||
MOUNT_TARGET="${1#*=}"
|
||||
case $1 in
|
||||
LABEL=*|UUID=*|/*)
|
||||
MOUNT_CMD="mount_common"
|
||||
@ -222,6 +222,7 @@ NBD_DEVS="0"
|
||||
|
||||
load_modules() {
|
||||
progress "Loading kernel modules"
|
||||
|
||||
[ ! -f "/etc/modules" ] && return
|
||||
for module in $(cat /etc/modules); do
|
||||
progress "Loading kernel module $module"
|
||||
@ -232,6 +233,7 @@ NBD_DEVS="0"
|
||||
|
||||
check_disks() {
|
||||
progress "Checking disks"
|
||||
|
||||
if [ -x /sbin/fsck_hfs ]; then
|
||||
# deal with hfs partitions
|
||||
hfsdiskprep
|
||||
@ -240,14 +242,15 @@ NBD_DEVS="0"
|
||||
|
||||
mount_disks() {
|
||||
progress "Mounting disks"
|
||||
mount_part "$boot" "/flash" "ro,noatime"
|
||||
mount_part "$disk" "/storage" "rw,noatime"
|
||||
|
||||
[ -z "$OVERLAY" ] && return
|
||||
mount_part "$boot" "/flash" "ro,noatime"
|
||||
|
||||
if [ -n "$disk" ]; then
|
||||
if [ -n "$OVERLAY" ]; then
|
||||
OVERLAY_DIR=`cat /sys/class/net/eth0/address | /bin/busybox tr -d :`
|
||||
if [ ! -d /storage/$OVERLAY_DIR ]; then
|
||||
mkdir /storage/$OVERLAY_DIR
|
||||
fi
|
||||
|
||||
mount_part "$disk" "/storage" "rw,noatime"
|
||||
mkdir -p /storage/$OVERLAY_DIR
|
||||
/bin/busybox umount /storage
|
||||
|
||||
# split $disk into $target,$options so we can append $OVERLAY_DIR
|
||||
@ -258,12 +261,15 @@ NBD_DEVS="0"
|
||||
else
|
||||
disk="$target/$OVERLAY_DIR,$options"
|
||||
fi
|
||||
fi
|
||||
|
||||
mount_part "$disk" "/storage" "rw,noatime"
|
||||
fi
|
||||
}
|
||||
|
||||
check_update() {
|
||||
progress "Checking for updates"
|
||||
|
||||
if [ -f "/flash/MACH_KERNEL" ]; then
|
||||
IMAGE_KERNEL="MACH_KERNEL"
|
||||
fi
|
||||
@ -288,7 +294,10 @@ NBD_DEVS="0"
|
||||
# /flash is actual root filesystem
|
||||
/bin/busybox mount --move /flash /sysroot
|
||||
fi
|
||||
|
||||
if [ -n "$disk" ]; then
|
||||
/bin/busybox mount --move /storage /sysroot/storage
|
||||
fi
|
||||
|
||||
[ -f "/sysroot/sbin/init" ] || error "final_check" "Could not find system."
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user