mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-04-11 07:27:06 +00:00
41 lines
1.5 KiB
Plaintext
Executable File
41 lines
1.5 KiB
Plaintext
Executable File
#!/sbin/openrc-run
|
|
|
|
description="Configuring settings from database."
|
|
|
|
depend() {
|
|
before sysctl net
|
|
}
|
|
|
|
start() {
|
|
ebegin "Configuring host settings from database"
|
|
|
|
mobyconfig exists etc/sysctl.conf && mobyconfig get etc/sysctl.conf > /etc/sysctl.conf
|
|
mobyconfig exists etc/sysfs.conf && mobyconfig get etc/sysfs.conf > /etc/sysfs.conf
|
|
mobyconfig exists etc/resolv.conf && mobyconfig get etc/resolv.conf > /etc/resolv.conf
|
|
mobyconfig exists random-seed && mobyconfig get random-seed > /dev/urandom
|
|
|
|
mobyconfig exists etc/hosts && mobyconfig get etc/hosts >> /etc/hosts
|
|
|
|
# handle static network config if configured
|
|
mobyconfig exists net/config && NETCONFIG=`mobyconfig get net/config`
|
|
if [ "${NETCONFIG}" = "static" ]; then
|
|
# assume that the other configsDB entries exist
|
|
IP=`mobyconfig get net/address`
|
|
MASK=`mobyconfig get net/netmask`
|
|
GW=`mobyconfig get net/gateway`
|
|
|
|
cp /etc/network/interfaces.template /etc/network/interfaces
|
|
echo >> /etc/network/interfaces
|
|
echo "auto eth0" >> /etc/network/interfaces
|
|
echo "iface eth0 inet static" >> /etc/network/interfaces
|
|
echo " address ${IP}" >> /etc/network/interfaces
|
|
echo " netmask ${MASK}" >> /etc/network/interfaces
|
|
echo " gateway ${GW}" >> /etc/network/interfaces
|
|
echo " metric 200" >> /etc/network/interfaces
|
|
fi
|
|
|
|
mobyconfig exists etc/ssl/certs/ca-certificates.crt && mobyconfig get etc/ssl/certs/ca-certificates.crt >> /etc/ssl/certs/ca-certificates.crt
|
|
|
|
eend 0
|
|
}
|