diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-03-13 18:11:19 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-03-13 18:11:19 +0000 |
commit | 35dde6748e98a2a7725e220c5ea8f63c7d9c185c (patch) | |
tree | 4aeff8c4041964f40a41b510ee951adf81dffe17 /package/base-files/files | |
parent | 5286d13803771d732cc7dafbacb365b88cca2878 (diff) |
[base-files] make basefiles aware of procd
Signed-off-by: John Crispin <blogic@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36003 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files')
25 files changed, 55 insertions, 309 deletions
diff --git a/package/base-files/files/etc/hotplug2-common.rules b/package/base-files/files/etc/hotplug2-common.rules deleted file mode 100644 index c284f8f3f..000000000 --- a/package/base-files/files/etc/hotplug2-common.rules +++ /dev/null @@ -1,43 +0,0 @@ - -# uncomment me to log hotplug events -# DEVPATH is set { -# exec logger -s -t hotplug -p daemon.info "name=%DEVNAME%, path=%DEVPATH%" -# } - -$include /etc/hotplug2-platform.rules - -DEVNAME ~~ (^null$|^full$|^ptmx$|^zero$|^gpio|^hvc) { - makedev /dev/%DEVNAME% 0666 - next-event -} - -DEVNAME == mapper/control { - makedev /dev/%DEVNAME% 0600 - next-event -} - -ACTION == add, DEVPATH is set { - makedev /dev/%DEVNAME% 0644 -} - -ACTION == add, DEVPATH is set, DEVNAME ~~ ^tty { - chmod 0666 /dev/%DEVNAME% -} - -ACTION == add, DEVPATH is set, DEVNAME ~~ ^ppp { - chmod 0600 /dev/%DEVNAME% -} - -ACTION == remove, DEVPATH is set, MAJOR is set, MINOR is set { - remove /dev/%DEVNAME% -} - -FIRMWARE is set, ACTION == add { - exec /sbin/hotplug-call firmware - load-firmware /lib/firmware - next-event -} - -SUBSYSTEM == platform { - exec /sbin/hotplug-call %SUBSYSTEM% -} diff --git a/package/base-files/files/etc/hotplug2-init.rules b/package/base-files/files/etc/hotplug2-init.rules deleted file mode 100644 index f01169776..000000000 --- a/package/base-files/files/etc/hotplug2-init.rules +++ /dev/null @@ -1,5 +0,0 @@ -$include /etc/hotplug2-common.rules - -SUBSYSTEM == button { - exec kill -USR1 1 -} diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 005c4ad6f..67db0d2a6 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -24,27 +24,6 @@ system_config() { # apply timezone to kernel date -k - - if [ -x /sbin/syslogd ]; then - local args log_ip log_size log_port log_type log_file - config_get log_ip "$cfg" log_ip - config_get log_size "$cfg" log_size 16 - config_get log_port "$cfg" log_port 514 - config_get log_type "$cfg" log_type circular - config_get log_file "$cfg" log_file "/var/log/messages" - args="${log_ip:+-L -R ${log_ip}:${log_port}} ${conloglevel:+-l $conloglevel}" - if [ "$log_type" = "file" ]; then - args="$args -s $log_size -O $log_file -S" - else - args="$args -C${log_size}" - fi - service_start /sbin/syslogd $args - fi - if [ -x /sbin/klogd ]; then - config_get klogconloglevel "$cfg" klogconloglevel - args="${klogconloglevel:+-c $klogconloglevel}" - service_start /sbin/klogd $args - fi } apply_uci_config() { @@ -84,12 +63,6 @@ start() { config_load system config_foreach system_config system - killall -q hotplug2 - [ -x /sbin/hotplug2 ] && /sbin/hotplug2 --override --persistent \ - --set-rules-file /etc/hotplug2.rules \ - --set-coldplug-cmd /sbin/udevtrigger \ - --max-children 1 >/dev/null 2>&1 & - # create /dev/root if it doesn't exist [ -e /dev/root -o -h /dev/root ] || { rootdev=$(awk 'BEGIN { RS=" "; FS="="; } $1 == "root" { print $2 }' < /proc/cmdline) @@ -103,8 +76,3 @@ start() { done fi } - -stop() { - service_stop /sbin/klogd - service_stop /sbin/syslogd -} diff --git a/package/base-files/files/etc/init.d/rcS b/package/base-files/files/etc/init.d/rcS index 3ec9bfef6..9599bbf32 100755 --- a/package/base-files/files/etc/init.d/rcS +++ b/package/base-files/files/etc/init.d/rcS @@ -1,26 +1,9 @@ #!/bin/sh # Copyright (C) 2006 OpenWrt.org -run_scripts() { - for i in /etc/rc.d/$1*; do - [ -x $i ] && $i $2 2>&1 - done | $LOGGER -} - -system_config() { - config_get_bool foreground $1 foreground 0 -} - LOGGER="cat" -[ -x /usr/bin/logger ] && LOGGER="logger -s -p 6 -t sysinit" - -. /lib/functions.sh - -config_load system -config_foreach system_config system +[ -x /usr/bin/logger ] && LOGGER="logger -p 6 -t sysinit" -if [ "$1" = "S" -a "$foreground" != "1" ]; then - run_scripts "$1" "$2" & -else - run_scripts "$1" "$2" -fi +for i in /etc/rc.d/$1*; do + [ -x $i ] && $i $2 2>&1 +done | $LOGGER diff --git a/package/base-files/files/etc/init.d/watchdog b/package/base-files/files/etc/init.d/watchdog deleted file mode 100755 index 299c89142..000000000 --- a/package/base-files/files/etc/init.d/watchdog +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2008-2011 OpenWrt.org - -START=97 - -start() { - [ -c /dev/watchdog ] || return 1 - [ -x /sbin/watchdog ] || return 1 - service_start /sbin/watchdog -t 5 /dev/watchdog -} -stop() { - service_stop /sbin/watchdog -} diff --git a/package/base-files/files/etc/inittab b/package/base-files/files/etc/inittab index ca90fd8a2..781718593 100644 --- a/package/base-files/files/etc/inittab +++ b/package/base-files/files/etc/inittab @@ -1,4 +1,3 @@ ::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K shutdown -ttyS0::askfirst:/bin/ash --login -tty1::askfirst:/bin/ash --login +::askconsole:/bin/ash --login diff --git a/package/base-files/files/etc/preinit b/package/base-files/files/etc/preinit index b237c2e06..ff26f96d6 100755 --- a/package/base-files/files/etc/preinit +++ b/package/base-files/files/etc/preinit @@ -2,6 +2,8 @@ # Copyright (C) 2006 OpenWrt.org # Copyright (C) 2010 Vertical Communications +[ -z "$PREINIT" ] && exec /sbin/init + export PATH=/bin:/sbin:/usr/bin:/usr/sbin pi_ifname= diff --git a/package/base-files/files/etc/rc.button/failsafe b/package/base-files/files/etc/rc.button/failsafe new file mode 100755 index 000000000..dcdf7de80 --- /dev/null +++ b/package/base-files/files/etc/rc.button/failsafe @@ -0,0 +1,2 @@ +#!/bin/sh +touch /tmp/failsafe_button diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset new file mode 100755 index 000000000..763994d07 --- /dev/null +++ b/package/base-files/files/etc/rc.button/reset @@ -0,0 +1,18 @@ +#!/bin/sh + +[ "${ACTION}" = "released" ] || exit 0 + +. /lib/functions.sh + +logger "$BUTTON pressed for $SEEN seconds" + +if [ "$SEEN" -lt 1 ] +then + echo "REBOOT" > /dev/console + sync + reboot +elif [ "$SEEN" -gt 5 ] +then + echo "FACTORY RESET" > /dev/console + firstboot && reboot & +fi diff --git a/package/base-files/files/etc/rc.button/rfkill b/package/base-files/files/etc/rc.button/rfkill new file mode 100755 index 000000000..7a8cfe91b --- /dev/null +++ b/package/base-files/files/etc/rc.button/rfkill @@ -0,0 +1,23 @@ +#!/bin/sh + +[ "${ACTION}" = "released" ] || exit 0 + +. /lib/functions.sh + +local rfkill_state=0 + +wifi_rfkill_set() { + uci set wireless.$1.disabled=$rfkill_state +} + +wifi_rfkill_check() { + local disabled + config_get disabled $1 disabled + [ "$disabled" = "1" ] || rfkill_state=1 +} + +config_load wireless +config_foreach wifi_rfkill_check wifi-device +config_foreach wifi_rfkill_set wifi-device +uci commit wireless +wifi up diff --git a/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup b/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup index 0181b39d4..560169901 100644 --- a/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup +++ b/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup @@ -6,7 +6,7 @@ with_fo_cleanup() { # try to get rid of /tmp/root # this will almost always fail - umount /tmp/root 2>&- + umount -l /tmp/root 2>&- grep -q overlay /proc/filesystems && { cd / ( diff --git a/package/base-files/files/lib/preinit/10_essential_fs b/package/base-files/files/lib/preinit/10_essential_fs deleted file mode 100644 index fc04eb7ff..000000000 --- a/package/base-files/files/lib/preinit/10_essential_fs +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -do_mount_procfs() { - mount -o noatime -t proc proc /proc -} - -do_mount_sysfs() { - mount -o noatime -tsysfs sysfs /sys -} - -calc_tmpfs_size() { - pi_size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo) -} - -do_mount_tmpfs() { - calc_tmpfs_size - mount -o noatime -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp -} - -boot_hook_add preinit_essential do_mount_procfs -boot_hook_add preinit_essential do_mount_sysfs -boot_hook_add preinit_essential do_mount_tmpfs - diff --git a/package/base-files/files/lib/preinit/10_indicate_preinit b/package/base-files/files/lib/preinit/10_indicate_preinit index 4a0109cc1..da70b97c4 100644 --- a/package/base-files/files/lib/preinit/10_indicate_preinit +++ b/package/base-files/files/lib/preinit/10_indicate_preinit @@ -41,7 +41,6 @@ pi_indicate_led() { } pi_indicate_preinit() { - echo "- preinit -" preinit_net_echo "Doing OpenWRT Preinit\n" pi_indicate_led } diff --git a/package/base-files/files/lib/preinit/20_device_fs_mount b/package/base-files/files/lib/preinit/20_device_fs_mount deleted file mode 100644 index 7535b3ff9..000000000 --- a/package/base-files/files/lib/preinit/20_device_fs_mount +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -do_move_devtmpfs() { - local mnt="$(grep devtmpfs /proc/mounts)" - mnt="${mnt#* }"; mnt="${mnt%% *}" - - [ "$mnt" = "/dev" ] || mount -o noatime,move "$mnt" /dev -} - -do_mount_devfs() { - mount -o noatime -t devfs devfs /dev -} - -do_mount_hotplug() { - mount -t tmpfs -o noatime,mode=0755,size=512K tmpfs /dev -} - -do_mount_udev() { - mount -n -t tmpfs -o noatime,mode=0755 udev /dev -} - -choose_device_fs() { - if grep -q devtmpfs /proc/mounts; then - do_move_devtmpfs - elif grep -q devfs /proc/filesystems; then - do_mount_devfs - elif [ -x /sbin/hotplug2 ]; then - do_mount_hotplug - elif [ -x /sbin/udevd ]; then - do_mount_udev - fi -} - -boot_hook_add preinit_essential choose_device_fs - diff --git a/package/base-files/files/lib/preinit/30_device_fs_daemons b/package/base-files/files/lib/preinit/30_device_fs_daemons deleted file mode 100644 index 8379e5e74..000000000 --- a/package/base-files/files/lib/preinit/30_device_fs_daemons +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2013 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -init_devfs() { - HOTPLUG=/sbin/hotplug-call -} - -init_hotplug2() { - [ -c /dev/console ] || mknod /dev/console c 5 1 - /sbin/hotplug2 --set-rules-file /etc/hotplug2-init.rules --no-persistent --set-coldplug-cmd /sbin/udevtrigger - /sbin/hotplug2 --set-rules-file /etc/hotplug2-init.rules --persistent & -} - -init_udev() { - [ -d /lib/udev/devices ] && cp -af /lib/udev/devices/* /dev/ - [ -c /dev/console ] || mknod -m 0600 /dev/console c 5 1 - [ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3 - /sbin/udevd --daemon --resolve-names=never - /sbin/udevadm trigger - /sbin/udevadm settle -} - -init_device_fs() { - HOTPLUG= - if grep -q devfs /proc/filesystems; then - init_devfs - elif [ -x /sbin/hotplug2 ]; then - init_hotplug2 - elif [ -x /sbin/udevd ]; then - init_udev - fi -} - -boot_hook_add preinit_essential init_device_fs - diff --git a/package/base-files/files/lib/preinit/30_failsafe_wait b/package/base-files/files/lib/preinit/30_failsafe_wait index 04dc57df2..808d9731b 100644 --- a/package/base-files/files/lib/preinit/30_failsafe_wait +++ b/package/base-files/files/lib/preinit/30_failsafe_wait @@ -61,11 +61,10 @@ fs_wait_for_key () { } lock -w $keypress_wait - trap - INT - trap - USR1 - keypressed=1 [ "$(cat $keypress_true)" = "true" ] && keypressed=0 + [ -f "/tmp/failsafe_button" ] && keypressed=1 + rm -f $keypress_true rm -f $keypress_wait rm -f $keypress_sec diff --git a/package/base-files/files/lib/preinit/40_init_shm b/package/base-files/files/lib/preinit/40_init_shm deleted file mode 100644 index 8971116a4..000000000 --- a/package/base-files/files/lib/preinit/40_init_shm +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -init_shm() { - [ -d /dev/shm ] || mkdir -p /dev/shm -} - -boot_hook_add preinit_essential init_shm - diff --git a/package/base-files/files/lib/preinit/40_mount_devpts b/package/base-files/files/lib/preinit/40_mount_devpts deleted file mode 100644 index b55a7f2e8..000000000 --- a/package/base-files/files/lib/preinit/40_mount_devpts +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -init_devpts() { - [ -d /dev/pts ] || mkdir -p /dev/pts -} - -do_mount_devpts() { - mount -o noatime -t devpts devpts /dev/pts -} - -boot_hook_add preinit_essential init_devpts -boot_hook_add preinit_essential do_mount_devpts - diff --git a/package/base-files/files/lib/preinit/50_choose_console b/package/base-files/files/lib/preinit/50_choose_console deleted file mode 100644 index ecbc2eaf4..000000000 --- a/package/base-files/files/lib/preinit/50_choose_console +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -choose_console() { - # the shell really doesn't like having stdin/out closed - # that's why we use /dev/pty/m0 and m1 (or equivalent) as replacement - # for /dev/console if there's no serial console available - - if grep -q devfs /proc/filesystems; then - M0=/dev/pty/m0 - M1=/dev/pty/m1 - M2=/dev/pty/m1 - elif [ -x /sbin/hotplug2 ]; then - M0=/dev/ptmx - M1=/dev/ptmx - M2=/dev/ptmx - elif [ -x /sbin/udevd ]; then - M0=/dev/pty/ptmx - M1=/dev/pty/ptmx - M2=/dev/pty/ptmx - fi - dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null && { - M0=/dev/console - M1=/dev/console - M2=/dev/console - } -} - -boot_hook_add preinit_essential choose_console - diff --git a/package/base-files/files/lib/preinit/50_indicate_regular_preinit b/package/base-files/files/lib/preinit/50_indicate_regular_preinit index 9cc01f219..c200dad67 100644 --- a/package/base-files/files/lib/preinit/50_indicate_regular_preinit +++ b/package/base-files/files/lib/preinit/50_indicate_regular_preinit @@ -3,7 +3,6 @@ # Copyright (C) 2010 Vertical Communications indicate_regular_preinit() { - echo "- regular preinit -" preinit_net_echo "Continuing with Regular Preinit\n" pi_indicate_led } diff --git a/package/base-files/files/lib/preinit/60_init_hotplug b/package/base-files/files/lib/preinit/60_init_hotplug deleted file mode 100644 index dc05e0ed0..000000000 --- a/package/base-files/files/lib/preinit/60_init_hotplug +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -init_hotplug() { - echo "$HOTPLUG" > /proc/sys/kernel/hotplug -} - -boot_hook_add preinit_main init_hotplug - diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root index ad24fb8ac..9a99ee910 100644 --- a/package/base-files/files/lib/preinit/80_mount_root +++ b/package/base-files/files/lib/preinit/80_mount_root @@ -6,5 +6,4 @@ do_mount_root() { boot_run_hook preinit_mount_root } -boot_hook_add preinit_main do_mount_root - +[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root diff --git a/package/base-files/files/lib/preinit/90_init_console b/package/base-files/files/lib/preinit/90_init_console deleted file mode 100644 index ca05755fd..000000000 --- a/package/base-files/files/lib/preinit/90_init_console +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -init_console() { - if [ "$pi_suppress_stderr" = "y" ]; then - exec <$M0 >$M1 2>&0 - else - exec <$M0 >$M1 2>$M2 - fi -} - -boot_hook_add preinit_essential init_console - diff --git a/package/base-files/files/lib/preinit/99_10_run_init b/package/base-files/files/lib/preinit/99_10_run_init index fef3a503e..a8f330f89 100644 --- a/package/base-files/files/lib/preinit/99_10_run_init +++ b/package/base-files/files/lib/preinit/99_10_run_init @@ -3,13 +3,7 @@ # Copyright (C) 2010 Vertical Communications run_init() { - preinit_echo "- init -" preinit_ip_deconfig - if [ "$pi_init_suppress_stderr" = "y" ]; then - exec env - PATH=$pi_init_path $pi_init_env $pi_init_cmd 2>&0 - else - exec env - PATH=$pi_init_path $pi_init_env $pi_init_cmd - fi } boot_hook_add preinit_main run_init diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 2e123ab3c..969aecb7f 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -38,7 +38,7 @@ supivot() { # <new_root> <old_root> mkdir -p $1$2 $1/proc $1/sys $1/dev $1/tmp $1/overlay && \ mount -o noatime,move /proc $1/proc && \ pivot_root $1 $1$2 || { - umount $1 $1 + umount -l $1 $1 return 1 } |