populate pillars dynamically during installation

This commit is contained in:
LinuxSquare 2024-03-09 17:50:19 +01:00
parent 48f848de3e
commit a73987107f

View file

@ -223,6 +223,10 @@ function prepareInstallation() {
INSTALLATION_DOMAIN=$(dialog --clear --title "What's the domain of this device?" --inputbox "Enter domain (leave empty for localhost)" 10 70 3>&1 1>&2 2>&3 3>&-)
[[ -z "$INSTALLATION_DOMAIN" ]] && INSTALLATION_DOMAIN="localhost"
# additional states
ADDITIONAL_STATES=$(dialog --clear --title "Select additional states to execute" --checklist "available states" 10 70 3 podman "" false 3>&1 1>&2 2>&3 3>&-)
IFS=' ' read -ra ADDITIONAL_STATES_ARR <<< "$ADDITIONAL_STATES"
# show summary
summary
}
@ -407,12 +411,21 @@ os: Alpine
os_family: Alpine
EOT
installationSubtaskTitle "Clone Pillar-Repo"
installationSubtaskTitle "Populate Pillars"
mkdir -p ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}
git clone ${INSTALLATION_PILLAR_GIT} ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}
#git clone ${INSTALLATION_PILLAR_GIT} ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}
cat >"${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}/top.sls" << EOT
base:
'*':
EOT
for state in $(find ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_SALT_ROOT} -mindepth 1 -maxdepth 1 -not -path '*/.*' -type d -exec basename {} \;); do
mkdir -p ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}/${state}
touch ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}/${state}/init.sls
echo -e " - $state" >> ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}/top.sls
done
cat >"${INSTALLATION_MOUNTPOINT}/${INSTALLATION_PILLAR_ROOT}/system/init.sls" << EOT
timestamp: ${START_TIMESTAMP}
system.timestamp: ${START_TIMESTAMP}
EOT
installationSubtaskTitle "Salt highstate"