Skip to content

Commit d12c461

Browse files
authored
Merge pull request #132 from riiengineering/oraclelinux-support
Add support for Oracle (Enterprise) Linux
2 parents 3dc76a8 + 1fdf714 commit d12c461

File tree

17 files changed

+55
-35
lines changed

17 files changed

+55
-35
lines changed

explorer/os

+6
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ then
9393
exit 0
9494
fi
9595

96+
if test -f /etc/oracle-release || test -f /etc/enterprise-release
97+
then
98+
echo oraclelinux
99+
exit 0
100+
fi
101+
96102
if test -f /etc/redhat-release
97103
then
98104
if grep -q '^CentOS ' /etc/redhat-release

explorer/os_version

+11
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ in
184184
(redhat|centos|almalinux|eurolinux|rocky|mitel|scientific)
185185
sed -e 's/^\([A-Za-z]* \)*release \(.*\) (.*)$/\2/' /etc/redhat-release
186186
;;
187+
(oraclelinux)
188+
if test -r /etc/oracle-release
189+
then
190+
# Oracle Linux >= 5
191+
sed -e 's/^\([A-Za-z]* \)*release \(.*\)$/\2/' /etc/oracle-release
192+
elif test -r /etc/enterprise-release
193+
then
194+
# older versions
195+
sed -e 's/^\([A-Za-z]* \)*release \(.*\) (.*)$/\2/' /etc/enterprise-release
196+
fi
197+
;;
187198
(slackware)
188199
sed -e 's/^Slackware //' /etc/slackware-version
189200
;;

type/__hostname/gencode-remote

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ else
3232
case ${os}
3333
in
3434
# RedHat-derivatives and BSDs
35-
(centos|fedora|redhat|scientific|freebsd|macosx|netbsd|openbsd)
35+
(centos|fedora|redhat|scientific|oraclelinux|freebsd|macosx|netbsd|openbsd)
3636
# Hostname is FQDN
3737
name_should=${__target_host:?}
3838
;;
@@ -67,7 +67,7 @@ in
6767
"&& hostnamectl set-hostname '${name_should}'" \
6868
"|| hostname '${name_should}'"
6969
;;
70-
(centos|fedora|redhat|scientific|crux|freebsd|netbsd|openbsd|gentoo|void)
70+
(centos|fedora|redhat|scientific|oraclelinux|crux|freebsd|netbsd|openbsd|gentoo|void)
7171
echo "hostname '${name_should}'"
7272
;;
7373
(openwrt)

type/__hostname/manifest

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ else
3636
case ${os}
3737
in
3838
# RedHat-derivatives and BSDs
39-
(centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|slackware|suse)
39+
(centos|fedora|redhat|scientific|oraclelinux|freebsd|netbsd|openbsd|slackware|suse)
4040
# Hostname is FQDN
4141
name_should=${__target_host:?}
4242
;;
@@ -77,7 +77,7 @@ in
7777
# --value "\"${name_should}\""
7878
fi
7979
;;
80-
(centos|fedora|redhat|scientific)
80+
(centos|fedora|redhat|scientific|oraclelinux)
8181
if test -z "${has_hostnamectl}"
8282
then
8383
# Only write to /etc/sysconfig/network on non-systemd versions.

type/__hwclock/manifest

+6-7
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ in
6262
unset -v CDIST_ORDER_DEPENDENCY
6363
fi
6464
;;
65-
(centos|fedora|redhat|scientific)
65+
(centos|fedora|redhat|scientific|oraclelinux)
6666
read -r os_version <"${__global:?}/explorer/os_version"
6767
os_major=${os_version%%[!0-9]*}
6868
case ${os}
6969
in
70-
(centos|almalinux|rocky|scientific|eurolinux)
70+
(centos|almalinux|rocky|scientific|eurolinux|oraclelinux)
7171
update_sysconfig=$(test $((os_major)) -lt 6 && echo true || echo false)
7272
;;
7373
(fedora)
@@ -90,17 +90,16 @@ in
9090
;;
9191
esac
9292

93-
if ${update_sysconfig:?}
93+
if ${update_sysconfig?}
9494
then
95-
export CDIST_ORDER_DEPENDENCY=true
9695
__file /etc/sysconfig/clock --state present \
97-
--owner root --group root --mode 0644
96+
--owner 0 --group 0 --mode 0644
97+
require=__file/etc/sysconfig/clock \
9898
__key_value /etc/sysconfig/clock:UTC \
9999
--file /etc/sysconfig/clock \
100-
--key UTC \
101100
--delimiter '=' --exact_delimiter \
101+
--key 'UTC' \
102102
--value "$(${local_clock?} && echo false || echo true)"
103-
unset -v CDIST_ORDER_DEPENDENCY
104103
fi
105104
;;
106105
(debian|devuan|ubuntu)

type/__locale_system/manifest

+6-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ in
8383
(archlinux)
8484
locale_conf='/etc/locale.conf'
8585
;;
86-
(centos|redhat|scientific)
86+
(redhat|centos|almalinux|eurolinux|rocky|oraclelinux)
87+
# NOTE: This is a hack to differentiate Red Hat Linux from
88+
# RHEL. Red Hat Linux >= 7 does not have os-release and will
89+
# thus fall back to /etc/sysconfig/i18n.
8790
# shellcheck source=/dev/null
8891
version_id=$(. "${__global:?}/explorer/os_release" && echo "${VERSION_ID:-0}")
8992
if version_ge "${version_id}" 7
@@ -94,9 +97,8 @@ in
9497
fi
9598
;;
9699
(fedora)
97-
# shellcheck source=/dev/null
98-
version_id=$(. "${__global:?}/explorer/os_release" && echo "${VERSION_ID:-0}")
99-
if version_ge "${version_id}" 18
100+
read -r os_version <"${__global:?}/explorer/os_version"
101+
if version_ge "${os_version}" 18
100102
then
101103
locale_conf='/etc/locale.conf'
102104
quote_value=false

type/__localedef/gencode-remote

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ in
7272
printf '%s does not support locales.\n' "${os}" >&2
7373
exit 1
7474
;;
75-
(archlinux|debian|devuan|ubuntu|suse|centos|almalinux|eurolinux|rocky|fedora|redhat|scientific)
75+
(archlinux|debian|devuan|ubuntu|suse|centos|almalinux|eurolinux|rocky|fedora|redhat|scientific|oraclelinux)
7676
# FIXME: The code below only works for glibc-based installations.
7777

7878
# NOTE: Hardcoded, create a pull request in case it is at another

type/__package/manifest

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ else
3232
os=$(cat "${__global:?}/explorer/os")
3333
case ${os}
3434
in
35-
(amazon|scientific|centos|almalinux|eurolinux|rocky|fedora|redhat) type='yum' ;;
35+
(amazon|scientific|centos|almalinux|eurolinux|oraclelinux|rocky|fedora|redhat)
36+
type='yum' ;;
3637
(archlinux) type='pacman' ;;
3738
(debian|ubuntu|devuan) type='apt' ;;
3839
(freebsd)

type/__package_yum/gencode-remote

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ state_should=$(cat "${__object:?}/parameter/state")
3939
os=$(cat "${__global:?}/explorer/os")
4040
case ${os}
4141
in
42-
(scientific|centos|almalinux|eurolinux|rocky|redhat|amazon)
42+
(scientific|centos|almalinux|eurolinux|rocky|redhat|oraclelinux|amazon)
4343
opts='-y --quiet' ;;
4444
(*)
4545
opts='--assumeyes --quiet' ;;

type/__sensible_editor/manifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ in
5858
version_ge "${os_version}" 10.04 || package_name='debianutils'
5959
pkg_type='apt'
6060
;;
61-
(centos|fedora|redhat|scientific)
61+
(centos|fedora|redhat|scientific|oraclelinux)
6262
pkg_type='yum'
6363
;;
6464
(*)

type/__sshd_config/manifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ state_should=$(cat "${__object:?}/parameter/state")
2424

2525
case ${os}
2626
in
27-
(alpine|centos|almalinux|eurolinux|rocky|fedora|redhat|scientific|debian|devuan|ubuntu)
27+
(alpine|centos|almalinux|eurolinux|rocky|fedora|redhat|scientific|oraclelinux|debian|devuan|ubuntu)
2828
if test "${state_should}" != 'absent'
2929
then
3030
__package openssh-server --state present

type/__start_on_boot/explorer/state

+7-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,13 @@ else
6363
[ -f "/etc/init/${name}.conf" ] && state='present'
6464
;;
6565

