more types for AlmaLinux

Untested yet.
This commit is contained in:
romain-dartigues 2024-03-17 18:33:14 +01:00
parent 2e7b332b77
commit 4b874656a9
30 changed files with 52 additions and 33 deletions

View file

@ -24,7 +24,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
alpine|scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo) almalinux|alpine|scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo)
# any linux should work # any linux should work
: :
;; ;;

View file

@ -136,7 +136,7 @@ init_upstart()
manual_setup () { manual_setup () {
case "$os" in case "$os" in
alpine|scientific|centos|debian|devuan|redhat|ubuntu) almalinux|alpine|scientific|centos|debian|devuan|redhat|ubuntu)
# whitelist safeguard # whitelist safeguard
: :
;; ;;
@ -174,9 +174,14 @@ manual_setup () {
devuan) devuan)
init_sysvinit debian init_sysvinit debian
;; ;;
centos|redhat) almalinux|centos|redhat)
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")" os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
major_version="${os_version%%.*}" major_version="${os_version%%.*}"
if [ "$os" = almalinux ]
then
init_systemd
return
fi
case "$major_version" in case "$major_version" in
[456]) [456])
init_sysvinit redhat init_sysvinit redhat

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
scientific|centos|redhat) almalinux|scientific|centos|redhat)
# whitelist safeguard # whitelist safeguard
service_onchange='service consul-template status >/dev/null && service consul-template reload || true' \ service_onchange='service consul-template status >/dev/null && service consul-template reload || true' \
;; ;;
@ -151,7 +151,7 @@ require="__directory${conf_dir}" \
# Install init script to start on boot # Install init script to start on boot
service="consul-template" service="consul-template"
case "$os" in case "$os" in
centos|redhat) almalinux|centos|redhat)
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")" os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
major_version="${os_version%%.*}" major_version="${os_version%%.*}"
case "$major_version" in case "$major_version" in

View file

@ -27,7 +27,7 @@ else
fi fi
case "$os" in case "$os" in
alpine|centos|fedora|gentoo|redhat|suse|ubuntu) almalinux|alpine|centos|fedora|gentoo|redhat|suse|ubuntu)
if [ ! -x "$(command -v lsblk)" ]; then if [ ! -x "$(command -v lsblk)" ]; then
echo "lsblk is required for __filesystem type" >&2 echo "lsblk is required for __filesystem type" >&2
exit 1 exit 1

View file

@ -64,7 +64,7 @@ else
echo service \"$name\" \"$cmd\" echo service \"$name\" \"$cmd\"
;; ;;
amazon|scientific|centos|fedora|owl|redhat|suse) almalinux|amazon|scientific|centos|fedora|owl|redhat|suse)
echo service \"$name\" \"$cmd\" echo service \"$name\" \"$cmd\"
;; ;;

View file

@ -32,7 +32,7 @@ else
case ${os} case ${os}
in in
# RedHat-derivatives and BSDs # RedHat-derivatives and BSDs
(centos|fedora|redhat|scientific|freebsd|macosx|netbsd|openbsd) (almalinux|centos|fedora|redhat|scientific|freebsd|macosx|netbsd|openbsd)
# Hostname is FQDN # Hostname is FQDN
name_should=${__target_host:?} name_should=${__target_host:?}
;; ;;
@ -67,7 +67,7 @@ in
"&& hostnamectl set-hostname '${name_should}'" \ "&& hostnamectl set-hostname '${name_should}'" \
"|| hostname '${name_should}'" "|| hostname '${name_should}'"
;; ;;
(centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|gentoo|void) (almalinux|centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|gentoo|void)
echo "hostname '${name_should}'" echo "hostname '${name_should}'"
;; ;;
(openwrt) (openwrt)

View file

@ -36,7 +36,7 @@ else
case ${os} case ${os}
in in
# RedHat-derivatives and BSDs # RedHat-derivatives and BSDs
(centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|slackware|suse) (almalinux|centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|slackware|suse)
# Hostname is FQDN # Hostname is FQDN
name_should=${__target_host:?} name_should=${__target_host:?}
;; ;;
@ -77,7 +77,7 @@ in
# --value "\"$name_should\"" # --value "\"$name_should\""
fi fi
;; ;;
(centos|fedora|redhat|scientific) (almalinux|centos|fedora|redhat|scientific)
if test -z "${has_hostnamectl}" if test -z "${has_hostnamectl}"
then then
# Only write to /etc/sysconfig/network on non-systemd versions. # Only write to /etc/sysconfig/network on non-systemd versions.

View file

