Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image
Commits
93c76023
Commit
93c76023
authored
Sep 23, 2014
by
Nikos Skalkotos
Browse files
Detect CoreOS in get_base_distro()
parent
481cc9e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-image-helper/common.sh.in
View file @
93c76023
...
...
@@ -181,7 +181,9 @@ system_poweroff() {
get_base_distro() {
local root_dir=$1
if [ -e "$root_dir/etc/debian_version" ]; then
if [ -d "$root_dir/etc/coreos" ]; then
echo "coreos"
elif [ -e "$root_dir/etc/debian_version" ]; then
echo "debian"
elif [ -e "$root_dir/etc/redhat-release" ]; then
echo "redhat"
...
...
snf-image-helper/tasks/50AssignHostname.in
View file @
93c76023
...
...
@@ -66,6 +66,8 @@ linux_hostname() {
else
distro
=
$(
get_base_distro
"
$target
"
)
case
"
$distro
"
in
coreos
)
echo
"
$hostname
"
>
"
$target
/etc/hostname"
;;
redhat
)
sed
-i
-e
"s/HOSTNAME=.*
$/
HOSTNAME=
$hostname
/g"
"
$target
/etc/sysconfig/network"
;;
slackware|suse
)
...
...
@@ -95,7 +97,9 @@ linux_hostname() {
# Some Linux distributions assign the hostname to 127.0.1.1 in order to be
# resolvable to an IP address. Lets replace this if found in /etc/hosts
sed
-i
-e
"s/^[[:blank:]]*127
\.
0
\.
1
\.
1[[:blank:]].
\+
$/
127.0.1.1
\t
$hostname
/"
"
$target
/etc/hosts"
if
[
-f
"
$target
/etc/hosts"
]
;
then
sed
-i
-e
"s/^[[:blank:]]*127
\.
0
\.
1
\.
1[[:blank:]].
\+
$/
127.0.1.1
\t
$hostname
/"
"
$target
/etc/hosts"
fi
}
freebsd_hostname
()
{
...
...
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