From d91215c3781fe7e72587ff1bd5291a08eb760c05 Mon Sep 17 00:00:00 2001 From: nott Date: Wed, 15 Dec 2010 18:27:07 +0000 Subject: [PATCH] sample postscript for creating resolv.conf file git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8424 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/mkresolvconf | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 xCAT/postscripts/mkresolvconf diff --git a/xCAT/postscripts/mkresolvconf b/xCAT/postscripts/mkresolvconf new file mode 100755 index 000000000..3972f4370 --- /dev/null +++ b/xCAT/postscripts/mkresolvconf @@ -0,0 +1,33 @@ +#!/bin/sh +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# +#--------------------------------------------------------------------------- +# create an /etc/resolv.conf file on the node +# +# - this script assumes the nameserver for the node will be +# the value of the "xcatmaster" attribute (SN as known by +# the node) or the name of the management node as known +# by the node. + +#--------------------------------------------------------------------------- + +conf_file="/etc/resolv.conf" +conf_file_bak="/etc/resolv.conf.bak" + +# get values set when the myxcatpost_ script was run +master=$MASTER # this is the ip for the nodes xcatmaster attribute +domain=$DOMAIN # this is the domain name used in this cluster +node=$NODE + +if [[ -n "$master" ]] && [[ -n "$domain" ]]; then + + #logger -t xcat "Created /etc/resolv.conf file on $node." + cp $conf_file $conf_file_bak > /dev/null 2>&1 + echo "search $domain" >$conf_file + echo "nameserver $master" >>$conf_file +else + logger -t xcat "Could not create resolv.conf on $node." + exit 1 +fi + +exit 0