mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 18:41:37 +00:00
add mobyconfig tool for simpler config
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
40814e4779
commit
1d1626e449
@ -18,6 +18,7 @@ RUN \
|
||||
strace fuse
|
||||
|
||||
COPY etc /etc/
|
||||
RUN mkdir -p /etc/docker
|
||||
|
||||
ADD kernel/aufs-utils.tar /
|
||||
COPY mkinitrd.sh /bin/
|
||||
@ -57,6 +58,7 @@ COPY packages/userns/useradd /usr/sbin
|
||||
COPY packages/nc-vsock/nc-vsock /usr/bin
|
||||
COPY packages/vsudd/vsudd /sbin
|
||||
COPY packages/vsudd/etc /etc
|
||||
iCOPY packages/mobyconfig/mobyconfig /usr/bin
|
||||
|
||||
RUN \
|
||||
rc-update add swap boot && \
|
||||
|
54
alpine/packages/mobyconfig/mobyconfig
Executable file
54
alpine/packages/mobyconfig/mobyconfig
Executable file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ $# -ne 2 ]
|
||||
then
|
||||
printf "usage: $0 [get|exists] key\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $1 == "set" ]
|
||||
then
|
||||
printf "Configuration is immutable\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! cat /proc/cmdline | grep -q 'com.docker.database'
|
||||
then
|
||||
printf "Could not find database configuration information\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d /Database ]
|
||||
then
|
||||
mkdir -p /Database
|
||||
mount -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 db /Database
|
||||
if [ $? -ne 1 ]
|
||||
then
|
||||
rm -rf /Database
|
||||
printf "Could not mount configuration database\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
DATABASE="$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
|
||||
BASE="/Database/branch/master/ro/${DATABASE}"
|
||||
|
||||
if [ $1 == "exists" ]
|
||||
then
|
||||
[ -f ${BASE}/$2 ] && exit 0 || exit 1
|
||||
fi
|
||||
|
||||
if [ $1 == "get" ]
|
||||
then
|
||||
if [ -f ${BASE}/$2 ]
|
||||
then
|
||||
cat ${BASE}/$2
|
||||
exit 0
|
||||
else
|
||||
printf "No such key: $2\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "usage: $0 [get|exists] key\n"
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user