Browse Source

timezone needs to be fecthed from host

main
pvincent 9 months ago
parent
commit
200cf95cbe
  1. 4
      lib/functions.sh
  2. 6
      lib/install.sh
  3. 17
      scripts/lxc-miaou-create

4
lib/functions.sh

@ -144,7 +144,7 @@ function trap_error() {
# local file="${0:-}"
local err=$1 # error status
local line=$2 # LINENO
local linecallfunc=${3:-}
# local linecallfunc=${3:-}
local command="${4:-}"
local funcstack="${5:-}"
local caller
@ -340,7 +340,7 @@ EOF1
function join() {
local IFS="$1"
shift
echo "$*"
builtin echo "$*"
}
# execute remote scripting onto one LXC container <CONTAINER> [COMMANDS, ...]

6
lib/install.sh

@ -423,12 +423,6 @@ else
TARGET=${1:-}
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
check_target
install_miaou_bash

17
scripts/lxc-miaou-create

@ -57,10 +57,14 @@ function create() {
packages=(git file bc bash-completion)
[[ "$OPTION_SSH" == true ]] && packages+=(openssh-server)
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="$(
cat <<EOF
#cloud-config
timezone: 'Indian/Reunion'
timezone: '$timezone'
apt:
preserve_sources_list: false
conf: |
@ -68,19 +72,19 @@ apt:
DPkg::Lock::Timeout "60";
primary:
- arches: [default]
uri: http://debian.mithril.re/debian
uri: http://$debian_repo/debian
security:
- arches: [default]
uri: http://debian.mithril.re/debian-security
uri: http://$debian_repo/debian-security
sources_list: |
# generated by miaou-cloud
# generated by miaou
deb \$PRIMARY \$RELEASE main
deb \$PRIMARY \$RELEASE-updates main
deb \$SECURITY \$RELEASE-security main
package_update: true
package_upgrade: true
package_reboot_if_required: true
packages: $packages_string
packages: [ $packages_string ]
write_files:
- path: /etc/sudoers.d/10-add_TOOLBOX_to_secure_path
content: >
@ -96,6 +100,7 @@ runcmd:
final_message: "Container from datasource \$datasource is finally up, after \$UPTIME seconds"
EOF
)"
lxc init local:debian/$CONTAINER_RELEASE/cloud "$CONTAINER" --config user.user-data="$user_data" -q
# allow directory `SHARED` to be read-write mounted
@ -159,7 +164,7 @@ EOF
fi
if [[ "$OPTION_SSH" == true && "$OPTION_SAMEUSER" == true ]]; then
lxc-miaou-enable-ssh "$CONTAINER"
lxc-miaou-enable-ssh "$CONTAINER" >/dev/null
fi
PREFIX="" echoinfo OK

Loading…
Cancel
Save