66-
(amazon|scientific|centos|almalinux|eurolinux|rocky|fedora|owl|redhat)
67-
state=$(chkconfig --level "${runlevel}" "${name}" || echo absent)
68-
test -n "${state}" || state='present'
66+
(amazon|scientific|centos|almalinux|eurolinux|rocky|fedora|owl|redhat|oraclelinux)
67+
if chkconfig --level "${runlevel}" "${name}" >/dev/null 2>&1
68+
then
69+
state='present'
70+
else
71+
state='absent'
72+
fi
6973
;;
7074
(suse)
7175
# check for target if set, usable for boot. services in runlevel B

type/__start_on_boot/gencode-remote

+5-8
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ in
4242
else
4343
case ${os}
4444
in
45-
(debian|devuan)
45+
(debian|devuan|ubuntu)
4646
echo "update-rc.d '${name}' defaults >/dev/null"
4747
;;
4848

4949
(alpine|gentoo)
5050
echo "rc-update add '${name}' '${target_runlevel}'"
5151
;;
5252

53-
(amazon|scientific|centos|almalinux|eurolinux|rocky|fedora|owl|redhat|suse)
53+
(amazon|scientific|centos|almalinux|eurolinux|rocky|fedora|owl|redhat|oraclelinux|suse)
5454
echo "chkconfig '${name}' on"
5555
;;
5656

@@ -61,9 +61,6 @@ in
6161
echo "'/etc/init.d/${name}' enable || test -f /etc/rc.d/S??'${name}'"
6262
;;
6363

64-
(ubuntu)
65-
echo "update-rc.d '${name}' defaults >/dev/null"
66-
;;
6764

6865
(freebsd)
6966
: # handled in manifest
@@ -83,23 +80,23 @@ in
8380
;;
8481

8582
(absent)
86-
if [ "${init}" = 'systemd' ]
83+
if test "${init}" = 'systemd'
8784
then
8885
# this handles ALL linux distros with systemd
8986
# e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
9087
echo "systemctl -q disable '${name}'"
9188
else
9289
case ${os}
9390
in
94-
(debian|ubuntu|devuan)
91+
(debian|devuan|ubuntu)
9592
echo "update-rc.d -f '${name}' remove"
9693
;;
9794

9895
(alpine|gentoo)
9996
echo "rc-update del '${name}' '${target_runlevel}'"
10097
;;
10198

102-
(centos|fedora|owl|redhat|suse)
99+
(amazon|scientific|centos|almalinux|eurolinux|rocky|fedora|owl|redhat|oraclelinux|suse)
103100
echo "chkconfig '${name}' off"
104101
;;
105102

type/__svn/manifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ state_should=$(cat "${__object:?}/parameter/state")
2828

2929
case ${os}
3030
in
31-
(alpine|archlinux|gentoo|debian|devuan|ubuntu|centos|almalinux|eurolinux|rocky|fedora|scientific|suse|freebsd|openbsd)
31+
(alpine|archlinux|gentoo|debian|devuan|ubuntu|centos|almalinux|eurolinux|rocky|fedora|scientific|oraclelinux|suse|freebsd|openbsd)
3232
if test "${state_should}" != 'absent'
3333
then
3434
__package subversion

type/__sysctl/gencode-remote

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ os=$(cat "${__global:?}/explorer/os")
3232
case ${os}
3333
in
3434
# Linux
35-
(redhat|centos|almalinux|eurolinux|rocky|ubuntu|debian|devuan|archlinux|gentoo|coreos)
35+
(redhat|centos|almalinux|eurolinux|rocky|oraclelinux|ubuntu|debian|devuan|archlinux|gentoo|coreos)
3636
flag='-w'
3737
;;
3838
# BusyBox

type/__sysctl/manifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ os=$(cat "${__global:?}/explorer/os")
2626
case ${os}
2727
in
2828
# Linux
29-
(alpine|redhat|centos|almalinux|eurolinux|rocky|ubuntu|debian|devuan|archlinux|coreos)
29+
(alpine|redhat|centos|almalinux|eurolinux|rocky|oraclelinux|ubuntu|debian|devuan|archlinux|coreos)
3030
:
3131
;;
3232
# BSD

type/__unpack/manifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ in
4646
(debian|ubuntu|devuan)
4747
__package xz-utils
4848
;;
49-
(alpine|centos|almalinux|eurolinux|rocky)
49+
(alpine|centos|almalinux|eurolinux|rocky|oraclelinux)
5050
__package xz
5151
;;
5252
esac

0 commit comments

Comments
 (0)