forked from ungleich-public/cdist
Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f69895046 |
74 changed files with 183 additions and 290 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# 2011-2022 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
# 2016-2019 Darko Poljak (darko.poljak at gmail.com)
|
# 2016-2019 Darko Poljak (darko.poljak at gmail.com)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
|
|
|
||||||
|
|
@ -472,6 +472,9 @@ def get_parsers():
|
||||||
parser['info'].set_defaults(func=cdist.info.Info.commandline)
|
parser['info'].set_defaults(func=cdist.info.Info.commandline)
|
||||||
|
|
||||||
# Scan = config + further
|
# Scan = config + further
|
||||||
|
parser['scan'] = parser['sub'].add_parser('scan', add_help=False,
|
||||||
|
parents=[parser['config']])
|
||||||
|
|
||||||
parser['scan'] = parser['sub'].add_parser(
|
parser['scan'] = parser['sub'].add_parser(
|
||||||
'scan', parents=[parser['loglevel'],
|
'scan', parents=[parser['loglevel'],
|
||||||
parser['beta'],
|
parser['beta'],
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
case "$("$__explorer/os")" in
|
case "$("$__explorer/os")" in
|
||||||
checkpoint)
|
|
||||||
awk '{printf("%s\n", $(NF-1))}' /etc/cp-release
|
|
||||||
;;
|
|
||||||
openwrt)
|
openwrt)
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_CODENAME")
|
(. /etc/openwrt_release && echo "$DISTRIB_CODENAME")
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
case "$("$__explorer/os")" in
|
case "$("$__explorer/os")" in
|
||||||
checkpoint)
|
|
||||||
cat /etc/cp-release
|
|
||||||
;;
|
|
||||||
openwrt)
|
openwrt)
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION")
|
(. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION")
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
case "$("$__explorer/os")" in
|
case "$("$__explorer/os")" in
|
||||||
checkpoint)
|
|
||||||
echo "CheckPoint"
|
|
||||||
;;
|
|
||||||
openwrt)
|
openwrt)
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_ID")
|
(. /etc/openwrt_release && echo "$DISTRIB_ID")
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
case "$("$__explorer/os")" in
|
case "$("$__explorer/os")" in
|
||||||
checkpoint)
|
|
||||||
sed /etc/cp-release -e 's/.* R\([1-9][0-9]*\)\.[0-9]*$/\1/'
|
|
||||||
;;
|
|
||||||
openwrt)
|
openwrt)
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
(. /etc/openwrt_release && echo "$DISTRIB_RELEASE")
|
(. /etc/openwrt_release && echo "$DISTRIB_RELEASE")
|
||||||
|
|
|
||||||
|
|
@ -515,7 +515,7 @@ check_vm_arch_specific() {
|
||||||
&& return 0
|
&& return 0
|
||||||
fi
|
fi
|
||||||
if has_cpuinfo \
|
if has_cpuinfo \
|
||||||
&& grep -q -i -e '^flags.*:.*\(hypervisor\|vmm\)\( \|$\)' /proc/cpuinfo
|
&& grep -q -i -e '^flags.*:.*\(hypervisor\|vmm\)' /proc/cpuinfo
|
||||||
then
|
then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,13 @@ if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if grep -q ^DISTRIB_ID=LinuxMint /etc/lsb-release 2>/dev/null; then
|
||||||
|
echo linuxmint
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
|
|
||||||
# devuan ascii has both devuan_version and debian_version, so we need to check devuan_version first!
|
# devuan ascii has both devuan_version and debian_version, so we need to check devuan_version first!
|
||||||
if [ -f /etc/devuan_version ]; then
|
if [ -f /etc/devuan_version ]; then
|
||||||
echo devuan
|
echo devuan
|
||||||
|
|
@ -116,13 +123,6 @@ if [ -f /etc/slackware-version ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Appliances
|
|
||||||
|
|
||||||
if grep -q '^Check Point Gaia' /etc/cp-release 2>/dev/null; then
|
|
||||||
echo checkpoint
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
uname_s="$(uname -s)"
|
uname_s="$(uname -s)"
|
||||||
|
|
||||||
# Assume there is no tr on the client -> do lower case ourselves
|
# Assume there is no tr on the client -> do lower case ourselves
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,5 @@ elif test -f /var/run/os-release
|
||||||
then
|
then
|
||||||
# FreeBSD (created by os-release service)
|
# FreeBSD (created by os-release service)
|
||||||
cat /var/run/os-release
|
cat /var/run/os-release
|
||||||
elif test -f /etc/cp-release
|
|
||||||
then
|
|
||||||
# Checkpoint firewall or management (actually linux based)
|
|
||||||
cat /etc/cp-release
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,7 @@ in
|
||||||
# empty, but well...
|
# empty, but well...
|
||||||
cat /etc/arch-release
|
cat /etc/arch-release
|
||||||
;;
|
;;
|
||||||
checkpoint)
|
debian|lmde)
|
||||||
awk '{version=$NF; printf("%s\n", substr(version, 2))}' /etc/cp-release
|
|
||||||
;;
|
|
||||||
debian)
|
|
||||||
debian_version=$(cat /etc/debian_version)
|
debian_version=$(cat /etc/debian_version)
|
||||||
case $debian_version
|
case $debian_version
|
||||||
in
|
in
|
||||||
|
|
@ -82,7 +79,6 @@ in
|
||||||
# ceres versions don't have a number, so we decode by codename:
|
# ceres versions don't have a number, so we decode by codename:
|
||||||
case ${devuan_version}
|
case ${devuan_version}
|
||||||
in
|
in
|
||||||
(daedalus/ceres) echo 4.99 ;;
|
|
||||||
(chimaera/ceres) echo 3.99 ;;
|
(chimaera/ceres) echo 3.99 ;;
|
||||||
(beowulf/ceres) echo 2.99 ;;
|
(beowulf/ceres) echo 2.99 ;;
|
||||||
(ascii/ceres) echo 1.99 ;;
|
(ascii/ceres) echo 1.99 ;;
|
||||||
|
|
@ -138,7 +134,7 @@ in
|
||||||
cat /etc/SuSE-release
|
cat /etc/SuSE-release
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
if command -v lsb_release >/dev/null 2>&1
|
if command -v lsb_release >/dev/null 2>&1
|
||||||
then
|
then
|
||||||
lsb_release -sr
|
lsb_release -sr
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ codename_os_release() {
|
||||||
# detect backport distribution
|
# detect backport distribution
|
||||||
os="$(cat "$__global/explorer/os")"
|
os="$(cat "$__global/explorer/os")"
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian)
|
debian|lmde)
|
||||||
dist="$( codename_os_release )"
|
dist="$( codename_os_release )"
|
||||||
components="main"
|
components="main"
|
||||||
mirror="http://deb.debian.org/debian/"
|
mirror="http://deb.debian.org/debian/"
|
||||||
|
|
@ -46,7 +46,7 @@ case "$os" in
|
||||||
components="main"
|
components="main"
|
||||||
mirror="http://deb.devuan.org/merged"
|
mirror="http://deb.devuan.org/merged"
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
dist="$( codename_os_release )"
|
dist="$( codename_os_release )"
|
||||||
components="main restricted universe multiverse"
|
components="main restricted universe multiverse"
|
||||||
mirror="http://archive.ubuntu.com/ubuntu"
|
mirror="http://archive.ubuntu.com/ubuntu"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ os=$(cat "$__global/explorer/os")
|
||||||
release="$(cat "$__object/parameter/release")"
|
release="$(cat "$__object/parameter/release")"
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
ubuntu|debian|devuan)
|
ubuntu|debian|devuan|linuxmint|lmde)
|
||||||
__file /etc/apt/apt.conf.d/99-default-release \
|
__file /etc/apt/apt.conf.d/99-default-release \
|
||||||
--owner root --group root --mode 644 \
|
--owner root --group root --mode 644 \
|
||||||
--source - << DONE
|
--source - << DONE
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,4 @@ else
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
apt-mark showhold | grep -q "^${name}$" && echo hold || echo unhold
|
apt-mark showhold | grep -Fq "$name" && echo hold || echo unhold
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ os=$(cat "${__global:?}/explorer/os")
|
||||||
|
|
||||||
case ${os}
|
case ${os}
|
||||||
in
|
in
|
||||||
(ubuntu|debian|devuan)
|
(ubuntu|debian|devuan|linuxmint|lmde)
|
||||||
__file /etc/apt/apt.conf.d/00InstallRecommends --state present \
|
__file /etc/apt/apt.conf.d/00InstallRecommends --state present \
|
||||||
--owner root --group root --mode 0644 --source - <<-'EOF'
|
--owner root --group root --mode 0644 --source - <<-'EOF'
|
||||||
APT::Install-Recommends "false";
|
APT::Install-Recommends "false";
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ priority="$(cat "$__object/parameter/priority")"
|
||||||
|
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu|devuan)
|
debian|ubuntu|devuan|linux|lmde)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "This type is specific to Debian and it's derivatives" >&2
|
printf "This type is specific to Debian and it's derivatives" >&2
|
||||||
|
|
@ -57,11 +57,6 @@ __file "/etc/apt/preferences.d/$name" \
|
||||||
--owner root --group root --mode 0644 \
|
--owner root --group root --mode 0644 \
|
||||||
--state "$state" \
|
--state "$state" \
|
||||||
--source - << EOF
|
--source - << EOF
|
||||||
# Created by cdist ${__type##*/}
|
|
||||||
# Do not change. Changes will be overwritten.
|
|
||||||
#
|
|
||||||
|
|
||||||
# $name
|
|
||||||
Package: $package
|
Package: $package
|
||||||
Pin: $pin
|
Pin: $pin
|
||||||
Pin-Priority: $priority
|
Pin-Priority: $priority
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
500
|
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
state
|
state
|
||||||
package
|
package
|
||||||
priority
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
distribution
|
distribution
|
||||||
|
priority
|
||||||
|
|
|
||||||
55
cdist/conf/type/__apt_ppa/files/remove-apt-repository
Executable file
55
cdist/conf/type/__apt_ppa/files/remove-apt-repository
Executable file
|
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Remove the given apt repository.
|
||||||
|
#
|
||||||
|
# Exit with:
|
||||||
|
# 0: if it worked
|
||||||
|
# 1: if not
|
||||||
|
# 2: on other error
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from aptsources import distro, sourceslist
|
||||||
|
from softwareproperties import ppa
|
||||||
|
from softwareproperties.SoftwareProperties import SoftwareProperties
|
||||||
|
|
||||||
|
|
||||||
|
def remove_if_empty(file_name):
|
||||||
|
with open(file_name, 'r') as f:
|
||||||
|
if f.read().strip():
|
||||||
|
return
|
||||||
|
os.unlink(file_name)
|
||||||
|
|
||||||
|
def remove_repository(repository):
|
||||||
|
#print 'repository:', repository
|
||||||
|
codename = distro.get_distro().codename
|
||||||
|
#print 'codename:', codename
|
||||||
|
(line, file) = ppa.expand_ppa_line(repository.strip(), codename)
|
||||||
|
#print 'line:', line
|
||||||
|
#print 'file:', file
|
||||||
|
deb_source_entry = sourceslist.SourceEntry(line, file)
|
||||||
|
src_source_entry = sourceslist.SourceEntry('deb-src{}'.format(line[3:]), file)
|
||||||
|
|
||||||
|
try:
|
||||||
|
sp = SoftwareProperties()
|
||||||
|
sp.remove_source(deb_source_entry)
|
||||||
|
try:
|
||||||
|
# If there's a deb-src entry, remove that too
|
||||||
|
sp.remove_source(src_source_entry)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
remove_if_empty(file)
|
||||||
|
return True
|
||||||
|
except ValueError:
|
||||||
|
print >> sys.stderr, "Error: '%s' doesn't exists in a sourcelist file" % line
|
||||||
|
return False
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if (len(sys.argv) != 2):
|
||||||
|
print >> sys.stderr, 'Error: need a repository as argument'
|
||||||
|
sys.exit(2)
|
||||||
|
repository = sys.argv[1]
|
||||||
|
if remove_repository(repository):
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
|
|
@ -29,9 +29,9 @@ fi
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present)
|
present)
|
||||||
echo "add-apt-repository -y '$name'"
|
echo "add-apt-repository '$name'"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
echo "add-apt-repository -r -y '$name'"
|
echo "remove-apt-repository '$name'"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,9 @@
|
||||||
|
|
||||||
__package software-properties-common
|
__package software-properties-common
|
||||||
|
|
||||||
|
require="__package/software-properties-common" \
|
||||||
|
__file /usr/local/bin/remove-apt-repository \
|
||||||
|
--source "$__type/files/remove-apt-repository" \
|
||||||
|
--mode 0755
|
||||||
|
|
||||||
require="$__object_name" __apt_update_index
|
require="$__object_name" __apt_update_index
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,13 @@
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
entry="$uri $distribution $component"
|
entry="$uri $distribution $component"
|
||||||
|
|
||||||
cat << DONE
|
cat << DONE
|
||||||
# Created by cdist ${__type##*/}
|
# Created by cdist ${__type##*/}
|
||||||
# Do not change. Changes will be overwritten.
|
# Do not change. Changes will be overwritten.
|
||||||
#
|
#
|
||||||
|
|
||||||
# $name
|
# $name
|
||||||
deb ${options} $entry
|
deb ${forcedarch} $entry
|
||||||
DONE
|
DONE
|
||||||
if [ -f "$__object/parameter/include-src" ]; then
|
if [ -f "$__object/parameter/include-src" ]; then
|
||||||
echo "deb-src $entry"
|
echo "deb-src $entry"
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,6 @@ OPTIONAL PARAMETERS
|
||||||
arch
|
arch
|
||||||
set this if you need to force and specific arch (ubuntu specific)
|
set this if you need to force and specific arch (ubuntu specific)
|
||||||
|
|
||||||
signed-by
|
|
||||||
provide a GPG key fingerprint or keyring path for signature checks
|
|
||||||
|
|
||||||
state
|
state
|
||||||
'present' or 'absent', defaults to 'present'
|
'present' or 'absent', defaults to 'present'
|
||||||
|
|
||||||
|
|
@ -59,11 +56,6 @@ EXAMPLES
|
||||||
--uri http://archive.canonical.com/ \
|
--uri http://archive.canonical.com/ \
|
||||||
--component partner --state present
|
--component partner --state present
|
||||||
|
|
||||||
__apt_source goaccess \
|
|
||||||
--uri http://deb.goaccess.io/ \
|
|
||||||
--component main \
|
|
||||||
--signed-by C03B48887D5E56B046715D3297BD1A0133449C3D
|
|
||||||
|
|
||||||
|
|
||||||
AUTHORS
|
AUTHORS
|
||||||
-------
|
-------
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
state="$(cat "$__object/parameter/state")"
|
state="$(cat "$__object/parameter/state")"
|
||||||
uri="$(cat "$__object/parameter/uri")"
|
uri="$(cat "$__object/parameter/uri")"
|
||||||
options=""
|
|
||||||
|
|
||||||
if [ -f "$__object/parameter/distribution" ]; then
|
if [ -f "$__object/parameter/distribution" ]; then
|
||||||
distribution="$(cat "$__object/parameter/distribution")"
|
distribution="$(cat "$__object/parameter/distribution")"
|
||||||
|
|
@ -32,15 +31,9 @@ fi
|
||||||
component="$(cat "$__object/parameter/component")"
|
component="$(cat "$__object/parameter/component")"
|
||||||
|
|
||||||
if [ -f "$__object/parameter/arch" ]; then
|
if [ -f "$__object/parameter/arch" ]; then
|
||||||
options="arch=$(cat "$__object/parameter/arch")"
|
forcedarch="[arch=$(cat "$__object/parameter/arch")]"
|
||||||
fi
|
else
|
||||||
|
forcedarch=""
|
||||||
if [ -f "$__object/parameter/signed-by" ]; then
|
|
||||||
options="$options signed-by=$(cat "$__object/parameter/signed-by")"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$options" ]; then
|
|
||||||
options="[$options]"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# export variables for use in template
|
# export variables for use in template
|
||||||
|
|
@ -48,7 +41,7 @@ export name
|
||||||
export uri
|
export uri
|
||||||
export distribution
|
export distribution
|
||||||
export component
|
export component
|
||||||
export options
|
export forcedarch
|
||||||
|
|
||||||
# generate file from template
|
# generate file from template
|
||||||
mkdir "$__object/files"
|
mkdir "$__object/files"
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,3 @@ state
|
||||||
distribution
|
distribution
|
||||||
component
|
component
|
||||||
arch
|
arch
|
||||||
signed-by
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
alpine|scientific|centos|redhat|ubuntu|debian|devuan|archlinux|gentoo|linuxmint|lmde)
|
||||||
# any linux should work
|
# any linux should work
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ esac
|
||||||
|
|
||||||
distribution_setup () {
|
distribution_setup () {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
# consul is only available starting Debian 10 (buster).
|
# consul is only available starting Debian 10 (buster).
|
||||||
# See https://packages.debian.org/buster/consul
|
# See https://packages.debian.org/buster/consul
|
||||||
|
|
@ -136,7 +137,7 @@ init_upstart()
|
||||||
|
|
||||||
manual_setup () {
|
manual_setup () {
|
||||||
case "$os" in
|
case "$os" in
|
||||||
alpine|scientific|centos|debian|devuan|redhat|ubuntu)
|
alpine|scientific|centos|debian|devuan|redhat|ubuntu|linuxmint|lmde)
|
||||||
# whitelist safeguard
|
# whitelist safeguard
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
|
|
@ -191,6 +192,7 @@ manual_setup () {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
os_version=$(cat "$__global/explorer/os_version")
|
os_version=$(cat "$__global/explorer/os_version")
|
||||||
major_version="${os_version%%.*}"
|
major_version="${os_version%%.*}"
|
||||||
|
|
@ -209,6 +211,7 @@ manual_setup () {
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
#FIXME: Linux Mint
|
||||||
ubuntu)
|
ubuntu)
|
||||||
init_upstart
|
init_upstart
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ case "$os" in
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ubuntu|debian)
|
ubuntu|debian|linuxmint|lmde)
|
||||||
if [ "${state}" = "present" ]; then
|
if [ "${state}" = "present" ]; then
|
||||||
__package apt-transport-https
|
__package apt-transport-https
|
||||||
__package ca-certificates
|
__package ca-certificates
|
||||||
|
|
|
||||||
|
|
@ -37,12 +37,6 @@ state
|
||||||
source
|
source
|
||||||
forwarded to :strong:`__file` type
|
forwarded to :strong:`__file` type
|
||||||
|
|
||||||
file
|
|
||||||
forwarded to :strong:`__file` type
|
|
||||||
This can be used if multiple users need to have a dotfile updated,
|
|
||||||
which will result in duplicate object id errors. When using the
|
|
||||||
file parameter the object id can be some unique value.
|
|
||||||
|
|
||||||
MESSAGES
|
MESSAGES
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
@ -67,15 +61,6 @@ EXAMPLES
|
||||||
# Install default xmonad config for user 'eve'. Parent directory is created automatically.
|
# Install default xmonad config for user 'eve'. Parent directory is created automatically.
|
||||||
__dot_file .xmonad/xmonad.hs --user eve --state exists --source "$__files/xmonad.hs"
|
__dot_file .xmonad/xmonad.hs --user eve --state exists --source "$__files/xmonad.hs"
|
||||||
|
|
||||||
# install .vimrc for root and some users
|
|
||||||
for user in root userx usery userz; do
|
|
||||||
__dot_file "${user}_dot_vimrc" \
|
|
||||||
--user $user \
|
|
||||||
--file .vimrc \
|
|
||||||
--state exists \
|
|
||||||
--source "$__files/$user/.vimrc"
|
|
||||||
done
|
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,19 +20,13 @@ user="$(cat "${__object}/parameter/user")"
|
||||||
home="$(cat "${__object}/explorer/home")"
|
home="$(cat "${__object}/explorer/home")"
|
||||||
primary_group="$(cat "${__object}/explorer/primary_group")"
|
primary_group="$(cat "${__object}/explorer/primary_group")"
|
||||||
dirmode="$(cat "${__object}/parameter/dirmode")"
|
dirmode="$(cat "${__object}/parameter/dirmode")"
|
||||||
if [ -f "${__object}/parameter/file" ]; then
|
|
||||||
file="$(cat "${__object}/parameter/file")"
|
|
||||||
else
|
|
||||||
file="${__object_id}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Create parent directory. Type __directory has flag 'parents', but it
|
# Create parent directory. Type __directory has flag 'parents', but it
|
||||||
# will leave us with root-owned directory in user home, which is not
|
# will leave us with root-owned directory in user home, which is not
|
||||||
# acceptable. So we create parent directories one-by-one. XXX: maybe
|
# acceptable. So we create parent directories one-by-one. XXX: maybe
|
||||||
# it should be fixed in '__directory'?
|
# it should be fixed in '__directory'?
|
||||||
set --
|
set --
|
||||||
subpath=${file}
|
subpath=${__object_id}
|
||||||
while subpath="$(dirname "${subpath}")" ; do
|
while subpath="$(dirname "${subpath}")" ; do
|
||||||
[ "${subpath}" = . ] && break
|
[ "${subpath}" = . ] && break
|
||||||
set -- "${subpath}" "$@"
|
set -- "${subpath}" "$@"
|
||||||
|
|
@ -70,4 +64,4 @@ if [ "${source}" = "-" ] ; then
|
||||||
fi
|
fi
|
||||||
unset source
|
unset source
|
||||||
|
|
||||||
__file "${home}/${file}" --owner "$user" --group "$primary_group" "$@"
|
__file "${home}/${__object_id}" --owner "$user" --group "$primary_group" "$@"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
# 2013-2022 Steven Armstrong (steven-cdist armstrong.cc)
|
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
|
@ -72,7 +72,6 @@ if [ "$state_should" = "present" ] || [ "$state_should" = "exists" ]; then
|
||||||
if [ "$type" != "file" ]; then
|
if [ "$type" != "file" ]; then
|
||||||
# destination is not a regular file, upload source to replace it
|
# destination is not a regular file, upload source to replace it
|
||||||
upload_file=1
|
upload_file=1
|
||||||
echo upload >> "$__messages_out"
|
|
||||||
else
|
else
|
||||||
local_cksum="$(cksum < "$source")"
|
local_cksum="$(cksum < "$source")"
|
||||||
remote_cksum="$(cat "$__object/explorer/cksum")"
|
remote_cksum="$(cat "$__object/explorer/cksum")"
|
||||||
|
|
@ -89,39 +88,27 @@ if [ "$state_should" = "present" ] || [ "$state_should" = "exists" ]; then
|
||||||
mkdir "$__object/files"
|
mkdir "$__object/files"
|
||||||
touch "$__object/files/set-attributes"
|
touch "$__object/files/set-attributes"
|
||||||
|
|
||||||
if [ "$create_file" ]; then
|
|
||||||
# When creating an empty file we create it locally and then
|
|
||||||
# upload it so that permissions can be set before moving the file
|
|
||||||
# into place.
|
|
||||||
source="$__object/files/empty"
|
|
||||||
touch "$source"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# upload file to temp location
|
# upload file to temp location
|
||||||
upload_destination="${destination}.cdist.${__cdist_object_marker}.$$"
|
tempfile_template="${destination}.cdist.XXXXXXXXXX"
|
||||||
# Yes, we are aware that this is a race condition.
|
|
||||||
# However:
|
|
||||||
# a) cdist usually writes to directories that are not user writable
|
|
||||||
# (probably > 99.9%)
|
|
||||||
# b) if they are user owned, the user / attacker always wins
|
|
||||||
# (probably < 0.1%)
|
|
||||||
# c) the only case which we could improve are tmp directories and we
|
|
||||||
# don't think managing tmp directories with cdist is a typical case
|
|
||||||
# ("the rest %)"
|
|
||||||
|
|
||||||
# Tell gencode-remote to where we uploaded the file so it can move
|
|
||||||
# it to its final destination.
|
|
||||||
echo "$upload_destination" > "$__object/files/upload-destination"
|
|
||||||
|
|
||||||
# IPv6 fix
|
|
||||||
if echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
|
|
||||||
then
|
|
||||||
my_target_host="[${__target_host}]"
|
|
||||||
else
|
|
||||||
my_target_host="${__target_host}"
|
|
||||||
fi
|
|
||||||
cat << DONE
|
cat << DONE
|
||||||
$__remote_copy "$source" "${my_target_host}:${upload_destination}"
|
destination_upload="\$($__remote_exec $__target_host "mktemp $tempfile_template")"
|
||||||
|
DONE
|
||||||
|
if [ "$upload_file" ]; then
|
||||||
|
echo upload >> "$__messages_out"
|
||||||
|
# IPv6 fix
|
||||||
|
if echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$'
|
||||||
|
then
|
||||||
|
my_target_host="[${__target_host}]"
|
||||||
|
else
|
||||||
|
my_target_host="${__target_host}"
|
||||||
|
fi
|
||||||
|
cat << DONE
|
||||||
|
$__remote_copy "$source" "${my_target_host}:\$destination_upload"
|
||||||
|
DONE
|
||||||
|
fi
|
||||||
|
# move uploaded file into place
|
||||||
|
cat << DONE
|
||||||
|
$__remote_exec $__target_host "rm -rf \"$destination\"; mv \"\$destination_upload\" \"$destination\""
|
||||||
DONE
|
DONE
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
#
|
#
|
||||||
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
# 2011-2013 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
# 2013-2022 Steven Armstrong (steven-cdist armstrong.cc)
|
# 2013 Steven Armstrong (steven-cdist armstrong.cc)
|
||||||
#
|
#
|
||||||
# This file is part of cdist.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
|
@ -62,13 +62,6 @@ set_mode() {
|
||||||
|
|
||||||
case "$state_should" in
|
case "$state_should" in
|
||||||
present|exists)
|
present|exists)
|
||||||
if [ -f "$__object/files/upload-destination" ]; then
|
|
||||||
final_destination="$destination"
|
|
||||||
# We change the 'global' $destination variable here so we can
|
|
||||||
# change attributes of the new/uploaded file before moving it
|
|
||||||
# to it's final destination.
|
|
||||||
destination="$(cat "$__object/files/upload-destination")"
|
|
||||||
fi
|
|
||||||
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
|
# Note: Mode - needs to happen last as a chown/chgrp can alter mode by
|
||||||
# clearing S_ISUID and S_ISGID bits (see chown(2))
|
# clearing S_ISUID and S_ISGID bits (see chown(2))
|
||||||
for attribute in group owner mode; do
|
for attribute in group owner mode; do
|
||||||
|
|
@ -88,11 +81,6 @@ case "$state_should" in
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -f "$__object/files/upload-destination" ]; then
|
|
||||||
# move uploaded file into place
|
|
||||||
printf 'rm -rf "%s"\n' "$final_destination"
|
|
||||||
printf 'mv "%s" "%s"\n' "$destination" "$final_destination"
|
|
||||||
fi
|
|
||||||
if [ -f "$__object/files/set-attributes" ]; then
|
if [ -f "$__object/files/set-attributes" ]; then
|
||||||
# set-attributes is created if file is created or uploaded in gencode-local
|
# set-attributes is created if file is created or uploaded in gencode-local
|
||||||
fire_onchange=1
|
fire_onchange=1
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ if [ "$init" = 'systemd' ]; then
|
||||||
echo "systemctl \"$cmd\" \"$name\""
|
echo "systemctl \"$cmd\" \"$name\""
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
case "$os_version" in
|
case "$os_version" in
|
||||||
[1-7]*)
|
[1-7]*)
|
||||||
|
|
@ -72,7 +73,7 @@ else
|
||||||
echo "/etc/init.d/\"$name\" \"$cmd\""
|
echo "/etc/init.d/\"$name\" \"$cmd\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
echo "service \"$name\" \"$cmd\""
|
echo "service \"$name\" \"$cmd\""
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ go_executable=$(cat "$__object/explorer/go-executable")
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
case $os in
|
case $os in
|
||||||
debian|devuan|ubuntu)
|
debian|devuan|ubuntu|linuxmint|lmde)
|
||||||
__package build-essential
|
__package build-essential
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ os_version=$(cat "$__global/explorer/os_version")
|
||||||
|
|
||||||
require=""
|
require=""
|
||||||
case $os in
|
case $os in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian|devuan)
|
debian|devuan)
|
||||||
case $os_version in
|
case $os_version in
|
||||||
8*|jessie)
|
8*|jessie)
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ echo 'changed' >>"${__messages_out:?}"
|
||||||
# Use the good old way to set the hostname.
|
# Use the good old way to set the hostname.
|
||||||
case ${os}
|
case ${os}
|
||||||
in
|
in
|
||||||
(alpine|debian|devuan|ubuntu)
|
(alpine|debian|devuan|ubuntu|linuxmint|lmde)
|
||||||
echo 'hostname -F /etc/hostname'
|
echo 'hostname -F /etc/hostname'
|
||||||
;;
|
;;
|
||||||
(archlinux)
|
(archlinux)
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ fi
|
||||||
|
|
||||||
case ${os}
|
case ${os}
|
||||||
in
|
in
|
||||||
(alpine|debian|devuan|ubuntu|void)
|
(alpine|debian|devuan|ubuntu|void|linuxmint|lmde)
|
||||||
echo "${name_should}" | __file /etc/hostname --source -
|
echo "${name_should}" | __file /etc/hostname --source -
|
||||||
;;
|
;;
|
||||||
(archlinux)
|
(archlinux)
|
||||||
|
|
|
||||||
|
|
@ -104,11 +104,12 @@ in
|
||||||
unset CDIST_ORDER_DEPENDENCY
|
unset CDIST_ORDER_DEPENDENCY
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
(debian|devuan|ubuntu)
|
(debian|devuan|ubuntu|linuxmint|lmde)
|
||||||
os_major=$(sed 's/[^0-9].*$//' "${__global:?}/explorer/os_version")
|
os_major=$(sed 's/[^0-9].*$//' "${__global:?}/explorer/os_version")
|
||||||
|
|
||||||
case ${os}
|
case ${os}
|
||||||
in
|
in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
(debian)
|
(debian)
|
||||||
if test "${os_major}" -ge 7
|
if test "${os_major}" -ge 7
|
||||||
then
|
then
|
||||||
|
|
@ -129,7 +130,7 @@ in
|
||||||
(devuan)
|
(devuan)
|
||||||
update_rcS=false
|
update_rcS=false
|
||||||
;;
|
;;
|
||||||
(ubuntu)
|
(ubuntu|linuxmint)
|
||||||
update_rcS=$(test "${os_major}" -lt 16 && echo true || echo false)
|
update_rcS=$(test "${os_major}" -lt 16 && echo true || echo false)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,13 @@ if grep -q ^DISTRIB_ID=Ubuntu "$chroot/etc/lsb-release" 2>/dev/null; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if grep -q ^DISTRIB_ID=LinuxMint "$chroot/etc/lsb-release" 2>/dev/null; then
|
||||||
|
echo linuxmint
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
|
|
||||||
if [ -f "$chroot/etc/debian_version" ]; then
|
if [ -f "$chroot/etc/debian_version" ]; then
|
||||||
echo debian
|
echo debian
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ exec > "$install_script"
|
||||||
printf '#!/bin/sh -l\n'
|
printf '#!/bin/sh -l\n'
|
||||||
|
|
||||||
case "$target_os" in
|
case "$target_os" in
|
||||||
ubuntu|debian)
|
ubuntu|debian|linuxmint|lmde)
|
||||||
if [ -s "$__global/explorer/efi" ]; then
|
if [ -s "$__global/explorer/efi" ]; then
|
||||||
# FIXME: untested. maybe also just run update-grub for EFI system?
|
# FIXME: untested. maybe also just run update-grub for EFI system?
|
||||||
printf 'grub-mkconfig --output=/boot/efi/EFI/%s/grub.cfg\n' "$target_os"
|
printf 'grub-mkconfig --output=/boot/efi/EFI/%s/grub.cfg\n' "$target_os"
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ if [ -z "${certbot_fullpath}" ]; then
|
||||||
alpine)
|
alpine)
|
||||||
__package certbot
|
__package certbot
|
||||||
;;
|
;;
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
case "$os_version" in
|
case "$os_version" in
|
||||||
8*)
|
8*)
|
||||||
|
|
@ -85,10 +86,10 @@ if [ -z "${certbot_fullpath}" ]; then
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
freebsd)
|
freebsd)
|
||||||
__package py39-certbot
|
__package py37-certbot
|
||||||
certbot_fullpath="/usr/local/bin/certbot"
|
certbot_fullpath="/usr/local/bin/certbot"
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
__package certbot
|
__package certbot
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,12 @@ os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian|devuan)
|
debian|devuan)
|
||||||
# Debian needs a seperate package
|
# Debian needs a seperate package
|
||||||
__package locales --state present
|
__package locales --state present
|
||||||
;;
|
;;
|
||||||
archlinux|suse|ubuntu|scientific|centos|alpine)
|
archlinux|suse|ubuntu|scientific|centos|alpine|linuxmint)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
case $os
|
case $os
|
||||||
in
|
in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
if version_ge 4 <"${__global}/explorer/os_version"
|
if version_ge 4 <"${__global}/explorer/os_version"
|
||||||
then
|
then
|
||||||
|
|
@ -67,7 +68,7 @@ in
|
||||||
devuan)
|
devuan)
|
||||||
locale_conf="/etc/default/locale"
|
locale_conf="/etc/default/locale"
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
if version_ge 6.10 <"${__global}/explorer/os_version"
|
if version_ge 6.10 <"${__global}/explorer/os_version"
|
||||||
then
|
then
|
||||||
# Ubuntu 6.10 (edgy) and later
|
# Ubuntu 6.10 (edgy) and later
|
||||||
|
|
|
||||||
|
|
@ -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)
|
(archlinux|debian|devuan|ubuntu|suse|centos|fedora|redhat|scientific|linuxmint|lmde)
|
||||||
# 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
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
case $(cat "${__global:?}/explorer/os")
|
case $(cat "${__global:?}/explorer/os")
|
||||||
in
|
in
|
||||||
(debian|devuan)
|
(debian|devuan|lmde)
|
||||||
__package_apt locales --state present
|
__package_apt locales --state present
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ case "${os}" in
|
||||||
tls_cipher_suite="HIGH:MEDIUM:+SSLv2"
|
tls_cipher_suite="HIGH:MEDIUM:+SSLv2"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
debian|ubuntu|devuan)
|
debian|ubuntu|devuan|linuxmint|lmde)
|
||||||
PKGS="slapd ldap-utils"
|
PKGS="slapd ldap-utils"
|
||||||
ETC="/etc"
|
ETC="/etc"
|
||||||
SLAPD_DIR="/etc/ldap"
|
SLAPD_DIR="/etc/ldap"
|
||||||
|
|
@ -157,7 +157,7 @@ case "${os}" in
|
||||||
--comment "# LDAP Listener URLs" \
|
--comment "# LDAP Listener URLs" \
|
||||||
"${__target_host}__slapd_flags"
|
"${__target_host}__slapd_flags"
|
||||||
;;
|
;;
|
||||||
debian|ubuntu|devuan)
|
debian|ubuntu|devuan|linuxmint|lmde)
|
||||||
require="__package/${PKG_MAIN}" __line rm_slapd_conf \
|
require="__package/${PKG_MAIN}" __line rm_slapd_conf \
|
||||||
--file ${ETC}/default/slapd \
|
--file ${ETC}/default/slapd \
|
||||||
--regex 'SLAPD_CONF=.*' \
|
--regex 'SLAPD_CONF=.*' \
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
amazon|scientific|centos|fedora|redhat) type="yum" ;;
|
amazon|scientific|centos|fedora|redhat) type="yum" ;;
|
||||||
archlinux) type="pacman" ;;
|
archlinux) type="pacman" ;;
|
||||||
debian|ubuntu|devuan) type="apt" ;;
|
debian|ubuntu|devuan|linuxmint|lmde) type="apt" ;;
|
||||||
freebsd)
|
freebsd)
|
||||||
if [ -n "$(cat "$__object/explorer/pkgng_exists")" ]; then
|
if [ -n "$(cat "$__object/explorer/pkgng_exists")" ]; then
|
||||||
type="pkgng_freebsd"
|
type="pkgng_freebsd"
|
||||||
|
|
|
||||||
|
|
@ -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 present
|
__package luarocks --state installed
|
||||||
__package make --state present
|
__package make --state installed
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ else
|
||||||
os="$("$__explorer/os")"
|
os="$("$__explorer/os")"
|
||||||
case "$os" in
|
case "$os" in
|
||||||
amazon|scientific|centos|fedora|redhat) echo "yum" ;;
|
amazon|scientific|centos|fedora|redhat) echo "yum" ;;
|
||||||
debian|ubuntu|devuan) echo "apt" ;;
|
debian|ubuntu|devuan|linuxmint|lmde) echo "apt" ;;
|
||||||
archlinux) echo "pacman" ;;
|
archlinux) echo "pacman" ;;
|
||||||
alpine) echo "apk" ;;
|
alpine) echo "apk" ;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ else
|
||||||
os="$(cat "$__global/explorer/os")"
|
os="$(cat "$__global/explorer/os")"
|
||||||
case "$os" in
|
case "$os" in
|
||||||
amazon|scientific|centos|fedora|redhat) type="yum" ;;
|
amazon|scientific|centos|fedora|redhat) type="yum" ;;
|
||||||
debian|ubuntu|devuan) type="apt" ;;
|
debian|ubuntu|devuan|linuxmint|lmde) type="apt" ;;
|
||||||
archlinux) type="pacman" ;;
|
archlinux) type="pacman" ;;
|
||||||
*)
|
*)
|
||||||
echo "Don't know how to manage packages on: $os" >&2
|
echo "Don't know how to manage packages on: $os" >&2
|
||||||
|
|
|
||||||
|
|
@ -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)
|
ubuntu|debian|archlinux|scientific|centos|devuan|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
os=$("$__explorer/os")
|
os=$("$__explorer/os")
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
alpine|ubuntu|debian|archlinux|suse|scientific|centos|devuan)
|
alpine|ubuntu|debian|archlinux|suse|scientific|centos|devuan|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
alpine|archlinux|centos|debian|devuan|suse|scientific|ubuntu|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
ubuntu|debian|archlinux|scientific|centos|devuan|linuxmint|lmde)
|
||||||
echo "postfix reload"
|
echo "postfix reload"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ in
|
||||||
(centos|rhel|scientific)
|
(centos|rhel|scientific)
|
||||||
echo 'postgres'
|
echo 'postgres'
|
||||||
;;
|
;;
|
||||||
(debian|devuan|ubuntu)
|
(debian|devuan|ubuntu|linuxmint|lmde)
|
||||||
echo 'postgres'
|
echo 'postgres'
|
||||||
;;
|
;;
|
||||||
(freebsd)
|
(freebsd)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ test "$(cat "${__object}/parameter/state")" != 'absent' || exit 0
|
||||||
|
|
||||||
case $("${__explorer}/os")
|
case $("${__explorer}/os")
|
||||||
in
|
in
|
||||||
debian|devuan|ubuntu)
|
debian|devuan|ubuntu|linuxmint|lmde)
|
||||||
has_alternatives=true
|
has_alternatives=true
|
||||||
|
|
||||||
# NOTE: Old versions do not support `--list`, in this case ignore the errors.
|
# NOTE: Old versions do not support `--list`, in this case ignore the errors.
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ package_name='sensible-utils'
|
||||||
|
|
||||||
case $os
|
case $os
|
||||||
in
|
in
|
||||||
debian)
|
debian|linuxmint|lmde)
|
||||||
pkg_type='apt'
|
pkg_type='apt'
|
||||||
;;
|
;;
|
||||||
devuan)
|
devuan)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ if [ -f "$file" ]; then
|
||||||
grep -v -F -x '$line' '$file' >\$tmpfile
|
grep -v -F -x '$line' '$file' >\$tmpfile
|
||||||
fi
|
fi
|
||||||
cat "\$tmpfile" >"$file"
|
cat "\$tmpfile" >"$file"
|
||||||
rm -f "\$tmpfile"
|
|
||||||
DONE
|
DONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ state_should=$(cat "${__object:?}/parameter/state")
|
||||||
|
|
||||||
case ${os}
|
case ${os}
|
||||||
in
|
in
|
||||||
(alpine|centos|fedora|redhat|scientific|debian|devuan|ubuntu)
|
(alpine|centos|fedora|redhat|scientific|debian|devuan|ubuntu|linuxmint|lmde)
|
||||||
if test "${state_should}" != 'absent'
|
if test "${state_should}" != 'absent'
|
||||||
then
|
then
|
||||||
__package openssh-server --state present
|
__package openssh-server --state present
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ if [ "$init" = 'systemd' ]; then
|
||||||
|
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|openwrt|devuan)
|
debian|openwrt|devuan|lmde)
|
||||||
state="absent"
|
state="absent"
|
||||||
for file in "/etc/rc$runlevel.d/S"??"$name"
|
for file in "/etc/rc$runlevel.d/S"??"$name"
|
||||||
do
|
do
|
||||||
|
|
@ -48,7 +48,7 @@ else
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
state="absent"
|
state="absent"
|
||||||
for file in "/etc/rc$runlevel.d/S"??"$name"
|
for file in "/etc/rc$runlevel.d/S"??"$name"
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ case "$state_should" in
|
||||||
echo "systemctl -q enable '$name'"
|
echo "systemctl -q enable '$name'"
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
case "$os_version" in
|
case "$os_version" in
|
||||||
[1-7]*)
|
[1-7]*)
|
||||||
|
|
@ -73,7 +74,7 @@ case "$state_should" in
|
||||||
echo "'/etc/init.d/$name' enable || [ -f /etc/rc.d/S??'$name' ]"
|
echo "'/etc/init.d/$name' enable || [ -f /etc/rc.d/S??'$name' ]"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
echo "update-rc.d '$name' defaults >/dev/null"
|
echo "update-rc.d '$name' defaults >/dev/null"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
redhat|centos|ubuntu|debian|devuan|archlinux|gentoo|coreos|linuxmint|lmde)
|
||||||
flag='-w'
|
flag='-w'
|
||||||
;;
|
;;
|
||||||
# BusyBox
|
# BusyBox
|
||||||
|
|
|
||||||
|
|
@ -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)
|
alpine|redhat|centos|ubuntu|debian|devuan|archlinux|coreos|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
# BSD
|
# BSD
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ if [ "$timezone_is" = "$timezone_should" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
ubuntu|debian|devuan|coreos|alpine)
|
ubuntu|debian|devuan|coreos|alpine|linuxmint|lmde)
|
||||||
echo "echo \"$timezone_should\" > /etc/timezone"
|
echo "echo \"$timezone_should\" > /etc/timezone"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ timezone=$(cat "$__object/parameter/tz")
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
archlinux|debian|ubuntu|devuan|alpine)
|
archlinux|debian|ubuntu|devuan|alpine|linuxmint|lmde)
|
||||||
__package tzdata
|
__package tzdata
|
||||||
export require="__package/tzdata"
|
export require="__package/tzdata"
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ case "$src" in
|
||||||
;;
|
;;
|
||||||
*.lzma|*.xz|*.txz)
|
*.lzma|*.xz|*.txz)
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu|devuan)
|
debian|ubuntu|devuan|linuxmint|lmde)
|
||||||
__package xz-utils
|
__package xz-utils
|
||||||
;;
|
;;
|
||||||
alpine|centos)
|
alpine|centos)
|
||||||
|
|
@ -30,7 +30,7 @@ case "$src" in
|
||||||
;;
|
;;
|
||||||
*.rar)
|
*.rar)
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu|devuan|alpine|freebsd)
|
debian|ubuntu|devuan|alpine|freebsd|linuxmint|lmde)
|
||||||
__package unrar
|
__package unrar
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ state=$(cat "$__object/parameter/state")
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu)
|
debian|ubuntu|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ state=$(cat "$__object/parameter/state")
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu)
|
debian|ubuntu|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ servers=$(cat "$__object/parameter/servers")
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu)
|
debian|ubuntu|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ fi
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
case "$os" in
|
case "$os" in
|
||||||
debian|ubuntu)
|
debian|ubuntu|linuxmint|lmde)
|
||||||
:
|
:
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,13 @@ if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if grep -q ^DISTRIB_ID=LinuxMint /etc/lsb-release 2>/dev/null; then
|
||||||
|
echo linuxmint
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
|
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
echo debian
|
echo debian
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ case "$($__explorer/os)" in
|
||||||
# empty, but well...
|
# empty, but well...
|
||||||
cat /etc/arch-release
|
cat /etc/arch-release
|
||||||
;;
|
;;
|
||||||
|
#FIXME: Linux Mint Debian Edition/lmde
|
||||||
debian)
|
debian)
|
||||||
cat /etc/debian_version
|
cat /etc/debian_version
|
||||||
;;
|
;;
|
||||||
|
|
@ -67,7 +68,7 @@ case "$($__explorer/os)" in
|
||||||
cat /etc/SuSE-release
|
cat /etc/SuSE-release
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
ubuntu)
|
ubuntu|linuxmint)
|
||||||
lsb_release -sr
|
lsb_release -sr
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,7 @@
|
||||||
Changelog
|
Changelog
|
||||||
---------
|
---------
|
||||||
|
|
||||||
7.0.1:
|
next:
|
||||||
* Core: Remove double definition of scan parser (Nico Schottelius)
|
|
||||||
* Type __apt_mark: Narrow down grep for hold packages (marcoduif)
|
|
||||||
* Type __apt_source: Set required options variable (Mark Verboom)
|
|
||||||
* Type __letsencrypt_cert: Update python version (Michelle)
|
|
||||||
* Explorer os_version: Add support for Daedalus (Michelle)
|
|
||||||
* Explorer machine_type: Correct incorrect VMM matching (Mark Verboom)
|
|
||||||
|
|
||||||
7.0.0: 2022-07-31
|
|
||||||
* Explorer machine_type: Rewrite (Dennis Camera)
|
* Explorer machine_type: Rewrite (Dennis Camera)
|
||||||
* New type: __sed (Ander Punnar)
|
* New type: __sed (Ander Punnar)
|
||||||
* New type: __haproxy_dualstack (Evilham and ungleich)
|
* New type: __haproxy_dualstack (Evilham and ungleich)
|
||||||
|
|
@ -20,13 +12,6 @@ Changelog
|
||||||
* Type __package_apt: Fix complaint about suite change (Matthias Stecher)
|
* Type __package_apt: Fix complaint about suite change (Matthias Stecher)
|
||||||
* Type __debconf_set_selections: Fix bug where --file was unsupported (Evilham)
|
* Type __debconf_set_selections: Fix bug where --file was unsupported (Evilham)
|
||||||
* Types __letsencrypt_cert, __grafana_dashboard: Improve bullseye support (Evilham)
|
* Types __letsencrypt_cert, __grafana_dashboard: Improve bullseye support (Evilham)
|
||||||
* Type __ssh_authorized_key: Also remove tmpfile if removing line (Mark Verboom)
|
|
||||||
* Type __apt_pin: Add default priority, add comment in generated files (Daniel Fancsali)
|
|
||||||
* Type __file: make file uploading and attribute changes more atomic (Steven Armstrong)
|
|
||||||
* Type __dot_file: Add support for using --file parameter (Stephan Leemburg)
|
|
||||||
* Type __apt_ppa: Replace custom "remove-apt-repository" with add-apt-repository -r (Romain Dartigues)
|
|
||||||
* Type __apt_source: Add signed-by parameter (Daniel Fancsali)
|
|
||||||
* Explorer: add support for checkpoint (Stephan Leemburg)
|
|
||||||
|
|
||||||
6.9.8: 2021-08-24
|
6.9.8: 2021-08-24
|
||||||
* Type __rsync: Rewrite (Ander Punnar)
|
* Type __rsync: Rewrite (Ander Punnar)
|
||||||
|
|
|
||||||
|
|
@ -1,90 +0,0 @@
|
||||||
* Install requirements (Alpine)
|
|
||||||
- apk add py3-pycodestyle shellcheck py3-sphinx py3-sphinx_rtd_theme \
|
|
||||||
py3-build twine
|
|
||||||
* Ensure your gpg setup works with the email used in the git commit!
|
|
||||||
- For me this is nico@nico-notebook.schottelius.org
|
|
||||||
- Signature / id is on nb2
|
|
||||||
* Create ~/.pypirc
|
|
||||||
[distutils]
|
|
||||||
index-servers =
|
|
||||||
pypi
|
|
||||||
cdist
|
|
||||||
|
|
||||||
[pypi]
|
|
||||||
username = __token__
|
|
||||||
password = ...
|
|
||||||
|
|
||||||
[cdist]
|
|
||||||
repository = https://upload.pypi.org/legacy/
|
|
||||||
username = __token__
|
|
||||||
password = ...
|
|
||||||
|
|
||||||
* Add date in docs/changelog
|
|
||||||
* Run ./bin/cdist-build-helper
|
|
||||||
* TODO Move to "build"
|
|
||||||
- python3 -m build
|
|
||||||
* DONE git tag: when?
|
|
||||||
CLOSED: [2022-07-31 Sun 23:58]
|
|
||||||
** Asked during release process: ok
|
|
||||||
* DONE Pypi error with distutils: do not use distutils anymore
|
|
||||||
CLOSED: [2022-07-31 Sun 23:58]
|
|
||||||
python3 setup.py sdist upload
|
|
||||||
...
|
|
||||||
Creating tar archive
|
|
||||||
removing 'cdist-7.0.0' (and everything under it)
|
|
||||||
running upload
|
|
||||||
Submitting dist/cdist-7.0.0.tar.gz to https://upload.pypi.org/legacy/
|
|
||||||
Upload failed (400): Invalid value for blake2_256_digest. Error: Use a valid, hex-encoded, BLAKE2 message digest.
|
|
||||||
error: Upload failed (400): Invalid value for blake2_256_digest. Error: Use a valid, hex-encoded, BLAKE2 message digest.
|
|
||||||
(venv2) [22:50] nb2:cdist%
|
|
||||||
|
|
||||||
* DONE Pypi error with twine: fixed in twine 4.0.1
|
|
||||||
CLOSED: [2022-07-31 Sun 23:58]
|
|
||||||
|
|
||||||
Seeing:
|
|
||||||
|
|
||||||
(venv2) [22:47] nb2:cdist% twine upload dist/cdist-7.0.0*
|
|
||||||
Uploading distributions to https://upload.pypi.org/legacy/
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File "/usr/bin/twine", line 8, in <module>
|
|
||||||
sys.exit(main())
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/__main__.py", line 28, in main
|
|
||||||
result = cli.dispatch(sys.argv[1:])
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/cli.py", line 68, in dispatch
|
|
||||||
return main(args.args)
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/commands/upload.py", line 197, in main
|
|
||||||
return upload(upload_settings, parsed_args.dists)
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/commands/upload.py", line 141, in upload
|
|
||||||
resp = repository.upload(package)
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/repository.py", line 189, in upload
|
|
||||||
resp = self._upload(package)
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/repository.py", line 144, in _upload
|
|
||||||
data = package.metadata_dictionary()
|
|
||||||
File "/usr/lib/python3.10/site-packages/twine/package.py", line 181, in metadata_dictionary
|
|
||||||
"dynamic": meta.dynamic,
|
|
||||||
AttributeError: 'Wheel' object has no attribute 'dynamic'
|
|
||||||
|
|
||||||
|
|
||||||
Fix:
|
|
||||||
|
|
||||||
|
|
||||||
(venv2) [23:43] nb2:cdist% pipx run twine upload dist/*
|
|
||||||
⚠️ twine is already on your PATH and installed at /home/nico/venv2/bin/twine. Downloading and running anyway.
|
|
||||||
Uploading distributions to https://upload.pypi.org/legacy/
|
|
||||||
Uploading cdist-7.0.0-py3-none-any.whl
|
|
||||||
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 868.6/868.6 kB • 00:04 • 221.3 kB/s
|
|
||||||
Uploading cdist-7.0.0.tar.gz
|
|
||||||
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB • 00:08 • 169.3 kB/s
|
|
||||||
|
|
||||||
View at:
|
|
||||||
https://pypi.org/project/cdist/7.0.0/
|
|
||||||
* TODO cdist web
|
|
||||||
- on staticweb-2022
|
|
||||||
- Should be moved to sftp/k8s
|
|
||||||
|
|
||||||
|
|
||||||
Manual steps:
|
|
||||||
|
|
||||||
~/bin/permissions.public html/
|
|
||||||
rsync -a html/ staticweb.ungleich.ch:/home/services/www/nico/www.cdi.st/www/manual/7.0.0/
|
|
||||||
ssh staticweb.ungleich.ch "cd /home/services/www/nico/www.cdi.st/www/manual; ln -sf 7.0.0 latest"
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue