Skip to content
Snippets Groups Projects
Commit aa2fc198 authored by John Crispin's avatar John Crispin
Browse files

base-files: procd init is now the default, remove files.old


Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>

SVN-Revision: 36996
parent 740d7c10
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 426 deletions
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
reset_copy_rom() {
[ "$reset_has_fo" != "true" ] && {
dupe $jffs $rom
exit 0
}
}
boot_hook_add jffs2reset reset_copy_rom
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
copy_ramoverlay() {
# try to avoid fs changing while copying
mount -o remount,ro none / 2>&-
# copy ramoverlay to jffs2
echo -n "copying files ... "
cp -a /tmp/root/* /rom/overlay 2>&-
echo "done"
}
boot_hook_add switch2jffs copy_ramoverlay
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
no_fo_copy_ramoverlay() {
# copy ramoverlay to jffs2, must be done after switching
# to the new rootfs to avoid creating opaque directories
echo -n "copying files ... "
cp -a /tmp/root/* / >/dev/null 2>&1
sync
}
boot_hook_add no_fo no_fo_ramoverlay
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
with_fo_pivot() {
# switch back to squashfs (temporarily)
# and park the ramdisk ontop of /tmp/root
pivot /rom /mnt
mount -o move /mnt /tmp/root
# /overlay is the overlay
# /rom is the readonly
fopivot /overlay /rom
}
boot_hook_add switch2jffs with_fo_pivot
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
no_fo_cleanup() {
echo "done"
umount -l /overlay
umount -l /tmp/root
exit 0
}
boot_hook_add no_fo no_fo_cleanup
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
with_fo_cleanup() {
# try to get rid of /tmp/root
# this will almost always fail
umount -l /tmp/root 2>&-
grep -q overlay /proc/filesystems && {
cd /
(
cd /overlay
find -type l
) | while read FILE; do
[ -z "$FILE" ] && break
if ls -la "$FILE" 2>&- | grep -q '(overlay-whiteout)'; then
rm -f "$FILE"
fi
done
}
exit 0
}
boot_hook_add switch2jffs with_fo_cleanup
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
check_skip() {
if [ "$pi_mount_skip_next" = "true" ]; then
return 0
else
return 1
fi
}
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
mount_no_mtd() {
mtd unlock rootfs
mount -o noatime,remount,rw /dev/root /
}
check_for_mtd() {
check_skip || {
grep -qs rootfs_data /proc/mtd || {
mount_no_mtd && pi_mount_skip_next=true
}
}
}
boot_hook_add preinit_mount_root check_for_mtd
#!/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
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
preinit_ip() {
# if the preinit interface isn't specified and ifname is set in
# preinit.arch use that interface
if [ -z "$pi_ifname" ]; then
pi_ifname=$ifname
fi
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
}
}
preinit_ip_deconfig() {
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
ifconfig $pi_ifname 0.0.0.0 down
}
}
preinit_net_echo() {
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
{
[ "$pi_preinit_net_messages" = "y" ] || {
[ "$pi_failsafe_net_message" = "true" ] &&
[ "$pi_preinit_no_failsafe_netmsg" != "y" ]
}
} && netmsg $pi_broadcast "$1"
}
}
preinit_echo() {
preinit_net_echo $1
echo $1
}
pi_indicate_led() {
set_state preinit
}
pi_indicate_preinit() {
echo "- preinit -"
preinit_net_echo "Doing OpenWRT Preinit\n"
pi_indicate_led
}
boot_hook_add preinit_main preinit_ip
boot_hook_add preinit_main pi_indicate_preinit
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
mount_no_jffs2() {
echo "jffs2 not ready yet; using ramdisk"
ramoverlay
}
check_for_jffs2() {
check_skip || {
jffs2_ready || {
mount_no_jffs2 && pi_mount_skip_next=true
}
}
}
boot_hook_add preinit_mount_root check_for_jffs2
#!/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
#!/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
#!/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
#!/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
#!/bin/sh
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
find_mount_jffs2() {
mkdir -p /tmp/overlay
mount -o noatime -t jffs2 "$(find_mtd_part rootfs_data)" /tmp/overlay
mtd -qq unlock rootfs_data
}
jffs2_not_mounted() {
if [ "$pi_jffs2_mount_success" != "true" ]; then
return 0
else
return 1
fi
}
do_mount_jffs2() {
check_skip || {
find_mount_jffs2 && pi_jffs2_mount_success=true
}
}
boot_hook_add preinit_mount_root do_mount_jffs2
#!/bin/sh
# Copyright (C) 2010 OpenWrt.org
merge_overlay_hooks() {
jffs2_not_mounted || [ ! -d /tmp/overlay/lib/preinit ] || {
echo "- merge overlay components -"
mkdir -p /tmp/preinit-hook-merge
ln -sf /lib/preinit/* /tmp/overlay/lib/preinit/[0-9][0-9]_* /tmp/preinit-hook-merge/
boot_hook_splice_start
local pipart
for pipart in /tmp/preinit-hook-merge/*; do
. $pipart
done
boot_hook_splice_finish
rm -rf /tmp/preinit-hook-merge
}
}
boot_hook_add preinit_mount_root merge_overlay_hooks
#!/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
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications
indicate_regular_preinit() {
echo "- regular preinit -"
preinit_net_echo "Continuing with Regular Preinit\n"
pi_indicate_led
}
boot_hook_add preinit_main indicate_regular_preinit
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment