mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-02 15:37: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_part() {
|
||||||
# Mount a local or network filesystem
|
# Mount a local or network filesystem
|
||||||
# $1:[TYPE=]target, $2:mountpoint, $3:mount options, [$4:fs type]
|
# $1:[TYPE=]target, $2:mountpoint, $3:mount options, [$4:fs type]
|
||||||
MOUNT_TARGET="${1#*=}"
|
|
||||||
|
|
||||||
progress "mount filesystem $1 ..."
|
progress "mount filesystem $1 ..."
|
||||||
|
|
||||||
|
MOUNT_TARGET="${1#*=}"
|
||||||
case $1 in
|
case $1 in
|
||||||
LABEL=*|UUID=*|/*)
|
LABEL=*|UUID=*|/*)
|
||||||
MOUNT_CMD="mount_common"
|
MOUNT_CMD="mount_common"
|
||||||
@ -222,6 +222,7 @@ NBD_DEVS="0"
|
|||||||
|
|
||||||
load_modules() {
|
load_modules() {
|
||||||
progress "Loading kernel modules"
|
progress "Loading kernel modules"
|
||||||
|
|
||||||
[ ! -f "/etc/modules" ] && return
|
[ ! -f "/etc/modules" ] && return
|
||||||
for module in $(cat /etc/modules); do
|
for module in $(cat /etc/modules); do
|
||||||
progress "Loading kernel module $module"
|
progress "Loading kernel module $module"
|
||||||
@ -232,6 +233,7 @@ NBD_DEVS="0"
|
|||||||
|
|
||||||
check_disks() {
|
check_disks() {
|
||||||
progress "Checking disks"
|
progress "Checking disks"
|
||||||
|
|
||||||
if [ -x /sbin/fsck_hfs ]; then
|
if [ -x /sbin/fsck_hfs ]; then
|
||||||
# deal with hfs partitions
|
# deal with hfs partitions
|
||||||
hfsdiskprep
|
hfsdiskprep
|
||||||
@ -240,14 +242,15 @@ NBD_DEVS="0"
|
|||||||
|
|
||||||
mount_disks() {
|
mount_disks() {
|
||||||
progress "Mounting 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 :`
|
OVERLAY_DIR=`cat /sys/class/net/eth0/address | /bin/busybox tr -d :`
|
||||||
if [ ! -d /storage/$OVERLAY_DIR ]; then
|
|
||||||
mkdir /storage/$OVERLAY_DIR
|
mount_part "$disk" "/storage" "rw,noatime"
|
||||||
fi
|
mkdir -p /storage/$OVERLAY_DIR
|
||||||
/bin/busybox umount /storage
|
/bin/busybox umount /storage
|
||||||
|
|
||||||
# split $disk into $target,$options so we can append $OVERLAY_DIR
|
# split $disk into $target,$options so we can append $OVERLAY_DIR
|
||||||
@ -258,12 +261,15 @@ NBD_DEVS="0"
|
|||||||
else
|
else
|
||||||
disk="$target/$OVERLAY_DIR,$options"
|
disk="$target/$OVERLAY_DIR,$options"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
mount_part "$disk" "/storage" "rw,noatime"
|
mount_part "$disk" "/storage" "rw,noatime"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
check_update() {
|
check_update() {
|
||||||
progress "Checking for updates"
|
progress "Checking for updates"
|
||||||
|
|
||||||
if [ -f "/flash/MACH_KERNEL" ]; then
|
if [ -f "/flash/MACH_KERNEL" ]; then
|
||||||
IMAGE_KERNEL="MACH_KERNEL"
|
IMAGE_KERNEL="MACH_KERNEL"
|
||||||
fi
|
fi
|
||||||
@ -288,7 +294,10 @@ NBD_DEVS="0"
|
|||||||
# /flash is actual root filesystem
|
# /flash is actual root filesystem
|
||||||
/bin/busybox mount --move /flash /sysroot
|
/bin/busybox mount --move /flash /sysroot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$disk" ]; then
|
||||||
/bin/busybox mount --move /storage /sysroot/storage
|
/bin/busybox mount --move /storage /sysroot/storage
|
||||||
|
fi
|
||||||
|
|
||||||
[ -f "/sysroot/sbin/init" ] || error "final_check" "Could not find system."
|
[ -f "/sysroot/sbin/init" ] || error "final_check" "Could not find system."
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user