mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
add generic database setup, and add sysctl support
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
74a2dbd14a
commit
2388a191f3
@ -37,7 +37,7 @@ COPY packages/9pinit/etc /etc/
|
||||
COPY packages/ntp15m/etc /etc/
|
||||
COPY packages/binfmt_misc/etc /etc/
|
||||
COPY packages/dnsfix/etc /etc/
|
||||
COPY packages/hostname/etc /etc/
|
||||
COPY packages/database/etc /etc/
|
||||
COPY packages/hupper/hupper /bin/
|
||||
COPY packages/hupper/etc /etc/
|
||||
|
||||
@ -73,6 +73,7 @@ RUN \
|
||||
rc-update add diagnostics default && \
|
||||
rc-update add binfmt_misc sysinit && \
|
||||
rc-update add dnsfix boot && \
|
||||
rc-update add database boot && \
|
||||
rc-update add hupper default && \
|
||||
ln -s /bin/busybox /init
|
||||
|
||||
|
22
alpine/packages/database/etc/init.d/database
Executable file
22
alpine/packages/database/etc/init.d/database
Executable file
@ -0,0 +1,22 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Configuring settings from database."
|
||||
|
||||
depend() {
|
||||
need 9pinit
|
||||
before hostname sysctl
|
||||
}
|
||||
|
||||
start() {
|
||||
cat /proc/cmdline | grep -q 'com.docker.database' || exit 0
|
||||
|
||||
ebegin "Configuring settings from database"
|
||||
|
||||
DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
|
||||
HOSTFILE="/Database/branch/master/ro/${DATABASE}/etc/hostname"
|
||||
[ -s ${HOSTFILE} ] && cp ${HOSTFILE} /etc/hostname
|
||||
SYSCTL="/Database/branch/master/ro/${DATABASE}/etc/sysctl.conf"
|
||||
[ -s ${SYSCTL} ] && cp ${SYSCTL} /etc/sysctl.conf
|
||||
|
||||
eend 0
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
description="Sets the hostname of the machine."
|
||||
|
||||
depend() {
|
||||
need 9pinit
|
||||
}
|
||||
|
||||
start() {
|
||||
opts="docker"
|
||||
if cat /proc/cmdline | grep -q 'com.docker.database'
|
||||
then
|
||||
DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
|
||||
HOSTFILE="/Database/branch/master/ro/${DATABASE}/etc/hostname"
|
||||
[ -s ${HOSTFILE} ] && opts="-F ${HOSTFILE}"
|
||||
else
|
||||
[ -s /etc/hostname ] && opts="-F /etc/hostname"
|
||||
fi
|
||||
ebegin "Setting hostname"
|
||||
hostname $opts
|
||||
eend $?
|
||||
}
|
Loading…
Reference in New Issue
Block a user