summaryrefslogtreecommitdiff
path: root/scripts/mkloopgptdisk_buffalo_ls_pro_live_chroot_hook.sh
blob: 168284b13d29a825ec763ec0ce34f2fab56810c6 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
# This script is executed inside the image chroot before packing up.
# Architecture/platform specific code goes here, like kernel install
# and configuration

env-update
. /etc/profile

setup_boot() {
	# enable sshd by default
	rc-update add sshd default
	# enable logger by default
	rc-update add syslog-ng boot
	rc-update add vixie-cron boot
	# Linkstation Pro/Live Deamon
	rc-update add micro-evtd-boot boot
	rc-update add micro-evtd default
	# add ntp sercice
	rc-update add ntp-client default
	rc-update add ntpd default
	# enable dbus, of course, and also NetworkManager
	rc-update add dbus boot

	# we are on eth0 in the ls pro/live/kuro so create the init.d link
	ln -sf net.lo /etc/init.d/net.eth0
	rc-update add net.eth0 default

	# select the first available kernel
	eselect uimage set 1

	# cleaning up deps
	rc-update --update
}

setup_startup_caches() {
	mount -t proc proc /proc
	/lib/rc/bin/rc-depend -u
	# Generate openrc cache
	[[ -d "/lib/rc/init.d" ]] && touch /lib/rc/init.d/softlevel
	[[ -d "/run/openrc" ]] && touch /run/openrc/softlevel
	/etc/init.d/savecache start
	/etc/init.d/savecache zap
	ldconfig
	ldconfig
	umount /proc
}


setup_users() {
	# setup root password to... root!
	echo root:sablink | chpasswd
}

setup_serial() {
	# setup serial login
	sed -i "s:^s0.*::" /etc/inittab
	echo "s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100" >> /etc/inittab
}

setup_fallback_network() {
	# setup fallback network
	echo "" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "# Sablink Core Network Config" >> /etc/conf.d/net
	echo "#" >> /etc/conf.d/net
	echo "# DHCP IP / route configuration, with fallback to a static IP / route" >> /etc/conf.d/net
	echo "#" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "config_eth0=\"dhcp\"" >> /etc/conf.d/net
	echo "fallback_eth0=\"192.168.178.103 netmask 255.255.255.0 broadcast 192.168.178.255\"" >> /etc/conf.d/net
	echo "fallback_route_eth0=\"default via 192.168.178.1\"" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "#" >> /etc/conf.d/net
	echo "# pure static IP / route configuration, should the above not work even with fallback.." >> /etc/conf.d/net
	echo "# (in that case, comment the whole DHCP section and uncomment this one)" >> /etc/conf.d/net
	echo "#" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "#config_eth0=\"192.168.11.3 netmask 255.255.255.0 broadcast 192.168.11.255\"" >> /etc/conf.d/net
	echo "#routes_eth0=\"default via 192.168.11.1\"" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "#" >> /etc/conf.d/net
	echo "# DNS configuration" >> /etc/conf.d/net
	echo "#" >> /etc/conf.d/net
	echo "" >> /etc/conf.d/net
	echo "dns_servers_eth0=\"192.168.178.1\"" >> /etc/conf.d/net
}

setup_fstab() {
	sed -e "s!/BOOT!/sda1!g" -e "s!/ROOT!/sda2!g" -e "s!SWAP!sda3!g" -e "s!ext3!btrfs!g" -i /etc/fstab
}

setup_layman() {
	sed -e "s!/source!/#source!g" -i /etc/make.conf
}

setup_users
setup_boot
setup_serial
setup_startup_caches
setup_fallback_network
setup_fstab
setup_layman

exit 0

Powered by Domaintechnik.at | Hosting - Domain - Webspace