file creation change install-<mac> to <mac>-install
This commit is contained in:
parent
40fd893bfb
commit
c95a047516
18
deploy.sh
18
deploy.sh
|
@ -4,7 +4,7 @@
|
|||
# shellcheck disable=SC2154
|
||||
|
||||
# CONF_FILE "_vms.conf" needs to have the following variables:
|
||||
## Server config for install-<mac>.conf
|
||||
## Server config for <MAC>-install.conf
|
||||
#SERVER="server1"
|
||||
#DOMAIN="example.com"
|
||||
## IP / MAC config
|
||||
|
@ -109,7 +109,7 @@ fetch_ipv6() {
|
|||
}
|
||||
|
||||
generate_passwd() {
|
||||
# Generate a random password for the install-<MAC>.conf file.
|
||||
# Generate a random password for the <MAC>-install.conf file.
|
||||
# Doesn't take variables
|
||||
#tr -cd '[:alnum:]' < /dev/urandom | fold -w 20 | head -n 1
|
||||
jot -rcs '' 20 33 126
|
||||
|
@ -216,10 +216,10 @@ render_dhcpd_conf() {
|
|||
}
|
||||
|
||||
render_install_conf() {
|
||||
# Generate install-<mac>.comf
|
||||
# Generate <MAC>-install.comf
|
||||
# Takes defaults from of _vms.conf and iterate over the vm*.txt files.
|
||||
# When the VM image doesn't exist create the install-<mac>.conf file.
|
||||
# When the VM image does exist remove the install-<mac>.conf file.
|
||||
# When the VM image doesn't exist create the <MAC>-install.conf file.
|
||||
# When the VM image does exist remove the <MAC>-install.conf file.
|
||||
# fetch_ipv6() to get the correct IPv6 address of the VM.
|
||||
# fetch_mac() to get the correct MAC address of the VM.
|
||||
while read -r f
|
||||
|
@ -232,7 +232,7 @@ render_install_conf() {
|
|||
_mac=$(fetch_mac "$MAC_PREFIX" "$(find_vm "$VMS" "$_instance")")
|
||||
if ! test -f "${IMAGES}/${_instance}.img"
|
||||
then
|
||||
cat <<-EOF > "${HTDOCS}/install-${_mac}.conf"
|
||||
cat <<-EOF > "${HTDOCS}/${_mac}-install.conf"
|
||||
#
|
||||
# File generated on $date
|
||||
#
|
||||
|
@ -254,10 +254,10 @@ render_install_conf() {
|
|||
Continue anyway = yes
|
||||
Continue without verification = yes
|
||||
EOF
|
||||
echo "Install file created: ${HTDOCS}/install-${_mac}.conf"
|
||||
echo "Install file created: ${HTDOCS}/${_mac}-install.conf"
|
||||
else
|
||||
if test -f "${HTDOCS}/install-${_mac}.conf"
|
||||
then rm -rf "${HTDOCS}/install-${_mac}.conf"
|
||||
if test -f "${HTDOCS}/${_mac}-install.conf"
|
||||
then rm -rf "${HTDOCS}/${_mac}-install.conf"
|
||||
fi
|
||||
fi
|
||||
clear_variables
|
||||
|
|
Loading…
Reference in New Issue