#!/bin/sh #------------------------------------------------------------------------------ # /var/install/bin/addhost-update-static-params - update static parameters # # Copyright (c) 2001-2022 The Eisfair Team, team(at)eisfair(dot)org> # # Creation : 2009-11-25 jed # Last update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #------------------------------------------------------------------------------ # include eislib etc. . /var/install/include/eislib . /var/install/include/check-eisfair-version #exec 2>/tmp/addhost-update-static-params-$$.log #set -x module_name='addhost' basefile=/etc/config.d/base configfile=/etc/config.d/${module_name} . ${basefile} # set platform specific parameters case ${EISFAIR_SYSTEM} in eisfair-2|eisxen-1) # eisfair-2 if [ "${IP_NET_1_STATIC_IP}" = "no" ] then localhost_ipaddr="'dhcp: `dnsip ${HOSTNAME}.${DOMAIN_NAME} | sed 's/ *//g'`'" else localhost_ipaddr="${IP_NET_1_IPADDR}" fi localhost_name="${HOSTNAME}.${DOMAIN_NAME}" localhost_alias="${HOSTNAME}" ;; *) # default to eisfair-1 localhost_ipaddr="${IP_ETH_1_IPADDR}" localhost_name="${HOSTNAME}.${DOMAIN_NAME}" localhost_alias="${HOSTNAME}" ;; esac # update static data if [ -n "${localhost_ipaddr}" -a -n "${localhost_name}" ] then cp ${configfile} ${configfile}.tmp { sed -e "/ADDHOST_LOCALHOST_IPADDR/s/=[\"\'].*[\"\']/=\"${localhost_ipaddr}\"/g" \ -e "/ADDHOST_LOCALHOST_NAME/s/=[\"\'].*[\"\']/=\"${localhost_name}\"/g" \ -e "/ADDHOST_LOCALHOST_ALIAS/s/=[\"\'].*[\"\']/=\"${localhost_alias}\"/g" ${configfile}.tmp } > ${configfile} chmod 600 ${configfile} rm -f ${configfile}.tmp else mecho --error "Unable to update static parameters, please check base configuration." anykey fi exit 0