export hostname="$hostname"
export system_name="$system_name"
export gateway="$gateway"
+export mgmt_interface="eth0"
export ip_address_eth0="$ip_address_eth0"
export mac_address_eth0="$mac_address_eth0"
export system_status="${SYSTEM_STATUS}"
export ws_rel_filesdir="${WS_REL_FILESDIR}"
echo
-echo "hostname: '$hostname'"
-echo "system_name: '$system_name'"
-echo "gateway: '$gateway'"
-echo "ip_address_eth0: '$ip_address_eth0'"
-echo "mac_address_eth0: '$mac_address_eth0'"
-echo "System status: '${system_status}'"
+echo "hostname: '$hostname'"
+echo "system_name: '$system_name'"
+echo "gateway: '$gateway'"
+echo "Management interface: '${mgmt_interface}'"
+echo "ip_address_eth0: '$ip_address_eth0'"
+echo "mac_address_eth0: '$mac_address_eth0'"
+echo "System status: '${system_status}'"
#set $basic_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.001.basics.sh"
echo
echo "Using snippet $authkeys_snippet"
$SNIPPET($authkeys_snippet)
+#set $network_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.040.network.sh"
+echo
+echo "Using snippet $network_snippet"
+$SNIPPET($network_snippet)
+
#set $tweak_systemd_snippet = "per_status/" + $SYSTEM_STATUS + "/tpl.060.tweak_systemd.sh"
echo
echo "Using snippet $tweak_systemd_snippet"
echo " \$hostname: $hostname"
echo " \$system_name: $system_name"
echo " \$gateway: $gateway"
+echo " \$management_interface: ${mgmt_interface}"
echo " \$mac_address_eth0: $mac_address_eth0"
echo " \$ip_address_eth0: $ip_address_eth0"
echo " \$IP_ADDRESS_ETH0: $IP_ADDRESS_ETH0"
--- /dev/null
+## !/bin/bash
+#raw
+
+#-----------------------------------------------------------
+create_networkconfig() {
+
+ echo
+ echo "${HASH_LINE}"
+ echo
+ log "Generating network configuration ..."
+
+ local temp_dir=$( mktemp -p /tmp -d 'tmp.XXXXXXXXXX.cobbler' )
+ local tmp_nw_cfg="${temp_dir}/network"
+ local tmp_nw_script_dir="${temp_dir}/network-scripts"
+ local nw_script_dir="/etc/sysconfig/network-scripts"
+ local old_dir="${nw_script_dir}/.old"
+ local ifcfg_file=
+ local if_uuid=$( uuidgen -r )
+
+ mkdir -pv "${tmp_nw_script_dir}"
+ mkdir -pv "${old_dir}"
+
+ echo "Generating /etc/sysconfig/network ..."
+
+ grep -v 'GATEWAY|HOSTNAME' /etc/sysconfig/network > "${tmp_nw_cfg}"
+ echo "GATEWAY=${gateway}" >> "${tmp_nw_cfg}"
+ echo "HOSTNAME=${hostname}" >> "${tmp_nw_cfg}"
+ mv -v /etc/sysconfig/network "/etc/sysconfig/network.orig.$( date -r /etc/sysconfig/network +'%Y-%m-%d_%H:%M:%S' )"
+ mv -v "${tmp_nw_cfg}" /etc/sysconfig/network
+
+ echo "Generated /etc/sysconfig/network:"
+ cat /etc/sysconfig/network || true
+ echo
+
+ # Also set the hostname now, some applications require it
+ /bin/hostname "${hostname}"
+
+ local dev_file="${tmp_nw_script_dir}/ifcfg-${mgmt_interface}"
+ echo "Generating '${dev_file}' ..."
+
+ cat <<-EOF >"${dev_file}"
+ NAME="${mgmt_interface}"
+ DEVICE="${mgmt_interface}"
+ ONBOOT=yes
+ NETBOOT=yes
+ UUID="${if_uuid}"
+ IPV6INIT=yes
+ BOOTPROTO=dhcp
+ TYPE=Ethernet
+ EOF
+
+ for ifcfg_file in ${nw_script_dir}/ifcfg-* ; do
+ local bname=$(basename "${ifcfg_file}" )
+ if [[ "${bname}" == "ifcfg-lo" ]] ; then
+ continue
+ fi
+ mv -v "${ifcfg_file}" "${old_dir}"
+ done
+ mv -v "${dev_file}" "${nw_script_dir}"
+ rm -vrf "${temp_dir}"
+
+ echo "Generated ${nw_script_dir}/ifcfg-${mgmt_interface}:"
+ cat "${nw_script_dir}/ifcfg-${mgmt_interface}" || true
+ echo
+
+ echo
+ echo "${HASH_LINE}"
+ echo "Inhalt von /etc/sysconfig/network-scripts ..."
+ ls -lA /etc/sysconfig/network-scripts
+
+}
+
+create_networkconfig
+
+#end raw
+## vim: ts=4 et list
if wget -O "${mk_script}" --dns-timeout=2 --connect-timeout=3 --read-timeout=3 "${url}" ; then
chmod 0755 "${mk_script}"
"${mk_script}" > /etc/motd
+ mkdir -pv /root/bin
+ cp -pv "${mk_script}" /root/bin/create-motd.sh
else
echo "[$(date)]: Could not get 'mk_create_motd.ksh' from '${url}'." | tee -a "${ERROR_POINTER}"
fi