Compare commits

...

3 Commits

Author SHA1 Message Date
romain-dartigues 4b874656a9 more types for AlmaLinux
Untested yet.
2024-04-11 21:21:42 +02:00
romain-dartigues 2e7b332b77 introduce AlmaLinux
AlmaLinux is an Open Source fork of Red Hat Enterprise Linux;
it should behave like a CentOS/RHEL.
2024-04-11 21:21:42 +02:00
marcoduif 2b102f303a changed package state from installed to present 2024-03-01 11:43:23 +00:00
37 changed files with 65 additions and 39 deletions

View File

@ -80,6 +80,12 @@ 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

@ -125,7 +125,7 @@ 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)

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

@ -31,7 +31,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" ;;
archlinux) type="pacman" ;; archlinux) type="pacman" ;;
debian|ubuntu|devuan) type="apt" ;; debian|ubuntu|devuan) type="apt" ;;
freebsd) freebsd)

View File

@ -19,5 +19,5 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
__package luarocks --state installed __package luarocks --state present
__package make --state installed __package make --state present

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

@ -37,7 +37,7 @@ fi
state_should="$(cat "$__object/parameter/state")" state_should="$(cat "$__object/parameter/state")"
if grep -q -E "(scientific|centos|redhat|amazon)" "$__global/explorer/os"; then if grep -q -E "(almalinux|scientific|centos|redhat|amazon)" "$__global/explorer/os"; then
opts="-y --quiet" opts="-y --quiet"
else else
opts="--assumeyes --quiet" opts="--assumeyes --quiet"

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

@ -22,7 +22,7 @@ os=$(cat "$__global/explorer/os")
state="$(cat "$__object/parameter/state")" state="$(cat "$__object/parameter/state")"
case "$os" in case "$os" in
scientific|centos) almalinux|scientific|centos)
repo_name="$__object_id" repo_name="$__object_id"
export repo_name export repo_name
repo_file="/etc/yum.repos.d/${repo_name}.repo" repo_file="/etc/yum.repos.d/${repo_name}.repo"

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)

View File

@ -3,6 +3,7 @@ Supported operating systems
cdist was tested or is know to run on at least cdist was tested or is know to run on at least
* `Alma Linux <https://https://almalinux.org>`_
* `Alpine Linux <https://alpinelinux.org>`_ * `Alpine Linux <https://alpinelinux.org>`_
* `Archlinux <http://www.archlinux.org>`_ * `Archlinux <http://www.archlinux.org>`_
* `CentOS <http://www.centos.org>`_ * `CentOS <http://www.centos.org>`_