Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ian Eiloart
Sympl
Commits
104ba047
Commit
104ba047
authored
Jul 02, 2019
by
Paul Cammish
Browse files
Don't enforce the hostname, but warn on install script
parent
e42f61b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/debian/postinst
View file @
104ba047
...
...
@@ -97,23 +97,23 @@ fi
# partially mangled hosts files, but will deal with someone changing the
# hostname but not also changing /etc/hosts
#
if
[
$(
grep
-c
$_HOSTNAME
'/etc/hosts'
)
==
0
]
;
then
echo
"I: Updating hostname configuration with complete name."
if
hostname
-i
>
/dev/null
;
then
hostname_ips
=
"
$(
hostname
-i
)
"
else
hostname_ips
=
"127.0.1.1"
fi
sed
-i
"s|^
$hostname_ips
|#
$hostname_ips
|"
'/etc/hosts'
sed
-i
"1i
$hostname_ips
\t
$_HOSTNAME
$(
echo
$_HOSTNAME
|
cut
-d
'.'
-f
1
)
"
'/etc/hosts'
export
HOSTNAME
=
"
$_HOSTNAME
"
hostname
-b
"
$_HOSTNAME
"
fi
#
if [ $( grep -c $_HOSTNAME '/etc/hosts' ) == 0 ]; then
#
echo "I: Updating hostname configuration with complete name."
#
if hostname -i > /dev/null ; then
#
hostname_ips="$( hostname -i )"
#
else
#
hostname_ips="127.0.1.1"
#
fi
#
sed -i "s|^$hostname_ips|# $hostname_ips|" '/etc/hosts'
#
sed -i "1i$hostname_ips\t$_HOSTNAME $( echo $_HOSTNAME | cut -d '.' -f 1 )" '/etc/hosts'
#
export HOSTNAME="$_HOSTNAME"
#
hostname -b "$_HOSTNAME"
#
fi
#
# Enforce using the full hostname
#
echo
"I: Checking hostname configuration files."
#
echo "I: Checking hostname configuration files."
if
[
"
$HOSTNAME
"
!=
"
$_HOSTNAME
"
]
;
then
export
HOSTNAME
=
"
$_HOSTNAME
"
;
fi
if
[
"
$(
hostname
)
"
!=
"
$_HOSTNAME
"
]
;
then
hostname
-b
"
$_HOSTNAME
"
;
fi
if
[
"
$(
cat
/etc/hostname
)
"
!=
"
$_HOSTNAME
"
]
;
then
echo
"
$_HOSTNAME
"
>
"/etc/hostname"
;
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment