Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LHCb Core Software
LbEnvBootstrap
Commits
3600e0ae
Commit
3600e0ae
authored
May 03, 2019
by
Ben Couturier
Browse files
Merge branch 'allow-overriding-host-os-detection' into 'master'
Allow overriding of host_os detection See merge request
!10
parents
c5ab606f
6f545fe1
Pipeline
#839045
passed with stages
in 1 minute and 47 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
data/bin/host_os
View file @
3600e0ae
...
...
@@ -10,21 +10,27 @@
# or submit itself to any jurisdiction. #
###############################################################################
_os
=
unknown
if
[
-e
/etc/os-release
]
;
then
_os
=
$(
awk
-F
=
'/^ID=/{gsub("[.\"]|(-.*)", "", $2); n=tolower($2)}/^VERSION_ID/{gsub("[.\"]", "", $2); v=$2}END{print n""v}'
/etc/os-release
)
elif
[
-e
/etc/redhat-release
]
;
then
if
grep
-q
-E
'(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 7'
/etc/redhat-release
;
then
_os
=
centos7
elif
grep
-q
-E
'(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 6'
/etc/redhat-release
;
then
_os
=
slc6
elif
grep
-q
-E
'(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 5'
/etc/redhat-release
;
then
_os
=
slc5
if
[
-z
"
${
force_host_os
}
"
]
;
then
_os
=
unknown
if
[
-e
/etc/os-release
]
;
then
_os
=
$(
awk
-F
=
'/^ID=/{gsub("[.\"]|(-.*)", "", $2); n=tolower($2)}/^VERSION_ID/{gsub("[.\"]", "", $2); v=$2}END{print n""v}'
/etc/os-release
)
elif
[
-e
/etc/redhat-release
]
;
then
if
grep
-q
-E
'(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 7'
/etc/redhat-release
;
then
_os
=
centos7
elif
grep
-q
-E
'(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 6'
/etc/redhat-release
;
then
_os
=
slc6
elif
grep
-q
-E
'(CentOS|Scientific Linux|Red Hat Enterprise Linux).*release 5'
/etc/redhat-release
;
then
_os
=
slc5
fi
elif
[
-e
/etc/lsb-release
]
;
then
_os
=
$(
awk
-F
=
'/^DISTRIB_ID/{n=tolower($2)}/^DISTRIB_RELEASE/{gsub("\\.", "", $2); v=$2}END{print n""v}'
/etc/lsb-release
)
fi
elif
[
-e
/etc/lsb-release
]
;
then
_os
=
$(
awk
-F
=
'/^DISTRIB_ID/{n=tolower($2)}/^DISTRIB_RELEASE/{gsub("\\.", "", $2); v=$2}END{print n""v}'
/etc/lsb-release
)
else
(>
&2
echo
"warning: overriding host os detection (using
${
force_host_os
}
)"
)
_os
=
${
force_host_os
}
fi
# known compatibilities
case
"
${
_os
}
"
in
scientific7
*
|
rhel7
*
|
opensuse15
*
)
_os
=
centos7
;;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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