SmartAudio/package/busybox-init-base-files/files/etc/init.d/rcS

95 lines
1.8 KiB
Plaintext
Raw Normal View History

2018-07-13 01:31:50 +00:00
#!/bin/sh
rc_preboot()
{
[ -f /etc/init.d/rc.preboot ] \
&& source /etc/init.d/rc.preboot
}
rc_init()
{
## set loglevel
local level=$(sed 's#.*loglevel=\([0-8]\).*#\1#' /proc/cmdline)
[ -n "${level}" ] && echo ${level} > /proc/sys/kernel/printk
# hostname
[ -z "$HOSTNAME" -o "$HOSTNAME" == "(none)" ] && HOSTNAME=TinaLinux
/bin/hostname $HOSTNAME
}
rc_log()
{
[ -f /etc/init.d/rc.log ] \
&& source /etc/init.d/rc.log
}
rc_mount()
{
local root_dev="$(readlink /dev/by-name/rootfs)"
# fix UDISK
if [ -h /dev/by-name/UDISK ]; then
echo ${root_dev} | grep -q "mtdblock" \
|| /usr/sbin/fsck.ext4 -p /dev/by-name/UDISK &>/dev/null
fi
# mount UDISK
if [ -h /dev/by-name/UDISK -a -d /mnt/UDISK ]; then
case "${root_dev}" in
/dev/mtdblock*)
mount -t jffs2 /dev/by-name/UDISK /mnt/UDISK 2>/dev/null
if [ "$?" -ne "0" ]; then
mkfs_jffs2 "/dev/by-name/UDISK"
mount -t jffs2 /dev/by-name/UDISK /mnt/UDISK 2>/dev/null
fi
;;
*)
mount -t ext4 /dev/by-name/UDISK /mnt/UDISK 2>/dev/null
if [ "$?" -ne "0" ]; then
mkfs.ext4 -m 0 /dev/by-name/UDISK >/dev/null
mount -t ext4 /dev/by-name/UDISK /mnt/UDISK 2>/dev/null
fi
;;
esac
fi
# enable hotplug
echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
}
rc_load_modules()
{
[ -f /etc/init.d/rc.modules ] \
&& source /etc/init.d/rc.modules
}
rc_load_script()
{
[ -f /etc/init.d/load_script.conf ] && \
for script in $(awk '{print}' /etc/init.d/load_script.conf); do
grep '#!/bin/sh /etc/rc.common' /etc/init.d/$script >/dev/null || continue;
/etc/init.d/$script "boot" >/dev/null &
done
}
rc_ota()
{
[ -f /sbin/aw_upgrade_log.sh ] && /sbin/aw_upgrade_log.sh &
}
rc_final()
{
[ -f /etc/init.d/rc.final ] \
&& source /etc/init.d/rc.final
}
rc_preboot
rc_init
rc_log
rc_mount
rc_load_modules
rc_load_script
rc_ota
rc_final