[base-files/generic] update the /init file to start /sbin/init
[openwrt/svn-archive/archive.git] / package / base-files / files / lib / preinit / 10_essential_fs
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4
5 do_mount_procfs() {
6 mount -o noatime -t proc proc /proc
7 }
8
9 do_mount_sysfs() {
10 mount -o noatime -tsysfs sysfs /sys
11 }
12
13 calc_tmpfs_size() {
14 pi_size=$(awk '/MemTotal:/ {l=5242880;mt=($2*1024);print((s=mt/2)<l)&&(mt>l)?mt-l:s}' /proc/meminfo)
15 }
16
17 do_mount_tmpfs() {
18 calc_tmpfs_size
19 mount -o noatime -t tmpfs -o size=$pi_size,nosuid,nodev,mode=1777 tmpfs /tmp
20 }
21
22 boot_hook_add preinit_essential do_mount_procfs
23 boot_hook_add preinit_essential do_mount_sysfs
24 boot_hook_add preinit_essential do_mount_tmpfs
25