blob: e8618a6cd3eae2d91819ddd6dc528f15c24eaccc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/bin/sh
export PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export HOME='/root'
export PS1='\w \h\$ '
HOSTNAME='minlin'
UDHCPC_ARGS=
mkdir -p /dev /proc /sys
mount -t devtmpfs devtmpfs /dev -o size=4k
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t debugfs debugfs /sys/kernel/debug
if [ x"$(command -v klogd)" != x ]; then
$(command -v klogd)
fi
if [ x"$(command -v syslogd)" != x ]; then
$(command -v syslogd) -C
UDHCPC_ARGS='-S'
fi
echo '4 4 1 7' >/proc/sys/kernel/printk
cat <<EOF
Boot took $(cut -d' ' -f1 /proc/uptime) seconds
_ _ __ _
/\/\ (_)_ __ (_) / /(_)_ __ _ ___ __
/ \| | '_ \| | / / | | '_ \| | | \ \/ /
/ /\/\ \ | | | | | / /__| | | | | |_| |> < $(uname -r)
\/ \/_|_| |_|_| \____/_|_| |_|\__,_/_/\_\
musl $(/lib/ld-musl-x86_64.so.1 2>&1 | sed -n 's/^Version \(.*\)$/\1/gp')
$(busybox | head -1)
EOF
for arg in $(cat /proc/cmdline | tr '[:upper:]' '[:lower:]'); do
case $arg in
net|net=*)
if [ x"$(command -v udhcpc)" != x ]; then
if [ x"${arg#net}" = x ]; then
for netif in $(ls /sys/class/net); do
ifconfig ${netif} up
done
else
NETIF="${arg#net=}"
echo "dhcp interface: ${NETIF}"
ifconfig ${NETIF} up
fi
$(command -v udhcpc) -R -x hostname:${HOSTNAME} -t 4 -n ${UDHCPC_ARGS}
else
echo 'net: Missing udhcpc'
fi
;;
keymap=*)
KEYMAP="/usr/share/keymaps/${arg#keymap=}.bmap"
if [ -r "${KEYMAP}" ]; then
echo "KEYMAP=${KEYMAP}"
loadkmap <"${KEYMAP}"
else
echo "keymap: Invalid path '${KEYMAP}'"
fi
;;
esac
done
hostname ${HOSTNAME}
cd ${HOME}
setsid cttyhack sh
poweroff -f
|