Compare commits

...

8 Commits

Author SHA1 Message Date
romain-dartigues a8cf54e462 introduce Clear Linux OS to the __sysctl type 2024-02-10 20:57:54 +01:00
romain-dartigues 41309043c6 introduce Clear Linux OS to the __sshd_config type 2024-02-10 20:57:54 +01:00
romain-dartigues 21055f2779 introduce Clear Linux OS to the __localedef type 2024-02-10 20:57:54 +01:00
romain-dartigues bbd1ba6bb7 introduce Clear Linux OS to the __locale_system type
Note: I choose to use the Slackware code block to not create a new
logical path (and it does work).
2024-02-10 20:57:54 +01:00
romain-dartigues 382cdcaa33 introduce Clear Linux OS to the __docker type 2024-02-10 20:57:54 +01:00
romain-dartigues 88bb561288 introduce Clear Linux OS to the __package type 2024-02-10 20:57:54 +01:00
romain-dartigues d1ae8942da introduce swupd package manager 2024-02-10 20:57:54 +01:00
romain-dartigues 7d590225af introduce Clear Linux OS in explorers
Note: there is no LSB on Clear Linux, but the latter part
(`rc_getvar /usr/lib/os-release VERSION_ID`) does work.
2024-02-10 20:57:54 +01:00
15 changed files with 171 additions and 6 deletions

View File

@ -138,7 +138,7 @@ in
cat /etc/SuSE-release
fi
;;
ubuntu)
clear-linux-os|ubuntu)
if command -v lsb_release >/dev/null 2>&1
then
lsb_release -sr

View File

@ -44,6 +44,21 @@ case "$os" in
exit 1
fi
;;
clear-linux-os)
if [ "${state}" = present ]
then
if [ "$version" != latest ]
then
>&2 echo "Specifying Docker version is unsupported with \"$os\""
exit 1
fi
__package_swupd cloud-control
else
>&2 echo 'Warning: cowardly refusing to remove "cloud-control", disabling Dockerd instead'
__systemd_service docker --state stopped
__systemd_unit docker --enablement-state disabled
fi
;;
ubuntu|debian)
if [ "${state}" = "present" ]; then
__package apt-transport-https

View File

@ -156,7 +156,7 @@ in
locale_conf_mode=0555
fi
;;
slackware)
clear-linux-os|slackware)
# NOTE: lang.csh (csh config) is ignored here.
locale_conf="/etc/profile.d/lang.sh"
locale_conf_mode=0755

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)
(archlinux|debian|devuan|ubuntu|suse|centos|fedora|redhat|scientific|clear-linux-os)
# FIXME: The code below only works for glibc-based installations.
# NOTE: Hardcoded, create a pull request in case it is at another

View File

@ -34,6 +34,7 @@ else
amazon|scientific|centos|fedora|redhat) type="yum" ;;
archlinux) type="pacman" ;;
debian|ubuntu|devuan) type="apt" ;;
clear-linux-os) type="swupd" ;;
freebsd)
if [ -n "$(cat "$__object/explorer/pkgng_exists")" ]; then
type="pkgng_freebsd"

View File

@ -0,0 +1,29 @@
#!/bin/sh -e
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Retrieve the status of a package on Clear Linux OS
#
if [ -f "$__object/parameter/name" ]
then name="$(cat "$__object/parameter/name")"
else name="$__object_id"
fi
if swupd bundle-list --status --quiet | grep -q "^${name}: .*installed"
then echo present
else echo absent
fi

View File

@ -0,0 +1,50 @@
#!/bin/sh -e
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Manage packages on Clear Linux OS
#
if [ -f "$__object/parameter/name" ]; then
name="$(cat "$__object/parameter/name")"
else
name="$__object_id"
fi
state_should="$(cat "$__object/parameter/state")"
state_is="$(cat "$__object/explorer/state")"
# Nothing to be done
[ "$state_is" = "$state_should" ] && exit 0
case "$state_should" in
present)
if [ -f "$__object/parameter/install-optional" ]
then swupd_opts=""
else swupd_opts="--skip-optional"
fi
echo "swupd bundle-add $swupd_opts -y --quiet '$name'"
echo "installed" >> "$__messages_out"
;;
absent)
echo "swupd bundle-remove '$name'"
echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
exit 1
;;
esac

View File

@ -0,0 +1,66 @@
cdist-type__package_swupd(7)
============================
NAME
----
cdist-type__package_swupd - Manage packages with swupd
DESCRIPTION
-----------
swupd (software update program) is the package manager used on Clear Linux OS to
manage packages. The package will be installed without optional
packages. If such packages are required, install them
separately or use the parameter ``--install-optional``.
REQUIRED PARAMETERS
-------------------
None
OPTIONAL PARAMETERS
-------------------
name
If supplied, use the name and not the object id as the package name.
state
Either "present" or "absent", defaults to "present"
BOOLEAN PARAMETERS
------------------
install-optional
If the package will be installed, it also installs optional packages
with it. It will not install optional packages if the original package
is already installed.
EXAMPLES
--------
.. code-block:: sh
# Ensure zsh in installed
__package_swupd zsh --state present
# Remove package
__package_swupd zsh --state absent
SEE ALSO
--------
:strong:`cdist-type__package`\ (7)
AUTHORS
-------
Romain Dartigues <romain.dartigues+cdist at gmail.com>
COPYING
-------
Copyright \(C) 2024 Romain Dartigues. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

View File

@ -0,0 +1 @@
install-optional

View File

@ -0,0 +1 @@
present

View File

@ -0,0 +1,2 @@
name
state

View File

@ -24,7 +24,7 @@ state_should=$(cat "${__object:?}/parameter/state")
case ${os}
in
(alpine|centos|fedora|redhat|scientific|debian|devuan|ubuntu)
(alpine|centos|clear-linux-os|fedora|redhat|scientific|debian|devuan|ubuntu)
if test "${state_should}" != 'absent'
then
__package openssh-server --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)
redhat|centos|ubuntu|debian|devuan|archlinux|gentoo|coreos|clear-linux-os)
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)
alpine|redhat|centos|ubuntu|debian|devuan|archlinux|coreos|clear-linux-os)
:
;;
# BSD