ubuntu-cloud-prep revision 5d066f24e65ef482cdfee241ce65e060d1652efc
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## If the container being cloned has one or more lxc.hook.clone
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## specified, then the specified hooks will be called for the new
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## container. The arguments passed to the clone hook are:
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## 1. the container name
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## 2. a section ('lxc')
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## 3. hook type ('clone')
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## 4. .. additional arguments to lxc-clone
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## Environment variables:
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## LXC_ROOTFS_MOUNT: path to the root filesystem
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## LXC_CONFIG_FILE: path to config file
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## LXC_SRC_NAME: old container name
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync## LXC_ROOTFS_PATH: path or device on which the root fs is located
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncdebug() { [ "$VERBOSITY" -ge "$1" ] || return 0; shift; error "$@"; }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsyncUsage: ${0##*/} [options] root-dir
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync root-dir is the root directory to operate on
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync [ -C | --cloud ]: do not configure a datasource. incompatible with
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync options marked '[ds]'
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync [ -i | --instance-id]: instance-id for cloud-init, defaults to random [ds]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync [ -L | --nolocales ]: Do not copy host's locales into container
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync [ -S | --auth-key ]: ssh public key file for datasource [ds]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync [ -u | --userdata ]: user-data file for cloud-init [ds]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync [ -V | --vendordata ]: vendor-data file for cloud-init [ds]
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync local long_opts="auth-key:,cloud,help,hostid:,name:,nolocales:,create-etc-init,userdata:,vendordata:,verbose"
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync --options "${short_opts}" --long "${long_opts}" -- "$@" 2>/dev/null) ||
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync if [ $getopt_ret -eq 0 ]; then
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { error "Unexpected error reading usage"; return 1; }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync local vendordata="" userdata="" hostid="" authkey="" locales=1 cloud=0
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync while [ $# -ne 0 ]; do
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync -h|--help) prep_usage; return 0;;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { error "--auth-key: '$next' not a file"; return 1; }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { error "--vendordata: '$next' not a file"; return 1; }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync { error "--userdata: '$next' not a file"; return 1; }
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync --) shift; break;;
prep_usage 1>&2;
[ $? -eq 0 ] ||
local _LXC_HOOK