@ -62,7 +62,7 @@ in
unset CDIST_ORDER_DEPENDENCY unset CDIST_ORDER_DEPENDENCY
fi fi
;; ;;
(centos|fedora|redhat|scientific) (almalinux|centos|fedora|redhat|scientific)
os_version=$(cat "${__global:?}/explorer/os_version") os_version=$(cat "${__global:?}/explorer/os_version")
os_major=$(expr "${os_version}" : '.* release \([0-9]*\)') os_major=$(expr "${os_version}" : '.* release \([0-9]*\)')
case ${os} case ${os}
@ -73,13 +73,13 @@ in
(fedora) (fedora)
update_sysconfig=$(test "${os_major}" -lt 10 && echo true || echo false) update_sysconfig=$(test "${os_major}" -lt 10 && echo true || echo false)
;; ;;
(redhat|*) (almalinux|redhat|*)
case ${os_version} case ${os_version}
in in
('Red Hat Enterprise Linux'*) ('Red Hat Enterprise Linux'*)
update_sysconfig=$(test "${os_major}" -lt 6 && echo true || echo false) update_sysconfig=$(test "${os_major}" -lt 6 && echo true || echo false)
;; ;;
('Red Hat Linux'*) ('Red Hat Linux'*|'AlmaLinux'*)
update_sysconfig=true update_sysconfig=true
;; ;;
(*) (*)

View file

@ -70,6 +70,11 @@ if [ -f "$chroot/etc/owl-release" ]; then
fi fi
### Redhat and derivatives ### Redhat and derivatives
if grep -q ^AlmaLinux "$chroot/etc/redhat-release" 2>/dev/null; then
echo almalinux
exit 0
fi
if grep -q ^CentOS "$chroot/etc/redhat-release" 2>/dev/null; then if grep -q ^CentOS "$chroot/etc/redhat-release" 2>/dev/null; then
echo centos echo centos
exit 0 exit 0

View file

@ -30,7 +30,7 @@ case "$os" in
# Debian needs a seperate package # Debian needs a seperate package
__package locales --state present __package locales --state present
;; ;;
archlinux|suse|ubuntu|scientific|centos|alpine) almalinux|archlinux|suse|ubuntu|scientific|centos|alpine)
: :
;; ;;
*) *)

View file

@ -79,7 +79,7 @@ in
archlinux) archlinux)
locale_conf="/etc/locale.conf" locale_conf="/etc/locale.conf"
;; ;;
centos|redhat|scientific) almalinux|centos|redhat|scientific)
# shellcheck source=/dev/null # shellcheck source=/dev/null
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}") version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
if echo "${version_id}" | version_ge 7 if echo "${version_id}" | version_ge 7

View file

@ -61,7 +61,7 @@ in
printf '%s does not support locales.\n' "${os}" >&2 printf '%s does not support locales.\n' "${os}" >&2
exit 1 exit 1
;; ;;
(archlinux|debian|devuan|ubuntu|suse|centos|fedora|redhat|scientific) (almalinux|archlinux|debian|devuan|ubuntu|suse|centos|fedora|redhat|scientific)
# FIXME: The code below only works for glibc-based installations. # FIXME: The code below only works for glibc-based installations.
# NOTE: Hardcoded, create a pull request in case it is at another # NOTE: Hardcoded, create a pull request in case it is at another

View file

@ -23,7 +23,7 @@ else
# By default determine package manager based on operating system # By default determine package manager based on operating system
os="$("$__explorer/os")" os="$("$__explorer/os")"
case "$os" in case "$os" in
amazon|scientific|centos|fedora|redhat) echo "yum" ;; almalinux|amazon|scientific|centos|fedora|redhat) echo "yum" ;;
debian|ubuntu|devuan) echo "apt" ;; debian|ubuntu|devuan) echo "apt" ;;
archlinux) echo "pacman" ;; archlinux) echo "pacman" ;;
alpine) echo "apk" ;; alpine) echo "apk" ;;

View file

@ -38,7 +38,7 @@ else
# By default determine package manager based on operating system # By default determine package manager based on operating system
os="$(cat "$__global/explorer/os")" os="$(cat "$__global/explorer/os")"
case "$os" in case "$os" in
amazon|scientific|centos|fedora|redhat) type="yum" ;; almalinux|amazon|scientific|centos|fedora|redhat) type="yum" ;;
debian|ubuntu|devuan) type="apt" ;; debian|ubuntu|devuan) type="apt" ;;
archlinux) type="pacman" ;; archlinux) type="pacman" ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|scientific|centos|devuan) almalinux|ubuntu|debian|archlinux|scientific|centos|devuan)
: :
;; ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$("$__explorer/os") os=$("$__explorer/os")
case "$os" in case "$os" in
alpine|ubuntu|debian|archlinux|suse|scientific|centos|devuan) almalinux|alpine|ubuntu|debian|archlinux|suse|scientific|centos|devuan)
: :
;; ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
alpine|archlinux|centos|debian|devuan|suse|scientific|ubuntu) almalinux|alpine|archlinux|centos|debian|devuan|suse|scientific|ubuntu)
: :
;; ;;
*) *)

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
ubuntu|debian|archlinux|scientific|centos|devuan) almalinux|ubuntu|debian|archlinux|scientific|centos|devuan)
echo "postfix reload" echo "postfix reload"
;; ;;
*) *)

