diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-06-23 11:09:47 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-06-23 11:18:15 +0200 |
commit | 721d3e6d91e08e9abc24b7729eccb613d9d4d7b3 (patch) | |
tree | b08d90dea8d06437a1f230ff58a1e5343acb6c5f | |
parent | 77da382737e729ec18b684c84178e2e1498ddff3 (diff) | |
download | alpine-conf-721d3e6d91e08e9abc24b7729eccb613d9d4d7b3.zip |
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
-rw-r--r-- | setup-alpine.in | 19 |
1 files 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} |