From 721d3e6d91e08e9abc24b7729eccb613d9d4d7b3 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 23 Jun 2014 11:09:47 +0200 Subject: setup-alpine: support for lxc add support for setup-alpine from within a container. when running in lxc we skip config of: - keymap - hostname - ntp - disk - apk cache - lbu ref #3057 --- setup-alpine.in | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/setup-alpine.in b/setup-alpine.in index 41854b3..cff4ac5 100644 --- a/setup-alpine.in +++ b/setup-alpine.in @@ -39,7 +39,7 @@ __EOF__ while getopts "af:c:hq" opt ; do case $opt in a) ARCHIVE=yes;; - f) USEANSWERFILE="$OPTARG";; + f) USEANSWERFILE="$OPTARG";; c) CREATEANSWERFILE="$OPTARG";; h) usage;; q) quick=1;; @@ -48,8 +48,9 @@ while getopts "af:c:hq" opt ; do done shift `expr $OPTIND - 1` +rc_sys=$(rc --sys) # mount xenfs so we can detect xen dom0 -if [ "$(rc --sys)" = "XENU" ] && ! grep -q '^xenfs' /proc/mounts; then +if [ "$rc_sys" = "XENU" ] && ! grep -q '^xenfs' /proc/mounts; then modprobe xenfs mount -t xenfs xenfs /proc/xen fi @@ -87,7 +88,7 @@ DNSOPTS="-d example.com -n 8.8.8.8" # Set timezone to UTC TIMEZONEOPTS="-z UTC" -# set http/ftp proxy +# set http/ftp proxy PROXYOPTS="http://webproxy:8080" # Add a random mirror @@ -118,8 +119,10 @@ else PKGADD="apk add" fi -$PREFIX/sbin/setup-keymap ${KEYMAPOPTS} -$PREFIX/sbin/setup-hostname ${HOSTNAMEOPTS} +if [ "$rc_sys" != LXC ]; then + $PREFIX/sbin/setup-keymap ${KEYMAPOPTS} + $PREFIX/sbin/setup-hostname ${HOSTNAMEOPTS} +fi if [ -n "$INTERFACESOPTS" ]; then printf "$INTERFACESOPTS" | $PREFIX/sbin/setup-interfaces -i @@ -180,7 +183,7 @@ fi $PREFIX/sbin/setup-sshd ${SSHDOPTS} -if ! is_qemu; then +if ! is_qemu && [ "$rc_sys" != "LXC" ]; then $PREFIX/sbin/setup-ntp ${NTPOPTS} fi @@ -188,6 +191,10 @@ if is_xen_dom0; then setup-xen-dom0 fi +if [ "$rc_sys" = "LXC" ]; then + exit 0 +fi + DEFAULT_DISK=none \ $PREFIX/sbin/setup-disk -q ${DISKOPTS} -- cgit v1.2.3