View file

@ -26,7 +26,7 @@ in
(alpine) (alpine)
echo 'postgres' echo 'postgres'
;; ;;
(centos|rhel|scientific) (almalinux|centos|rhel|scientific)
echo 'postgres' echo 'postgres'
;; ;;
(debian|devuan|ubuntu) (debian|devuan|ubuntu)

View file

@ -67,7 +67,7 @@ in
(echo "${os_version}" | version_ge 10.04) || package_name='debianutils' (echo "${os_version}" | version_ge 10.04) || package_name='debianutils'
pkg_type='apt' pkg_type='apt'
;; ;;
centos|fedora|redhat|scientific) almalinux|centos|fedora|redhat|scientific)
pkg_type='yum' pkg_type='yum'
;; ;;
*) *)

View file

@ -24,7 +24,7 @@ state_should=$(cat "${__object:?}/parameter/state")
case ${os} case ${os}
in in
(alpine|centos|fedora|redhat|scientific|debian|devuan|ubuntu) (almalinux|alpine|centos|fedora|redhat|scientific|debian|devuan|ubuntu)
if test "${state_should}" != 'absent' if test "${state_should}" != 'absent'
then then
__package openssh-server --state present __package openssh-server --state present

View file

@ -62,7 +62,7 @@ else
[ -f "/etc/init/${name}.conf" ] && state="present" [ -f "/etc/init/${name}.conf" ] && state="present"
;; ;;
amazon|scientific|centos|fedora|owl|redhat) almalinux|amazon|scientific|centos|fedora|owl|redhat)
state=$(chkconfig --level "$runlevel" "$name" || echo absent) state=$(chkconfig --level "$runlevel" "$name" || echo absent)
[ "$state" ] || state="present" [ "$state" ] || state="present"
;; ;;

View file

@ -30,7 +30,7 @@ fi
os=$(cat "$__global/explorer/os") os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
# Linux # Linux
redhat|centos|ubuntu|debian|devuan|archlinux|gentoo|coreos) almalinux|redhat|centos|ubuntu|debian|devuan|archlinux|gentoo|coreos)
flag='-w' flag='-w'
;; ;;
# BusyBox # BusyBox

View file

@ -25,7 +25,7 @@ os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
# Linux # Linux
alpine|redhat|centos|ubuntu|debian|devuan|archlinux|coreos) almalinux|alpine|redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
: :
;; ;;
# BSD # BSD

View file

@ -42,7 +42,7 @@ case "$os" in
# whitelist # whitelist
: :
;; ;;
scientific|centos) almalinux|scientific|centos)
__package tzdata --state present __package tzdata --state present
export require="__package/tzdata" export require="__package/tzdata"
__file /etc/sysconfig/clock \ __file /etc/sysconfig/clock \

View file

@ -25,6 +25,10 @@ case "$state" in
os="$(cat "$__global/explorer/os")" os="$(cat "$__global/explorer/os")"
case "$os" in case "$os" in
almalinux)
__package epel-release
require='__package/epel-release' __package ufw
;;
centos) centos)
# shellcheck source=/dev/null # shellcheck source=/dev/null
if (. "$__global/explorer/os_release" && [ "${VERSION_ID}" = "7" ]); then if (. "$__global/explorer/os_release" && [ "${VERSION_ID}" = "7" ]); then

View file

@ -33,7 +33,7 @@ case "$src" in
;; ;;
*.7z) *.7z)
case "$os" in case "$os" in
centos|fedora|redhat) almalinux|centos|fedora|redhat)
cmd='7za' cmd='7za'
;; ;;
*) *)

View file

@ -23,7 +23,7 @@ case "$src" in
debian|ubuntu|devuan) debian|ubuntu|devuan)
__package xz-utils __package xz-utils
;; ;;
alpine|centos) almalinux|alpine|centos)
__package xz __package xz
;; ;;
esac esac

View file

@ -77,6 +77,11 @@ if [ -f /etc/owl-release ]; then
fi fi
### Redhat and derivatives ### Redhat and derivatives
if grep -q ^AlmaLinux /etc/redhat-release 2>/dev/null; then
echo almalinux
exit 0
fi
if grep -q ^Scientific /etc/redhat-release 2>/dev/null; then if grep -q ^Scientific /etc/redhat-release 2>/dev/null; then
echo scientific echo scientific
exit 0 exit 0

View file

@ -54,7 +54,7 @@ case "$($__explorer/os)" in
owl) owl)
cat /etc/owl-release cat /etc/owl-release
;; ;;
redhat|centos|mitel|scientific) almalinux|redhat|centos|mitel|scientific)
cat /etc/redhat-release cat /etc/redhat-release
;; ;;
slackware) slackware)