forked from justin2004/a-chip-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.template
executable file
·53 lines (43 loc) · 1.17 KB
/
init.template
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
#!/bin/sh
{
exec <>/dev/ttyGS0 >&0 2>&0
export PATH
while true; do
echo "This is not a modem. Type 'start' to start."
read -r line
test "$line" = start && break
done
set -x
read -p "Hostname: " hostname &&
echo "$hostname" >/etc/hostname &&
# based on netcfg_write_common from netcfg
cat >/etc/hosts <<EOF &&
127.0.0.1 localhost
127.0.1.1 $hostname
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
EOF
mv /sbin/init.stock /sbin/init &&
mount -t proc proc /proc &&
mount -t sysfs sysfs /sys &&
(
export \
DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C LANGUAGE=C LANG=C
/var/lib/dpkg/info/base-passwd.preinst install &&
/var/lib/dpkg/info/dash.preinst install &&
dpkg --configure --force-configure-any mawk &&
dpkg --configure -a
) &&
systemctl enable getty@ttyGS0 &&
read -p "Username for your account: " username &&
adduser --gecos "" "$username" &&
adduser "$username" sudo &&
adduser "$username" netdev &&
# systemd will remount these with safer options
umount /proc /sys &&
exec /sbin/init
} || exec sh