[no ci] Overlay: script formatting

pull/1268/head
Viktor 2024-01-20 05:34:36 +01:00
parent af7d7371c5
commit 81070ca72a
3 changed files with 47 additions and 47 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh
case "$1" in
start)
start)
system_fb
;;
;;
esac

View File

@ -1,8 +1,8 @@
#!/bin/sh
on_exit() {
mountpoint -q /proc && umount /proc
exec /sbin/init $*
mountpoint -q /proc && umount /proc
exec /sbin/init $*
}
trap on_exit 0
@ -11,43 +11,43 @@ mount -t proc proc /proc || exit
grep -q overlay /proc/filesystems || exit
if ! grep -q 'root=.*nfs\|mmcblk\|ram' /proc/cmdline; then
if grep -q ubifs /proc/cmdline; then
mount -t ubifs ubi0:rootfs_data /overlay
else
mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/')
mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1)
mount -t jffs2 /dev/${mtdblkdev} /overlay
if grep -q ubifs /proc/cmdline; then
mount -t ubifs ubi0:rootfs_data /overlay
else
mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/')
mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1)
mount -t jffs2 /dev/${mtdblkdev} /overlay
if [ $? -ne 0 ] || { dmesg | grep "jffs2.*: Magic bitmask.*not found" >/dev/null 2>&1; }; then
echo "jffs2 health check error, format required!"
flash_eraseall -j /dev/${mtdchrdev}
echo "Done! Remounting..."
mount -t jffs2 /dev/${mtdblkdev} /overlay || mount -t tmpfs tmpfs /overlay || exit
if ! cat /proc/mounts | grep ${mtdblkdev}; then
echo "--------------------------------"
echo "Crash - your flash in the trash!"
echo "--------------------------------"
fi
fi
fi
if [ $? -ne 0 ] || { dmesg | grep "jffs2.*: Magic bitmask.*not found" >/dev/null 2>&1; }; then
echo "jffs2 health check error, format required!"
flash_eraseall -j /dev/${mtdchrdev}
echo "Done! Remounting..."
mount -t jffs2 /dev/${mtdblkdev} /overlay || mount -t tmpfs tmpfs /overlay || exit
if ! cat /proc/mounts | grep ${mtdblkdev}; then
echo "--------------------------------"
echo "Crash - your flash in the trash!"
echo "--------------------------------"
fi
fi
fi
if grep -q overlayfs /proc/filesystems; then
mount -t overlayfs overlayfs -o lowerdir=/,upperdir=/overlay,ro /mnt || {
umount /overlay
exit
}
else
overlay_rootdir=/overlay/root
overlay_workdir=/overlay/work
mkdir -p ${overlay_rootdir} ${overlay_workdir}
mount -t overlay overlay -o lowerdir=/,upperdir=${overlay_rootdir},workdir=${overlay_workdir} /mnt || {
umount /overlay
exit
}
fi
if grep -q overlayfs /proc/filesystems; then
mount -t overlayfs overlayfs -o lowerdir=/,upperdir=/overlay,ro /mnt || {
umount /overlay
exit
}
else
overlay_rootdir=/overlay/root
overlay_workdir=/overlay/work
mkdir -p ${overlay_rootdir} ${overlay_workdir}
mount -t overlay overlay -o lowerdir=/,upperdir=${overlay_rootdir},workdir=${overlay_workdir} /mnt || {
umount /overlay
exit
}
fi
pivot_root /mnt /mnt/rom
mount -o noatime,move /rom/proc /proc
mount -o noatime,move /rom/dev /dev
mount -o noatime,move /rom/overlay /overlay
pivot_root /mnt /mnt/rom
mount -o noatime,move /rom/proc /proc
mount -o noatime,move /rom/dev /dev
mount -o noatime,move /rom/overlay /overlay
fi

View File

@ -3,8 +3,8 @@
# Get the timezone from the u-boot environment variable
timezone=$(fw_printenv -n timezone 2>/dev/null)
if [ -z "$timezone" ]; then
echo "Timezone env variable not found, using system default."
exit 1
echo "Timezone env variable not found, using system default."
exit 1
fi
echo "User defined timezone: $timezone"
@ -14,15 +14,15 @@ current_timezone=$(cat /etc/timezone 2>/dev/null)
current_tz_value=$(cat /etc/TZ 2>/dev/null)
if [ "$timezone" = "$current_timezone" ] && [ "$timezone" = "$current_tz_value" ]; then
echo "Timezone settings are already up to date."
exit 0
echo "Timezone settings are already up to date."
exit 0
fi
# Search for the timezone in the file
matching_line=$(zcat /var/www/a/tz.js.gz | grep -i -F "$timezone")
if [ -z "$matching_line" ]; then
echo "Timezone not found in system file."
exit 1
echo "Timezone not found in system file."
exit 1
fi
# Extract the value associated with the timezone
@ -37,5 +37,5 @@ echo $timezone > /etc/timezone
export TZ=$value
if tty -s; then
echo "timezone.sh: You are running from a shell, please restart or log out to update timezone environment variables."
echo "timezone.sh: You are running from a shell, please restart or log out to update timezone environment variables."
fi