aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-03-13 18:11:19 +0000
committerJohn Crispin <john@openwrt.org>2013-03-13 18:11:19 +0000
commitf43b7934d2850c2f545736253a0f8cbe4915fdff (patch)
tree3718ca82dd27e3917a51439823bfb20a067af784 /package/base-files/files/lib
parent1360067c4a75cd1804710e6f25871f695d3271b2 (diff)
downloadupstream-f43b7934d2850c2f545736253a0f8cbe4915fdff.tar.gz
upstream-f43b7934d2850c2f545736253a0f8cbe4915fdff.tar.bz2
upstream-f43b7934d2850c2f545736253a0f8cbe4915fdff.zip
make basefiles aware of procd
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36003
Diffstat (limited to 'package/base-files/files/lib')
-rw-r--r--package/base-files/files/lib/firstboot/99_10_with_fo_cleanup2
-rw-r--r--package/base-files/files/lib/preinit/10_essential_fs25
-rw-r--r--package/base-files/files/lib/preinit/10_indicate_preinit1
-rw-r--r--package/base-files/files/lib/preinit/20_device_fs_mount37
-rw-r--r--package/base-files/files/lib/preinit/30_device_fs_daemons36
-rw-r--r--package/base-files/files/lib/preinit/30_failsafe_wait5
-rw-r--r--package/base-files/files/lib/preinit/40_init_shm10
-rw-r--r--package/base-files/files/lib/preinit/40_mount_devpts15
-rw-r--r--package/base-files/files/lib/preinit/50_choose_console31
-rw-r--r--package/base-files/files/lib/preinit/50_indicate_regular_preinit1
-rw-r--r--package/base-files/files/lib/preinit/60_init_hotplug10
-rw-r--r--package/base-files/files/lib/preinit/80_mount_root3
-rw-r--r--package/base-files/files/lib/preinit/90_init_console14
-rw-r--r--package/base-files/files/lib/preinit/99_10_run_init6
-rw-r--r--package/base-files/files/lib/upgrade/common.sh2
15 files changed, 5 insertions, 193 deletions
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 0181b39d49..560169901c 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 fc04eb7ff3..0000000000
--- 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 4a0109cc17..da70b97c40 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 7535b3ff9d..0000000000
--- 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 8379e5e74f..0000000000
--- 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 04dc57df20..808d9731b7 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 8971116a49..0000000000
--- 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 b55a7f2e8e..0000000000
--- 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 ecbc2eaf42..0000000000
--- 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 9cc01f2199..c200dad671 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 dc05e0ed05..0000000000
--- 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 ad24fb8ace..9a99ee9109 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 ca05755fd3..0000000000
--- 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 fef3a503e2..a8f330f892 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 2e123ab3cf..969aecb7ff 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
}