Browse Source

environment variable EMAIL

main
pvincent 8 months ago
parent
commit
493ddabc88
  1. 28
      lib/install.sh

28
lib/install.sh

@ -28,7 +28,7 @@ function prepare_lxd {
sudo groupadd --force "$NEW_GROUP"
sudo usermod --append --groups "$NEW_GROUP" "$(whoami)"
sg "$NEW_GROUP" -c "$0 SESSION_RELOAD_REQUIRED $TARGET $@"
sg "$NEW_GROUP" -c "env EMAIL=$valid_email $0 SESSION_RELOAD_REQUIRED $TARGET"
sg "$NEW_GROUP" -c bash
kill -9 "$PPID"
# no further processing because exec has been called!
@ -41,7 +41,7 @@ function prepare_lxd {
override_lxd_service
# test lxdbr0
# test lxdbr0 FIXME: preseed too much repetitions!!!!
if ! lxc network info lxdbr0 &>/dev/null; then
echo "bridge <lxdbr0> down, so initialization will use default preseed..."
@ -132,6 +132,11 @@ networks:
config:
ipv4.address: auto
ipv6.address: none
storage_pools:
- config: {}
description: ""
name: default
driver: dir
profiles:
- config: {}
description: ""
@ -385,6 +390,9 @@ EOF
function ask_for_email {
local PREFIX="install:ask_for_email"
valid_email=$(auto_detect_email)
echo "valid_email=$valid_email" && exit 1
while ! is_email_valid "$valid_email"; do
echo -n "mandatory email: "
read -rei "$valid_email" valid_email
@ -410,12 +418,14 @@ function is_email_valid {
}
function auto_detect_email {
found_email=""
if [[ -f $HOME/.ssh/authorized_keys ]]; then
while IFS= read -r line; do
found_email="$line"
is_email_valid "$found_email" && break
done < <(cut -d ' ' -f3 <"$HOME/.ssh/authorized_keys")
found_email="${EMAIL:-}"
if ! is_email_valid "$found_email"; then
if [[ -f $HOME/.ssh/authorized_keys ]]; then
while IFS= read -r line; do
found_email="$line"
is_email_valid "$found_email" && break
done < <(cut -d ' ' -f3 <"$HOME/.ssh/authorized_keys")
fi
fi
builtin echo "$found_email"
@ -458,7 +468,7 @@ else
# prepare_toolbox
# add_toolbox_sudoers
prepare_nftables
prepare_lxd $@
prepare_lxd
preload_bookworm_image
miaou_resolver
miaou_evalfrombashrc

Loading…
Cancel
Save