tests: Force hostname as 'autopkgtest' if the system didn't have one.

This commit is contained in:
Timo Aaltonen
2018-02-02 17:27:30 +02:00
parent af3391ac59
commit 8544ec3ccd
2 changed files with 14 additions and 6 deletions

2
debian/changelog vendored
View File

@@ -2,6 +2,8 @@ freeipa (4.6.3-1) UNRELEASED; urgency=medium
* New upstream release.
* support-kdb-dal-7.0.diff: Dropped, upstream.
* tests: Force hostname as 'autopkgtest' if the system didn't have
one.
-- Timo Aaltonen <tjaalton@debian.org> Thu, 01 Feb 2018 14:14:10 +0200

View File

@@ -2,14 +2,20 @@
# hack for lxc
IP=`ip route get 1.1.1.1 | sed -n -e's/.*src //; s/ .*//; p; q'`
HOSTNAME=`cat /etc/hosts| grep '127.0.1.1' | awk '{print $NF; exit}'`
echo "IP address is $IP"
HOSTNAME=`cat /etc/hosts| grep '127.0.1.1' | awk '{print $NF; exit}' | sed 's/\..*//'`
echo "Hostname was: $HOSTNAME"
if [ -z $HOSTNAME ]; then
HOSTNAME=autopkgtest
hostname $HOSTNAME
echo $HOSTNAME > /etc/hostname
fi
echo "$IP $HOSTNAME.debci $HOSTNAME" >> /etc/hosts
echo "IP address is $IP"
echo "Hostname is: $HOSTNAME"
echo "/etc/hostname has:"
cat /etc/hostname
echo "/etc/hosts has:"
echo "/etc/hosts now has:"
cat /etc/hosts
if [ ! -d /etc/systemd/system/pki-tomcatd.target.wants ]; then