summaryrefslogtreecommitdiff
path: root/package/base-files/files/etc/preinit
blob: 34befe5ac7bc4a5dd631286888ca9173bfffcf24 (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
}

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

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

set_state preinit

mount_root ${FAILSAFE:+failsafe}

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

exec /sbin/init