Compare commits

..

2 commits

Author SHA1 Message Date
4b874656a9 more types for AlmaLinux
Untested yet.
2024-04-11 21:21:42 +02:00
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
42 changed files with 69 additions and 61 deletions

View file

@ -534,8 +534,7 @@ eof
;;
version)
target_version="$(git describe | sed 's/-/.dev/; s/-/+/g')"
printf "VERSION = \"%s\"\n" "${target_version}" > cdist/version.py
printf "VERSION = \"%s\"\n" "$(git describe)" > cdist/version.py
;;
target-version)

View file

@ -80,6 +80,12 @@ if [ -f /etc/owl-release ]; then
fi
### 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
echo scientific
exit 0

View file

@ -125,7 +125,7 @@ in
owl)
cat /etc/owl-release
;;
redhat|centos|mitel|scientific)
almalinux|redhat|centos|mitel|scientific)
cat /etc/redhat-release
;;
slackware)

View file

@ -23,7 +23,7 @@ package
Package name, glob or regular expression to match (multiple) packages. If not specified `__object_id` is used.
priority
The priority value to assign to matching packages. Defaults to 500. (To match the default target distro's priority)
The priority value to assign to matching packages. Deafults to 500. (To match the default target distro's priority)
state
Will be passed to underlying `__file` type; see there for valid values and defaults.

View file

@ -24,7 +24,7 @@
os=$(cat "$__global/explorer/os")
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
:
;;

View file

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

View file

@ -22,7 +22,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
scientific|centos|redhat)
almalinux|scientific|centos|redhat)
# whitelist safeguard
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
service="consul-template"
case "$os" in
centos|redhat)
almalinux|centos|redhat)
os_version="$(sed 's/[^0-9.]//g' "$__global/explorer/os_version")"
major_version="${os_version%%.*}"
case "$major_version" in

View file

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

View file

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

View file

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

View file

@ -36,7 +36,7 @@ else
case ${os}
in
# 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
name_should=${__target_host:?}
;;
@ -77,7 +77,7 @@ in
# --value "\"$name_should\""
fi
;;
(centos|fedora|redhat|scientific)
(almalinux|centos|fedora|redhat|scientific)
if test -z "${has_hostnamectl}"
then
# Only write to /etc/sysconfig/network on non-systemd versions.

View file

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

View file

@ -70,6 +70,11 @@ if [ -f "$chroot/etc/owl-release" ]; then
fi
### 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
echo centos
exit 0

View file

@ -30,7 +30,7 @@ case "$os" in
# Debian needs a seperate package
__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)
locale_conf="/etc/locale.conf"
;;
centos|redhat|scientific)
almalinux|centos|redhat|scientific)
# shellcheck source=/dev/null
version_id=$(. "${__global}/explorer/os_release" && echo "${VERSION_ID:-0}")
if echo "${version_id}" | version_ge 7

View file

@ -61,7 +61,7 @@ in
printf '%s does not support locales.\n' "${os}" >&2
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.
# 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
os="$(cat "$__global/explorer/os")"
case "$os" in
amazon|scientific|centos|fedora|redhat) type="yum" ;;
almalinux|amazon|scientific|centos|fedora|redhat) type="yum" ;;
archlinux) type="pacman" ;;
debian|ubuntu|devuan) type="apt" ;;
freebsd)

View file

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

View file

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

View file

@ -37,7 +37,7 @@ fi
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"
else
opts="--assumeyes --quiet"

View file

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

View file

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

View file

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

View file

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

View file

@ -62,7 +62,7 @@ else
[ -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" ] || state="present"
;;

View file

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

View file

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

View file

@ -34,12 +34,3 @@ case "$os" in
echo "echo \"$timezone_should\" > /etc/timezone"
;;
esac
case "$os" in
openwrt)
cat <<EOF
uci set system.@system[0].timezone="$timezone_should"
uci commit
EOF
;;
esac

View file

@ -42,7 +42,7 @@ case "$os" in
# whitelist
:
;;
scientific|centos)
almalinux|scientific|centos)
__package tzdata --state present
export require="__package/tzdata"
__file /etc/sysconfig/clock \
@ -53,10 +53,7 @@ case "$os" in
--file /etc/sysconfig/clock \
--delimiter '=' \
--value "\"$timezone\""
;;
openwrt)
: # Uses gencode-remote
;;
;;
*)
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
echo "Please contribute an implementation for it if you can." >&2

View file

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

View file

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

View file

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

View file

@ -20,4 +20,4 @@
user="$(cat "$__object/parameter/user" 2>/dev/null || echo "$__object_id")"
(id -G -n "$user" | tr ' ' '\n') 2>/dev/null || true
(id -G -n "$user" | tr ' ' '\n' | sort) 2>/dev/null || true

View file

@ -26,15 +26,13 @@ os=$(cat "$__global/explorer/os")
mkdir "$__object/files"
# file has to be sorted for comparison with `comm`
sort "$__object/parameter/group" > "$__object/files/group.sorted"
# Use local sort for remote groups
sort "$__object/explorer/group" > "$__object/files/group-remote.sorted"
case "$state_should" in
present)
changed_groups="$(comm -13 "$__object/files/group-remote.sorted" "$__object/files/group.sorted")"
changed_groups="$(comm -13 "$__object/explorer/group" "$__object/files/group.sorted")"
;;
absent)
changed_groups="$(comm -12 "$__object/files/group-remote.sorted" "$__object/files/group.sorted")"
changed_groups="$(comm -12 "$__object/explorer/group" "$__object/files/group.sorted")"
;;
esac

View file

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

View file

@ -77,6 +77,11 @@ if [ -f /etc/owl-release ]; then
fi
### 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
echo scientific
exit 0

View file

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

View file

@ -1,9 +1,6 @@
Changelog
---------
next:
* Type __timezone: Add support for OpenWRT (Nico Schottelius)
7.0.1:
* Core: Remove double definition of scan parser (Nico Schottelius)
* Type __apt_mark: Narrow down grep for hold packages (marcoduif)

View file

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