timezone needs to be fecthed from host
This commit is contained in:
+2
-2
@@ -144,7 +144,7 @@ function trap_error() {
|
|||||||
# local file="${0:-}"
|
# local file="${0:-}"
|
||||||
local err=$1 # error status
|
local err=$1 # error status
|
||||||
local line=$2 # LINENO
|
local line=$2 # LINENO
|
||||||
local linecallfunc=${3:-}
|
# local linecallfunc=${3:-}
|
||||||
local command="${4:-}"
|
local command="${4:-}"
|
||||||
local funcstack="${5:-}"
|
local funcstack="${5:-}"
|
||||||
local caller
|
local caller
|
||||||
@@ -340,7 +340,7 @@ EOF1
|
|||||||
function join() {
|
function join() {
|
||||||
local IFS="$1"
|
local IFS="$1"
|
||||||
shift
|
shift
|
||||||
echo "$*"
|
builtin echo "$*"
|
||||||
}
|
}
|
||||||
|
|
||||||
# execute remote scripting onto one LXC container <CONTAINER> [COMMANDS, ...]
|
# execute remote scripting onto one LXC container <CONTAINER> [COMMANDS, ...]
|
||||||
|
|||||||
@@ -423,12 +423,6 @@ else
|
|||||||
TARGET=${1:-}
|
TARGET=${1:-}
|
||||||
CURRENT_USER=$(id -un)
|
CURRENT_USER=$(id -un)
|
||||||
|
|
||||||
is_email_valid "pvincent" && echo OK || echo NOPE
|
|
||||||
is_email_valid "pvincent@aa" && echo OK || echo NOPE
|
|
||||||
is_email_valid "pvincent@artcode." && echo OK || echo NOPE
|
|
||||||
is_email_valid "pvincent@artcode.re" && echo OK || echo NOPE
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
sudo_required
|
sudo_required
|
||||||
check_target
|
check_target
|
||||||
install_miaou_bash
|
install_miaou_bash
|
||||||
|
|||||||
@@ -57,10 +57,14 @@ function create() {
|
|||||||
packages=(git file bc bash-completion)
|
packages=(git file bc bash-completion)
|
||||||
[[ "$OPTION_SSH" == true ]] && packages+=(openssh-server)
|
[[ "$OPTION_SSH" == true ]] && packages+=(openssh-server)
|
||||||
packages_string=$(join ', ' "${packages[@]}")
|
packages_string=$(join ', ' "${packages[@]}")
|
||||||
|
|
||||||
|
timezone='Indian/Reunion' #FIXME: should be retrieved from host
|
||||||
|
debian_repo='debian.mithril.re' #FIXME: should be retrieved from host
|
||||||
|
|
||||||
user_data="$(
|
user_data="$(
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
#cloud-config
|
#cloud-config
|
||||||
timezone: 'Indian/Reunion'
|
timezone: '$timezone'
|
||||||
apt:
|
apt:
|
||||||
preserve_sources_list: false
|
preserve_sources_list: false
|
||||||
conf: |
|
conf: |
|
||||||
@@ -68,19 +72,19 @@ apt:
|
|||||||
DPkg::Lock::Timeout "60";
|
DPkg::Lock::Timeout "60";
|
||||||
primary:
|
primary:
|
||||||
- arches: [default]
|
- arches: [default]
|
||||||
uri: http://debian.mithril.re/debian
|
uri: http://$debian_repo/debian
|
||||||
security:
|
security:
|
||||||
- arches: [default]
|
- arches: [default]
|
||||||
uri: http://debian.mithril.re/debian-security
|
uri: http://$debian_repo/debian-security
|
||||||
sources_list: |
|
sources_list: |
|
||||||
# generated by miaou-cloud
|
# generated by miaou
|
||||||
deb \$PRIMARY \$RELEASE main
|
deb \$PRIMARY \$RELEASE main
|
||||||
deb \$PRIMARY \$RELEASE-updates main
|
deb \$PRIMARY \$RELEASE-updates main
|
||||||
deb \$SECURITY \$RELEASE-security main
|
deb \$SECURITY \$RELEASE-security main
|
||||||
package_update: true
|
package_update: true
|
||||||
package_upgrade: true
|
package_upgrade: true
|
||||||
package_reboot_if_required: true
|
package_reboot_if_required: true
|
||||||
packages: $packages_string
|
packages: [ $packages_string ]
|
||||||
write_files:
|
write_files:
|
||||||
- path: /etc/sudoers.d/10-add_TOOLBOX_to_secure_path
|
- path: /etc/sudoers.d/10-add_TOOLBOX_to_secure_path
|
||||||
content: >
|
content: >
|
||||||
@@ -96,6 +100,7 @@ runcmd:
|
|||||||
final_message: "Container from datasource \$datasource is finally up, after \$UPTIME seconds"
|
final_message: "Container from datasource \$datasource is finally up, after \$UPTIME seconds"
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
|
|
||||||
lxc init local:debian/$CONTAINER_RELEASE/cloud "$CONTAINER" --config user.user-data="$user_data" -q
|
lxc init local:debian/$CONTAINER_RELEASE/cloud "$CONTAINER" --config user.user-data="$user_data" -q
|
||||||
|
|
||||||
# allow directory `SHARED` to be read-write mounted
|
# allow directory `SHARED` to be read-write mounted
|
||||||
@@ -159,7 +164,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$OPTION_SSH" == true && "$OPTION_SAMEUSER" == true ]]; then
|
if [[ "$OPTION_SSH" == true && "$OPTION_SAMEUSER" == true ]]; then
|
||||||
lxc-miaou-enable-ssh "$CONTAINER"
|
lxc-miaou-enable-ssh "$CONTAINER" >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PREFIX="" echoinfo OK
|
PREFIX="" echoinfo OK
|
||||||
|
|||||||
Reference in New Issue
Block a user