diff --git a/bin/cdist-build-helper b/bin/cdist-build-helper
index 6f514ef5..cadddae7 100755
--- a/bin/cdist-build-helper
+++ b/bin/cdist-build-helper
@@ -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)
diff --git a/cdist/conf/explorer/os_version b/cdist/conf/explorer/os_version
index fc59fd14..9d272dae 100755
--- a/cdist/conf/explorer/os_version
+++ b/cdist/conf/explorer/os_version
@@ -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
diff --git a/cdist/conf/type/__apt_pin/man.rst b/cdist/conf/type/__apt_pin/man.rst
index e6ec8b51..4229c0cd 100644
--- a/cdist/conf/type/__apt_pin/man.rst
+++ b/cdist/conf/type/__apt_pin/man.rst
@@ -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.
diff --git a/cdist/conf/type/__docker/manifest b/cdist/conf/type/__docker/manifest
index 6a57d85a..1132f03c 100755
--- a/cdist/conf/type/__docker/manifest
+++ b/cdist/conf/type/__docker/manifest
@@ -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
diff --git a/cdist/conf/type/__locale_system/manifest b/cdist/conf/type/__locale_system/manifest
index 4b996ebc..1ccc57e5 100755
--- a/cdist/conf/type/__locale_system/manifest
+++ b/cdist/conf/type/__locale_system/manifest
@@ -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
diff --git a/cdist/conf/type/__localedef/gencode-remote b/cdist/conf/type/__localedef/gencode-remote
index 4538151f..506a73b5 100755
--- a/cdist/conf/type/__localedef/gencode-remote
+++ b/cdist/conf/type/__localedef/gencode-remote
@@ -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
diff --git a/cdist/conf/type/__package/manifest b/cdist/conf/type/__package/manifest
index a453c32b..044a5476 100755
--- a/cdist/conf/type/__package/manifest
+++ b/cdist/conf/type/__package/manifest
@@ -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"
diff --git a/cdist/conf/type/__package_luarocks/manifest b/cdist/conf/type/__package_luarocks/manifest
index 9e4499b2..7d8262ca 100755
--- a/cdist/conf/type/__package_luarocks/manifest
+++ b/cdist/conf/type/__package_luarocks/manifest
@@ -19,5 +19,5 @@
# along with cdist. If not, see .
#
-__package luarocks --state present
-__package make --state present
+__package luarocks --state installed
+__package make --state installed
diff --git a/cdist/conf/type/__package_swupd/explorer/state b/cdist/conf/type/__package_swupd/explorer/state
new file mode 100644
index 00000000..598da85a
--- /dev/null
+++ b/cdist/conf/type/__package_swupd/explorer/state
@@ -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 .
+#
+#
+# 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
diff --git a/cdist/conf/type/__package_swupd/gencode-remote b/cdist/conf/type/__package_swupd/gencode-remote
new file mode 100755
index 00000000..a74ac671
--- /dev/null
+++ b/cdist/conf/type/__package_swupd/gencode-remote
@@ -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 .
+#
+#
+# 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
diff --git a/cdist/conf/type/__package_swupd/man.rst b/cdist/conf/type/__package_swupd/man.rst
new file mode 100644
index 00000000..ae11b130
--- /dev/null
+++ b/cdist/conf/type/__package_swupd/man.rst
@@ -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
+
+
+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.
diff --git a/cdist/conf/type/__package_swupd/nonparallel b/cdist/conf/type/__package_swupd/nonparallel
new file mode 100644
index 00000000..e69de29b
diff --git a/cdist/conf/type/__package_swupd/parameter/boolean b/cdist/conf/type/__package_swupd/parameter/boolean
new file mode 100644
index 00000000..9bb00783
--- /dev/null
+++ b/cdist/conf/type/__package_swupd/parameter/boolean
@@ -0,0 +1 @@
+install-optional
\ No newline at end of file
diff --git a/cdist/conf/type/__package_swupd/parameter/default/state b/cdist/conf/type/__package_swupd/parameter/default/state
new file mode 100644
index 00000000..e7f6134f
--- /dev/null
+++ b/cdist/conf/type/__package_swupd/parameter/default/state
@@ -0,0 +1 @@
+present
diff --git a/cdist/conf/type/__package_swupd/parameter/optional b/cdist/conf/type/__package_swupd/parameter/optional
new file mode 100644
index 00000000..1b423dc4
--- /dev/null
+++ b/cdist/conf/type/__package_swupd/parameter/optional
@@ -0,0 +1,2 @@
+name
+state
diff --git a/cdist/conf/type/__sshd_config/manifest b/cdist/conf/type/__sshd_config/manifest
index e37afebb..3ec630ce 100755
--- a/cdist/conf/type/__sshd_config/manifest
+++ b/cdist/conf/type/__sshd_config/manifest
@@ -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
diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index f0f6deef..eba79eb7 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -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
diff --git a/cdist/conf/type/__sysctl/manifest b/cdist/conf/type/__sysctl/manifest
index 71dea7f7..d748acf1 100755
--- a/cdist/conf/type/__sysctl/manifest
+++ b/cdist/conf/type/__sysctl/manifest
@@ -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
diff --git a/cdist/conf/type/__timezone/gencode-remote b/cdist/conf/type/__timezone/gencode-remote
index d8612986..b685c990 100755
--- a/cdist/conf/type/__timezone/gencode-remote
+++ b/cdist/conf/type/__timezone/gencode-remote
@@ -34,12 +34,3 @@ case "$os" in
echo "echo \"$timezone_should\" > /etc/timezone"
;;
esac
-
-case "$os" in
- openwrt)
- cat <&2
echo "Please contribute an implementation for it if you can." >&2
diff --git a/cdist/conf/type/__user_groups/explorer/group b/cdist/conf/type/__user_groups/explorer/group
index 8a02f219..5bad9a0b 100755
--- a/cdist/conf/type/__user_groups/explorer/group
+++ b/cdist/conf/type/__user_groups/explorer/group
@@ -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
diff --git a/cdist/conf/type/__user_groups/gencode-remote b/cdist/conf/type/__user_groups/gencode-remote
index 0585e90f..8120761a 100755
--- a/cdist/conf/type/__user_groups/gencode-remote
+++ b/cdist/conf/type/__user_groups/gencode-remote
@@ -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
diff --git a/docs/changelog b/docs/changelog
index fa741365..4e9a8a6d 100644
--- a/docs/changelog
+++ b/docs/changelog
@@ -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)