forked from ungleich-public/cdist
		
	new type __debian_backports
This new type will setup the backports distribution for the current Debian release.
This commit is contained in:
		
					parent
					
						
							
								a58f5ffa7f
							
						
					
				
			
			
				commit
				
					
						a5169ad858
					
				
			
		
					 6 changed files with 153 additions and 0 deletions
				
			
		
							
								
								
									
										90
									
								
								cdist/conf/type/__debian_backports/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								cdist/conf/type/__debian_backports/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,90 @@
 | 
				
			||||||
 | 
					cdist-type__debian_backports(7)
 | 
				
			||||||
 | 
					===============================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__debian_backports - Install backports for Debain systems
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					This singleton type installs backports for the current Debian version.
 | 
				
			||||||
 | 
					It aborts if backports are not supported for the specified os or no
 | 
				
			||||||
 | 
					version codename could be fetched (like Debian unstable).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					    Represents the state of the backports repository. ``present`` or
 | 
				
			||||||
 | 
					    ``absent``, defaults to ``present``.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Will be directly passed to :strong:`cdist-type__apt_source`\ (7).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					mirror
 | 
				
			||||||
 | 
					    The mirror to fetch the backports from. Will defaults to the Debian default
 | 
				
			||||||
 | 
					    `<http://deb.debian.org/debian/>`_.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Will be directly passed to :strong:`cdist-type__apt_source`\ (7).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOLEAN PARAMETERS
 | 
				
			||||||
 | 
					------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MESSAGES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   # setup the backports
 | 
				
			||||||
 | 
					   __debian_backports
 | 
				
			||||||
 | 
					   __debian_backports --state absent
 | 
				
			||||||
 | 
					   __debian_backports --state present --mirror "http://ftp.de.debian.org/debian/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   # update
 | 
				
			||||||
 | 
					   require="__debian_backports" __apt_update_index
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   # install a backports package
 | 
				
			||||||
 | 
					   # currently for the buster release backports
 | 
				
			||||||
 | 
					   require="__apt_update_index" __package_apt wireguard \
 | 
				
			||||||
 | 
					        --target-release buster-backports
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ABORTS
 | 
				
			||||||
 | 
					------
 | 
				
			||||||
 | 
					Aborts if the detected os is not Debian.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Aborts if no distribuition codename could be detected. This is common for the
 | 
				
			||||||
 | 
					unstable distribution, but there is no backports repository for it already.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SEE ALSO
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					`Official Debian Backports site <https://backports.debian.org/>`_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					:strong:`cdist-type__apt_source`\ (7)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Matthias Stecher <matthiasstecher at gmx.de>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Copyright \(C) 2020 Matthias Stecher. 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.
 | 
				
			||||||
							
								
								
									
										59
									
								
								cdist/conf/type/__debian_backports/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										59
									
								
								cdist/conf/type/__debian_backports/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,59 @@
 | 
				
			||||||
 | 
					#!/bin/sh -e
 | 
				
			||||||
 | 
					# __debian_backports/manifest
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 2020 Matthias Stecher (matthiasstecher at gmx.de)
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 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/>.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Enables/disables backports repository. Utilies __apt_source for it.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# detect backport distribution
 | 
				
			||||||
 | 
					os="$(cat "$__global/explorer/os")"
 | 
				
			||||||
 | 
					case "$os" in
 | 
				
			||||||
 | 
					    debian)
 | 
				
			||||||
 | 
					        # distribution codename from /etc/os-release
 | 
				
			||||||
 | 
					        # lsb_release may not be given in all debian installations
 | 
				
			||||||
 | 
					        dist="$(
 | 
				
			||||||
 | 
					            . "$__global/explorer/os-release"
 | 
				
			||||||
 | 
					            printf "%s" "$VERSION_CODENAME"
 | 
				
			||||||
 | 
					        )"
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    *)
 | 
				
			||||||
 | 
					        printf "Backports for %s are not supported!\n" "$os" >&2
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# error if no codename given (e.g. on Debian unstable)
 | 
				
			||||||
 | 
					if [ -z "$dist" ]; then
 | 
				
			||||||
 | 
					    printf "No backports for unkown version of distribution %s!\n" "$os" >&2
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# parameters
 | 
				
			||||||
 | 
					state="$(cat "$__object/parameter/state")"
 | 
				
			||||||
 | 
					mirror="$(cat "$__object/parameter/mirror")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# install the given backports repository
 | 
				
			||||||
 | 
					__apt_source "${dist}-backports" \
 | 
				
			||||||
 | 
					    --state "$state" \
 | 
				
			||||||
 | 
					    --distribution "${dist}-backports" \
 | 
				
			||||||
 | 
					    --component main \
 | 
				
			||||||
 | 
					    --uri "$mirror"
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					http://deb.debian.org/debian/
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					present
 | 
				
			||||||
							
								
								
									
										2
									
								
								cdist/conf/type/__debian_backports/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__debian_backports/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,2 @@
 | 
				
			||||||
 | 
					state
 | 
				
			||||||
 | 
					mirror
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__debian_backports/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__debian_backports/singleton
									
										
									
									
									
										Normal file
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue