Subversion Repositories ALCASAR

Rev

Rev 2454 | Rev 2488 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2454 Rev 2472
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# $Id: alcasar-importcert.sh 2454 2017-12-09 18:59:31Z tom.houdayer $
3
# $Id: alcasar-importcert.sh 2472 2017-12-29 23:49:24Z tom.houdayer $
4
#
4
#
5
# alcasar-importcert.sh
5
# alcasar-importcert.sh
6
# by Raphaël, Hugo, Clément, Bettyna & rexy
6
# by Raphaël, Hugo, Clément, Bettyna & rexy
7
#
7
#
8
# This script is distributed under the Gnu General Public License (GPL)
8
# This script is distributed under the Gnu General Public License (GPL)
Line 50... Line 50...
50
	if [[ $fqdn == *"*"* ]];
50
	if [[ $fqdn == *"*"* ]];
51
	then
51
	then
52
		hostname="alcasar"
52
		hostname="alcasar"
53
		fqdn=${fqdn/"*"/$hostname}
53
		fqdn=${fqdn/"*"/$hostname}
54
	else
54
	else
55
		hostname=`echo $fqdn | awk -F'.' '{ print $1 }'`
55
		hostname=$(echo $fqdn | cut -d'.' -f1)
56
	fi
56
	fi
57
	domain=`echo $fqdn | awk -F'.' '{$1="";OFS=".";print $0}' | sed 's/^.//'`
57
	domain=$(echo $fqdn | cut -d'.' -f2-)
58
	echo "fqdn=$fqdn hostname=$hostname domain=$domain"
58
	echo "fqdn=$fqdn hostname=$hostname domain=$domain"
59
 
59
 
60
	#check fqdn format
60
	#check fqdn format
61
	if [[ "$fqdn" != "" && "$domain" != "" ]]; then
61
	if [[ "$fqdn" != "" && "$domain" != "" ]]; then
62
		$SED "s/^HOSTNAME=.*/HOSTNAME=$hostname/g" /usr/local/etc/alcasar.conf
62
		$SED "s/^HOSTNAME=.*/HOSTNAME=$hostname/g" /usr/local/etc/alcasar.conf