diff options
Diffstat (limited to 'lib/container')
-rwxr-xr-x | lib/container/create | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/container/create b/lib/container/create index d267641..cfee91a 100755 --- a/lib/container/create +++ b/lib/container/create @@ -25,8 +25,8 @@ MACHINES="/var/lib/machines" Parameters () { - LONG_OPTIONS="name:,bind:,script:" - OPTIONS="n:,b:,s:" + LONG_OPTIONS="name:,cnt.autostart:,bind:,script:" + OPTIONS="n:,b:,c:,d:,s:" PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${COMMAND} --options ${OPTIONS} --shell sh -- ${@})" @@ -46,6 +46,11 @@ Parameters () shift 2 ;; + --cnt.autostart) + CNT_AUTOSTART="${2}" + shift 2 + ;; + -b|--bind) BIND="${2}" shift 2 @@ -71,7 +76,7 @@ Parameters () Usage () { - echo "Usage: container ${COMMAND} -n|--name NAME [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [-s|--script SCRIPT] [-- SCRIPT_OPTIONS]" >&2 + echo "Usage: container ${COMMAND} -n|--name NAME [--cnt.autostart=true|false|FQDN] [-b|--bind DIRECTORY:DIRECTORY[:OPTIONS]] [-s|--script SCRIPT] [-- SCRIPT_OPTIONS]" >&2 exit 1 } @@ -95,6 +100,8 @@ then echo "'${SCRIPT}': no such script" >&2 fi +CNT_AUTOSTART="${CNT_AUTOSTART:-$(hostname -f)}" + BINDS="$(echo ${BIND} | sed -e 's|;| |g')" for ENTRY in ${BINDS} @@ -110,7 +117,8 @@ done # config mkdir -p "${CONFIG}" -sed -e "s|@NAME@|${NAME}|g" \ +sed -e "s|@CNT_AUTOSTART@|${CNT_AUTOSTART}|g" \ + -e "s|@NAME@|${NAME}|g" \ -e "s|@BIND@|${BIND}|g" \ -e "s|@BOOT@|yes|g" \ -e "s|@DIRECTORY@|${MACHINES}/${NAME}|g" \ |