| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | #!/bin/sh | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # 2011 Nico Schottelius (nico-cdist at schottelius.org) | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | # | 
					
						
							|  |  |  | # 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/>. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # Create a new type from scratch | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | . cdist-config | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | [ $# -eq 1 ] || __cdist_usage "<type>" | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | set -eu | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | __cdist_type="$1"; shift | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # Base | 
					
						
							|  |  |  | mkdir -p "$(__cdist_type_dir "$__cdist_type")" | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # Parameter | 
					
						
							|  |  |  | mkdir -p "$(__cdist_type_parameter_dir "$__cdist_type")" | 
					
						
							|  |  |  | touch "$(__cdist_type_parameter_dir "$__cdist_type")/${__cdist_name_parameter_required}" | 
					
						
							|  |  |  | touch "$(__cdist_type_parameter_dir "$__cdist_type")/${__cdist_name_parameter_optional}" | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # Manifest | 
					
						
							| 
									
										
										
										
											2011-03-15 17:19:20 +01:00
										 |  |  | cat "$__cdist_abs_mydir/../doc/dev/header" - << eof > "$(__cdist_type_dir "$__cdist_type")/${__cdist_name_manifest}" | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # | 
					
						
							|  |  |  | # This is the manifest, which can be used to create other objects like this: | 
					
						
							|  |  |  | # __file /path/to/destination --source /from/where/ --type file | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # To tell cdist to make use of it, you need to make it executable (chmod +x) | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | eof | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Gencode | 
					
						
							| 
									
										
										
										
											2011-03-15 17:19:20 +01:00
										 |  |  | cat "$__cdist_abs_mydir/../doc/dev/header" - << eof > "$(__cdist_type_dir "$__cdist_type")/${__cdist_name_gencode}" | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # This file should generate code on stdout, which will be collected by cdist | 
					
						
							|  |  |  | # and run on the target. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # To tell cdist to make use of it, you need to make it executable (chmod +x) | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | eof | 
					
						
							| 
									
										
										
										
											2011-03-07 23:50:28 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-08 00:13:04 +01:00
										 |  |  | # Explorer | 
					
						
							| 
									
										
										
										
											2011-03-15 17:19:20 +01:00
										 |  |  | mkdir -p "$(__cdist_type_dir "$__cdist_type")/${__cdist_name_explorer}" |