Add __apt_default_release type (#643)
This commit is contained in:
		
					parent
					
						
							
								d621dc0afb
							
						
					
				
			
			
				commit
				
					
						b8ed816af4
					
				
			
		
					 4 changed files with 88 additions and 0 deletions
				
			
		
							
								
								
									
										46
									
								
								cdist/conf/type/__apt_default_release/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								cdist/conf/type/__apt_default_release/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,46 @@
 | 
				
			||||||
 | 
					cdist-type__apt_default_release(7)
 | 
				
			||||||
 | 
					==================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME
 | 
				
			||||||
 | 
					----
 | 
				
			||||||
 | 
					cdist-type__apt_default_release - Configure the default release for apt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					DESCRIPTION
 | 
				
			||||||
 | 
					-----------
 | 
				
			||||||
 | 
					Configure the default release for apt, using the APT::Default-Release
 | 
				
			||||||
 | 
					configuration value.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					REQUIRED PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					release
 | 
				
			||||||
 | 
					   The value to set APT::Default-Release to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   This can contain release name, codename or release version. Examples:
 | 
				
			||||||
 | 
					   'stable', 'testing', 'unstable', 'stretch', 'buster', '4.0', '5.0*'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OPTIONAL PARAMETERS
 | 
				
			||||||
 | 
					-------------------
 | 
				
			||||||
 | 
					None.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXAMPLES
 | 
				
			||||||
 | 
					--------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. code-block:: sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    __apt_default_release --release stretch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					AUTHORS
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Matthijs Kooijman <matthijs--@--stdin.nl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPYING
 | 
				
			||||||
 | 
					-------
 | 
				
			||||||
 | 
					Copyright \(C) 2017 Matthijs Kooijman. 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.
 | 
				
			||||||
							
								
								
									
										41
									
								
								cdist/conf/type/__apt_default_release/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										41
									
								
								cdist/conf/type/__apt_default_release/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
					@ -0,0 +1,41 @@
 | 
				
			||||||
 | 
					#!/bin/sh -e
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
				
			||||||
 | 
					# 2017 Matthijs Kooijman (matthijs at stdin.nl)
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 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/>.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
 | 
					release="$(cat "$__object/parameter/release")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					case "$os" in
 | 
				
			||||||
 | 
					   ubuntu|debian|devuan)
 | 
				
			||||||
 | 
					      __file /etc/apt/apt.conf.d/99-default-release \
 | 
				
			||||||
 | 
					         --owner root --group root --mode 644 \
 | 
				
			||||||
 | 
					         --source - << DONE
 | 
				
			||||||
 | 
					APT::Default-Release "$release";
 | 
				
			||||||
 | 
					DONE
 | 
				
			||||||
 | 
					   ;;
 | 
				
			||||||
 | 
					   *)
 | 
				
			||||||
 | 
					      cat >&2 << DONE
 | 
				
			||||||
 | 
					The developer of this type (${__type##*/}) did not think your operating system
 | 
				
			||||||
 | 
					($os) would have any use for it. If you think otherwise please submit a patch.
 | 
				
			||||||
 | 
					DONE
 | 
				
			||||||
 | 
					      exit 1
 | 
				
			||||||
 | 
					   ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
							
								
								
									
										1
									
								
								cdist/conf/type/__apt_default_release/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__apt_default_release/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					release
 | 
				
			||||||
							
								
								
									
										0
									
								
								cdist/conf/type/__apt_default_release/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__apt_default_release/singleton
									
										
									
									
									
										Normal file
									
								
							
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue