summaryrefslogtreecommitdiff
path: root/package/base-files/files/etc/preinit
blob: d1a6ffd549d3572d14d6abb648e21d2357cc31af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
. /etc/diag.sh

failsafe() {
	lock /tmp/.failsafe
	ash --login
}

mount none /proc -t proc
mount none /sys  -t sysfs

[ -e /etc/preinit.arch ] && . /etc/preinit.arch

set_state preinit

mount_root ${FAILSAFE:+failsafe}

eval ${FAILSAFE:+failsafe}
lock -w /tmp/.failsafe

exec /sbin/init