Merge remote branch 'nico/master'
This commit is contained in:
		
				commit
				
					
						a6b88d323e
					
				
			
		
					 26 changed files with 1851 additions and 253 deletions
				
			
		| 
						 | 
				
			
			@ -2,13 +2,16 @@ cat << eof
 | 
			
		|||
 | 
			
		||||
Hey hackers,
 | 
			
		||||
 | 
			
		||||
cdist has not been published, you're accessing a early in developent
 | 
			
		||||
code.
 | 
			
		||||
this README is for you, for those who want to dig into cdist, hack it or try
 | 
			
		||||
to get a deeper understanding.
 | 
			
		||||
 | 
			
		||||
Do not believe anything written in cdist, besides what's written in this file
 | 
			
		||||
(everything else may be future stuff for the initial release).
 | 
			
		||||
A lot of documentation is still missing, but running cdist-quickstart should
 | 
			
		||||
give you an impression of how cdist works.
 | 
			
		||||
 | 
			
		||||
   -- Nico, 20101201
 | 
			
		||||
I hope you have a lot of fun with cdist, because it was also a lot of fun to
 | 
			
		||||
develop it!
 | 
			
		||||
 | 
			
		||||
   -- Nico, 20110304
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Conventions
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +24,7 @@ Do not believe anything written in cdist, besides what's written in this file
 | 
			
		|||
This file is suitable for execution and saving the objects and
 | 
			
		||||
explorers from cdist. I usually do it like this:
 | 
			
		||||
 | 
			
		||||
   % rm -rf /tmp/localhost && ./HACKERS_README
 | 
			
		||||
   % ./HACKERS_README
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
eof
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										48
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										48
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -8,47 +8,45 @@ A2X=a2x -f manpage --no-xmllint
 | 
			
		|||
WEBDIR=$$HOME/niconetz
 | 
			
		||||
WEBPAGE=software/cdist.mdwn
 | 
			
		||||
 | 
			
		||||
MANSRC=doc/man/cdist-config-layout.text \
 | 
			
		||||
	doc/man/cdist-config.text 		\
 | 
			
		||||
	doc/man/cdist-explorer.text	\
 | 
			
		||||
	doc/man/cdist-quickstart.text \
 | 
			
		||||
	doc/man/cdist-stages.text		\
 | 
			
		||||
	doc/man/cdist-terms.text 		\
 | 
			
		||||
	doc/man/cdist-type.text
 | 
			
		||||
MANDIR=doc/man
 | 
			
		||||
MANSRC=$(MANDIR)/cdist-config-layout.text \
 | 
			
		||||
	$(MANDIR)/cdist-config.text 		\
 | 
			
		||||
	$(MANDIR)/cdist-explorer.text	\
 | 
			
		||||
	$(MANDIR)/cdist-quickstart.text \
 | 
			
		||||
	$(MANDIR)/cdist-stages.text		\
 | 
			
		||||
	$(MANDIR)/cdist-terms.text 		\
 | 
			
		||||
	$(MANDIR)/cdist-type.text
 | 
			
		||||
 | 
			
		||||
MANSRC=doc/man/cdist.text			\
 | 
			
		||||
   doc/man/cdist-deploy-to.text 	\
 | 
			
		||||
	doc/man/cdist-manifest.text 	\
 | 
			
		||||
MANSRC=$(MANDIR)/cdist.text			\
 | 
			
		||||
   $(MANDIR)/cdist-deploy-to.text 	\
 | 
			
		||||
	$(MANDIR)/cdist-manifest.text 	\
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# User targets
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
all: man
 | 
			
		||||
all:
 | 
			
		||||
	@echo ''
 | 
			
		||||
	@echo 'Welcome to cdist!'
 | 
			
		||||
	@echo ''
 | 
			
		||||
	@echo 'Here are the possible targets:'
 | 
			
		||||
	@echo ''
 | 
			
		||||
	@echo '	man: Build manpages'
 | 
			
		||||
	@echo '	clean: Remove build stuff'
 | 
			
		||||
	@echo ''
 | 
			
		||||
	@echo ''
 | 
			
		||||
 | 
			
		||||
man: doc/man/.marker
 | 
			
		||||
 | 
			
		||||
doc/man/.marker: $(MANSRC)
 | 
			
		||||
	for man in $(MANSRC); do $(A2X) $$man; done
 | 
			
		||||
	for mansrc in $(MANSRC); do $(A2X) $$mansrc; done
 | 
			
		||||
	for manpage in $(MANDIR)/*.[1-9]; do cat=$${manpage##*.}; echo $$cat; mandir=$(MANDIR)/man$$cat; mkdir -p $$mandir; mv $$manpage $$mandir; done
 | 
			
		||||
	touch $@
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f doc/man/*.html doc/man/*.[1-9]
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Install targets
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# FIXME: some distro nerd, can you make this more beautiful?
 | 
			
		||||
# Like integrating install, ...
 | 
			
		||||
# I'm just a hacker, I don't really care...
 | 
			
		||||
install: install-man
 | 
			
		||||
	cp bin/* $(BINDIR)
 | 
			
		||||
 | 
			
		||||
install-man:
 | 
			
		||||
	for p in doc/man/*.[1-9]; do n=$${p##*.}; cp $$p $(MANDIR)/man$$n/; done
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Developer targets
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								README
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
HACKERS_README
 | 
			
		||||
REAL_README
 | 
			
		||||
							
								
								
									
										82
									
								
								REAL_README
									
										
									
									
									
								
							
							
						
						
									
										82
									
								
								REAL_README
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,5 +1,7 @@
 | 
			
		|||
[[!meta title="cdist - configuration management"]]
 | 
			
		||||
 | 
			
		||||
[[!toc  levels=2]]
 | 
			
		||||
 | 
			
		||||
## Introduction
 | 
			
		||||
 | 
			
		||||
cdist configures your system and is similar to
 | 
			
		||||
| 
						 | 
				
			
			@ -11,23 +13,23 @@ and [puppet](http://www.puppetlabs.com/), but
 | 
			
		|||
it ticks differently:
 | 
			
		||||
 | 
			
		||||
 * cdist sticks completly to the KISS (keep it simple and stupid) paradigma
 | 
			
		||||
  * cdist's core is very small (currently around 400 lines of code)
 | 
			
		||||
  * cdist's core is very small (< 1k lines of code)
 | 
			
		||||
  * There is only one type to extend cdist called ***type***.
 | 
			
		||||
  * One main development target: ***It must be incredible easy to add new types.***
 | 
			
		||||
 * cdist is UNIX
 | 
			
		||||
  * It reuses existing tools like cat, find, mv, ...
 | 
			
		||||
  * cdist's documentation is bundled as manpages
 | 
			
		||||
 * cdist is written in POSIX shell
 | 
			
		||||
  * No special requirements like high level interpreters needed on server or target
 | 
			
		||||
 | 
			
		||||
MAIN AIM:  It MUST be incredible easy/dumb to add new types.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### Architecture
 | 
			
		||||
 | 
			
		||||
 * Push mode (server pushes configuration)
 | 
			
		||||
 * Pull mode (client triggers configuration)
 | 
			
		||||
 * Pull mode planned (client triggers configuration)
 | 
			
		||||
 * User defines configuration in shell scripts (called ***manifests***)
 | 
			
		||||
 * Cdist generates internal configuration (cconfig style) and afterwards applies configuration
 | 
			
		||||
 * Generates internal configuration (cconfig style)
 | 
			
		||||
 * Uses ***types*** to generate code be executed on the target
 | 
			
		||||
 * And finally executes the code on the target / applies the configuration
 | 
			
		||||
 | 
			
		||||
### Features
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -51,39 +53,69 @@ but is not. Or: The reason why I began to write cdist.
 | 
			
		|||
  * sh
 | 
			
		||||
  * find, rm, ...
 | 
			
		||||
 | 
			
		||||
### Roadmap
 | 
			
		||||
 | 
			
		||||
[[!table  data="""
 | 
			
		||||
**Version** | **Objectives** | **Status**
 | 
			
		||||
1.0.0 | Initial release |
 | 
			
		||||
1.0.1 | Documentation cleanup |
 | 
			
		||||
"""]]
 | 
			
		||||
 | 
			
		||||
## Requirements
 | 
			
		||||
 | 
			
		||||
### Server
 | 
			
		||||
 | 
			
		||||
 * A posix like shell
 | 
			
		||||
 * SSH-Client (for push architecture)
 | 
			
		||||
 * SSH-Server (for pull architecture)
 | 
			
		||||
 * SSH-Client
 | 
			
		||||
 | 
			
		||||
### Client
 | 
			
		||||
### Client ("target host")
 | 
			
		||||
 | 
			
		||||
 * A posix like shell
 | 
			
		||||
 * SSH-Client (for pull architecture)
 | 
			
		||||
 * SSH-Server (for push architecture)
 | 
			
		||||
 * SSH-Server
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
Cdist stable always in master
 | 
			
		||||
## Getting cdist
 | 
			
		||||
 | 
			
		||||
 * Create a new unpriviliged user (probably "cdist")
 | 
			
		||||
 * Become that user, execute the following code:
 | 
			
		||||
You can clone cdist from git, which gives you the advantage of having
 | 
			
		||||
a version control in place for development of your own stuff as well.
 | 
			
		||||
 | 
			
		||||
git clone git://git.schottelius.org/cdist
 | 
			
		||||
cd cdist
 | 
			
		||||
export PATH=$PATH:$(pwd -P)/bin
 | 
			
		||||
### Installation
 | 
			
		||||
 | 
			
		||||
That's it.
 | 
			
		||||
To install cdist, execute the following commands:
 | 
			
		||||
 | 
			
		||||
Operation on the server is run as "cdist" user.
 | 
			
		||||
Operation on the client is run as "root" user.
 | 
			
		||||
    git clone git://git.schottelius.org/cdist
 | 
			
		||||
    cd cdist
 | 
			
		||||
    export PATH=$PATH:$(pwd -P)/bin
 | 
			
		||||
 | 
			
		||||
## Update
 | 
			
		||||
 | 
			
		||||
git pull && make install
 | 
			
		||||
Afterwards you can run ***cdist-quickstart*** to get an impression on
 | 
			
		||||
how to use cdist.
 | 
			
		||||
 | 
			
		||||
### Available versions
 | 
			
		||||
 | 
			
		||||
There are at least two branches available:
 | 
			
		||||
 | 
			
		||||
 * master: the development branch
 | 
			
		||||
 * 1.0: stable branch of version 1.0
 | 
			
		||||
 | 
			
		||||
Other branches may be available as well for features or bugfixes, but they
 | 
			
		||||
may vanish at any point. To select a specific branch use
 | 
			
		||||
 | 
			
		||||
    # Generic code
 | 
			
		||||
    git checkout -b <name> origin/<name>
 | 
			
		||||
    
 | 
			
		||||
    # Stay on version 1.0
 | 
			
		||||
    git checkout -b 1.0 origin/1.0
 | 
			
		||||
 | 
			
		||||
### Update
 | 
			
		||||
 | 
			
		||||
To upgrade cdist in the current branch use
 | 
			
		||||
 | 
			
		||||
    git pull
 | 
			
		||||
 | 
			
		||||
The version branches are designed to change if there are incompatibilities.
 | 
			
		||||
Or the other way round: As long as you stay on 1.0 and do git pull, nothing
 | 
			
		||||
should break.
 | 
			
		||||
 | 
			
		||||
## Support
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,7 +128,3 @@ You can join the development ***IRC channel***
 | 
			
		|||
 | 
			
		||||
Bug reports, questions, patches, etc. should be send to the
 | 
			
		||||
[cdist mailing list](http://l.schottelius.org/mailman/listinfo/cdist).
 | 
			
		||||
 | 
			
		||||
## Commercial Support
 | 
			
		||||
 | 
			
		||||
To be done.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										73
									
								
								TODO-1.0
									
										
									
									
									
								
							
							
						
						
									
										73
									
								
								TODO-1.0
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,73 +0,0 @@
 | 
			
		|||
Steps needed until 1.0:
 | 
			
		||||
 | 
			
		||||
   x finish type __file
 | 
			
		||||
   - finish type __package
 | 
			
		||||
   - cleanup documentation (see below)
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
This document defines how to continue work on cdist:
 | 
			
		||||
 | 
			
		||||
x general stuff
 | 
			
		||||
   x Define configuration paths (doc/internal/config-layout)
 | 
			
		||||
   x check whether remote and local view of objects can be the same,
 | 
			
		||||
    i.e. local:/outdir == remote:/var/lib/cdist
 | 
			
		||||
    x similar, but not the same
 | 
			
		||||
 | 
			
		||||
x get information from target (stage 1)
 | 
			
		||||
   x Define how to get information from targets
 | 
			
		||||
      x Create shell script that creates code to run on client (cdist-build-explorer)
 | 
			
		||||
   x Redo explorers (see manpage)
 | 
			
		||||
x run initial manifest (stage 2)
 | 
			
		||||
   x Create configuration tree from manifest
 | 
			
		||||
      x write binaries, which create the tree when called from manifest (cdist_tree_wrapper)
 | 
			
		||||
 | 
			
		||||
x be able to run manifest of types (stage 3)
 | 
			
		||||
   x Parse configuration tree/objects recursively
 | 
			
		||||
      x can/may types modify tree?
 | 
			
		||||
         -> yes, of everything a type created itself!
 | 
			
		||||
         x may open door for getting information from manifest / other stuff
 | 
			
		||||
   x Cleanly define paths for object creation, especially recursive calls
 | 
			
		||||
      x doc/man/cdist-config-layout.text
 | 
			
		||||
   x cd $__object_dir, before running manifest
 | 
			
		||||
   x rename $__object_dir to $__object_base_dir
 | 
			
		||||
   x use $type/manifest instead of $type/init
 | 
			
		||||
   x find $object_id in recursive runner (before merge)
 | 
			
		||||
   x move parameters of object to subdir parameter
 | 
			
		||||
   x run explorers for every object
 | 
			
		||||
 | 
			
		||||
x generate code to be executed on clients (stage 4)
 | 
			
		||||
   x for one object
 | 
			
		||||
   x for all objects
 | 
			
		||||
 | 
			
		||||
x execute code on client (stage 5)
 | 
			
		||||
 | 
			
		||||
- Last doc stuff for 1.0.0:
 | 
			
		||||
   x remove old documentation from doc/man/!
 | 
			
		||||
   - Check all references in manpages, ensure all manpages exist
 | 
			
		||||
      - cdist
 | 
			
		||||
      - cdist-deploy-to
 | 
			
		||||
      - cdist-manifest
 | 
			
		||||
      - cdist-quickstart: how to get started
 | 
			
		||||
   - ensure every file in bin/ has a correspondent manpage
 | 
			
		||||
   - cdist-type           [IMPORTANT]
 | 
			
		||||
      - only do necessary work [TYPE IMPLEMENTATION HINTS]
 | 
			
		||||
         - install packages only if not existent
 | 
			
		||||
         - copy file only if different
 | 
			
		||||
   - cdist-type-integration
 | 
			
		||||
   - cdist                 [IMPORTANT]
 | 
			
		||||
      - explain the general approach
 | 
			
		||||
      - give right pointers
 | 
			
		||||
   - cdist-explorer
 | 
			
		||||
 | 
			
		||||
   - DOC document "cd $__object_dir, before running manifest" in doc/man/cdist-types.text
 | 
			
		||||
   - DOC document that $type/manifest is executed for every object/instance
 | 
			
		||||
   - DOC: exported variables: __type, __explorer, __type_explorer, __object, __object_id
 | 
			
		||||
 | 
			
		||||
   - Cleanup READMEs
 | 
			
		||||
   - Ensure manpages are formatted correctly
 | 
			
		||||
   - Ensure html output of manpages are published on the web
 | 
			
		||||
 | 
			
		||||
- Makefile:
 | 
			
		||||
   - Add install target
 | 
			
		||||
   - Include manpage generation
 | 
			
		||||
| 
						 | 
				
			
			@ -41,4 +41,11 @@ ssh "${__cdist_remote_user}@${__cdist_target_host}" \
 | 
			
		|||
 | 
			
		||||
# Transfer cdist-* to the remote host
 | 
			
		||||
scp -qr "${__cdist_src_base}"* \
 | 
			
		||||
       "root@${__cdist_target_host}:${__cdist_my_remote_out_dir}"
 | 
			
		||||
       "${__cdist_remote_user}@${__cdist_target_host}:${__cdist_my_remote_out_dir}"
 | 
			
		||||
 | 
			
		||||
# Adjust cdist-config to contain static version string
 | 
			
		||||
tmp_version="$__cdist_version"
 | 
			
		||||
sed "s/^: \${\(__cdist_version\):=.*/\1=\"$tmp_version\"/" "$(which cdist-config)" | \
 | 
			
		||||
   ssh -q "${__cdist_remote_user}@${__cdist_target_host}"                     \
 | 
			
		||||
      "cat > \"${__cdist_my_remote_out_dir}\"/cdist-config"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,17 +22,30 @@
 | 
			
		|||
# Fail if something bogus is going on and export all variables
 | 
			
		||||
set -u
 | 
			
		||||
 | 
			
		||||
__cdist_version="1.0.0"
 | 
			
		||||
################################################################################
 | 
			
		||||
# cconf standard vars prefixed with cdist
 | 
			
		||||
 | 
			
		||||
__cdist_pwd="$(pwd -P)"
 | 
			
		||||
__cdist_mydir="${0%/*}";
 | 
			
		||||
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
 | 
			
		||||
__cdist_myname=${0##*/};
 | 
			
		||||
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
 | 
			
		||||
 | 
			
		||||
: ${__cdist_version:="$(cd "$__cdist_abs_mydir/.." && git describe)"}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Names / Constants
 | 
			
		||||
#
 | 
			
		||||
# Most values can be overriden from outside, so you can
 | 
			
		||||
# customise paths as you like (for distributors, geeks and hackers)
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# Names / Constants
 | 
			
		||||
: ${__cdist_name_bin:=bin}
 | 
			
		||||
: ${__cdist_name_code:=code}
 | 
			
		||||
: ${__cdist_name_conf_dir:=conf}
 | 
			
		||||
: ${__cdist_name_explorer:=explorer}
 | 
			
		||||
: ${__cdist_name_gencode:=gencode}
 | 
			
		||||
: ${__cdist_name_global:=global}
 | 
			
		||||
: ${__cdist_name_host:=host}
 | 
			
		||||
: ${__cdist_name_init:=init}
 | 
			
		||||
: ${__cdist_name_manifest:=manifest}
 | 
			
		||||
| 
						 | 
				
			
			@ -49,10 +62,19 @@ __cdist_version="1.0.0"
 | 
			
		|||
: ${__cdist_name_type_bin:=type_bin}
 | 
			
		||||
: ${__cdist_name_type_explorer:=type_explorer}
 | 
			
		||||
 | 
			
		||||
# Used for IDs
 | 
			
		||||
: ${__cdist_sane_regexp:=[A-Za-z0-9/]*[-A-Za-z0-9_/]*}
 | 
			
		||||
 | 
			
		||||
# Exported variable names (usable for non core)
 | 
			
		||||
# Default remote user
 | 
			
		||||
: ${__cdist_remote_user:=root}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Exported variable names (usable for non core
 | 
			
		||||
#
 | 
			
		||||
: ${__cdist_name_var_explorer:=__$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_name_var_type_explorer:=__$__cdist_name_type_explorer}
 | 
			
		||||
: ${__cdist_name_var_global:=__$__cdist_name_global}
 | 
			
		||||
: ${__cdist_name_var_manifest:=__$__cdist_name_manifest}
 | 
			
		||||
: ${__cdist_name_var_target_host:=__$__cdist_name_target_host}
 | 
			
		||||
: ${__cdist_name_var_object:=__$__cdist_name_object}
 | 
			
		||||
| 
						 | 
				
			
			@ -60,52 +82,48 @@ __cdist_version="1.0.0"
 | 
			
		|||
: ${__cdist_name_var_type:=__$__cdist_name_type}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Base
 | 
			
		||||
: ${__cdist_conf_dir:=/etc/cdist}
 | 
			
		||||
################################################################################
 | 
			
		||||
# Tempfiles
 | 
			
		||||
# 
 | 
			
		||||
__cdist_tmp_dir=$(mktemp -d "/tmp/cdist.XXXXXXXXXXXX")
 | 
			
		||||
__cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Local Base
 | 
			
		||||
# 
 | 
			
		||||
: ${__cdist_local_base_dir:=$__cdist_tmp_dir}
 | 
			
		||||
 | 
			
		||||
: ${__cdist_conf_dir:="$(cd "$__cdist_abs_mydir/../conf" && pwd -P)"}
 | 
			
		||||
 | 
			
		||||
: ${__cdist_explorer_dir:=$__cdist_conf_dir/$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_manifest_dir:=$__cdist_conf_dir/$__cdist_name_manifest}
 | 
			
		||||
: ${__cdist_manifest_init:=$__cdist_manifest_dir/$__cdist_name_init}
 | 
			
		||||
: ${__cdist_type_dir:=$__cdist_conf_dir/$__cdist_name_type}
 | 
			
		||||
 | 
			
		||||
# Used for IDs
 | 
			
		||||
__cdist_sane_regexp='[A-Za-z0-9/]*[-A-Za-z0-9_/]*'
 | 
			
		||||
 | 
			
		||||
# Default remote user
 | 
			
		||||
: ${__cdist_remote_user:=root}
 | 
			
		||||
 | 
			
		||||
# Remote base
 | 
			
		||||
: ${__cdist_remote_base_dir:=/var/lib/cdist}
 | 
			
		||||
 | 
			
		||||
# Remote config
 | 
			
		||||
: ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir}
 | 
			
		||||
: ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_remote_bin_dir:=$__cdist_remote_conf_dir/$__cdist_name_bin}
 | 
			
		||||
: ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type}
 | 
			
		||||
 | 
			
		||||
# Remote out
 | 
			
		||||
: ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir}
 | 
			
		||||
: ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_remote_out_object_base_dir:=$__cdist_remote_out_dir/$__cdist_name_object}
 | 
			
		||||
 | 
			
		||||
# Tempfiles
 | 
			
		||||
__cdist_tmp_dir=$(mktemp -d "/tmp/cdist.XXXXXXXXXXXX")
 | 
			
		||||
__cdist_tmp_file=$(mktemp "$__cdist_tmp_dir/cdist.XXXXXXXXXXXX")
 | 
			
		||||
 | 
			
		||||
# Local output base directory
 | 
			
		||||
: ${__cdist_local_base_dir:=$__cdist_tmp_dir}
 | 
			
		||||
################################################################################
 | 
			
		||||
# Local output
 | 
			
		||||
# 
 | 
			
		||||
: ${__cdist_out_dir:=$__cdist_local_base_dir/$__cdist_name_out_dir}
 | 
			
		||||
: ${__cdist_out_explorer_dir:=$__cdist_out_dir/$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_out_object_dir:=$__cdist_out_dir/$__cdist_name_object}
 | 
			
		||||
: ${__cdist_out_type_bin_dir:=$__cdist_out_dir/$__cdist_name_type_bin}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Remote base
 | 
			
		||||
# 
 | 
			
		||||
: ${__cdist_remote_base_dir:=/var/lib/cdist}
 | 
			
		||||
: ${__cdist_remote_bin_dir:=$__cdist_remote_base_dir/$__cdist_name_bin}
 | 
			
		||||
: ${__cdist_remote_conf_dir:=$__cdist_remote_base_dir/$__cdist_name_conf_dir}
 | 
			
		||||
 | 
			
		||||
: ${__cdist_remote_explorer_dir:=$__cdist_remote_conf_dir/$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_remote_type_dir:=$__cdist_remote_conf_dir/$__cdist_name_type}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# cconf standard vars prefixed with cdist
 | 
			
		||||
__cdist_pwd="$(pwd -P)"
 | 
			
		||||
__cdist_mydir="${0%/*}";
 | 
			
		||||
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
 | 
			
		||||
__cdist_myname=${0##*/};
 | 
			
		||||
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
 | 
			
		||||
# Remote output
 | 
			
		||||
#
 | 
			
		||||
: ${__cdist_remote_out_dir:=$__cdist_remote_base_dir/$__cdist_name_out_dir}
 | 
			
		||||
: ${__cdist_remote_out_explorer_dir:=$__cdist_remote_out_dir/$__cdist_name_explorer}
 | 
			
		||||
: ${__cdist_remote_out_object_base_dir:=$__cdist_remote_out_dir/$__cdist_name_object}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Function list
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,10 @@ __cdist_output_dir="$1"; shift
 | 
			
		|||
__cdist_work_dir="$__cdist_local_base_dir"
 | 
			
		||||
 | 
			
		||||
# Export information for cdist-type-emulator
 | 
			
		||||
export __cdist_output_dir __cdist_manifest
 | 
			
		||||
export __cdist_conf_dir __cdist_output_dir __cdist_manifest __cdist_version
 | 
			
		||||
 | 
			
		||||
# Export information for manifests
 | 
			
		||||
export __global="$__cdist_out_dir"
 | 
			
		||||
 | 
			
		||||
# Ensure binaries exist and are up-to-date
 | 
			
		||||
cdist-type-build-emulation "${__cdist_out_type_bin_dir}" \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,7 @@ gencode="$(__cdist_type_gencode "$__cdist_type")"
 | 
			
		|||
# export variables for gencode
 | 
			
		||||
export __object_id="$__cdist_object_id"
 | 
			
		||||
export __object="$__cdist_object_dir"
 | 
			
		||||
export __global="$__cdist_out_dir"
 | 
			
		||||
 | 
			
		||||
cd "$__cdist_local_base_dir"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,100 +35,231 @@ __prompt()
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Intro
 | 
			
		||||
# Intro of quickstart
 | 
			
		||||
#
 | 
			
		||||
cat << eof
 | 
			
		||||
$banner cdist version $__cdist_version
 | 
			
		||||
 | 
			
		||||
Welcome to the interactive guide to cdist!
 | 
			
		||||
This is the interactive tutorial and beginners help for cdist.
 | 
			
		||||
This is the interactive tutorial and beginners help for cdist and here's
 | 
			
		||||
our schedule:
 | 
			
		||||
 | 
			
		||||
If you would like to run this tutorial completly without root priveliges,
 | 
			
		||||
setup the variables __cdist_conf_dir to point to a writable locaction
 | 
			
		||||
(i.e. $HOME/cdist-config).
 | 
			
		||||
   - Stages:   How cdist operates
 | 
			
		||||
   - Explorer: Explore facts of the target host
 | 
			
		||||
   - Manifest: Map configurations to hosts
 | 
			
		||||
   - Types:    Bundled functionality
 | 
			
		||||
   - Deploy a configuration to the local host!
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# /etc/cdist via root
 | 
			
		||||
# Stages
 | 
			
		||||
#
 | 
			
		||||
cat << eof
 | 
			
		||||
To make any use of cdist, we need to create the configuration base, which
 | 
			
		||||
can normally be found below ${__cdist_conf_dir}. As cdist does not need
 | 
			
		||||
any root priveliges normally, it is recommended that you create this
 | 
			
		||||
directory as root and change the owner to a dedicated user (for instance
 | 
			
		||||
cdist).
 | 
			
		||||
 | 
			
		||||
MANUAL STEP:
 | 
			
		||||
To deploy configurations to a host, you call
 | 
			
		||||
 | 
			
		||||
   - Become root: su -
 | 
			
		||||
   - Create ${__cdist_conf_dir}: mkdir ${__cdist_conf_dir}
 | 
			
		||||
   - Change owner to $USER: chown $USER ${__cdist_conf_dir}
 | 
			
		||||
   cdist-deploy-to <hostname>
 | 
			
		||||
 | 
			
		||||
which makes calls to other scripts, which realise the so called "stages".
 | 
			
		||||
Usually you'll not notice this, but in case you want to debug or hack cdist,
 | 
			
		||||
you can run each stage on its own. Besides that, you just need to remember
 | 
			
		||||
that the command cdist-deploy-to is the main cdist command.
 | 
			
		||||
 | 
			
		||||
See also:
 | 
			
		||||
 | 
			
		||||
   Source of cdist-deploy-to, cdist-stages(7)
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Basic directories
 | 
			
		||||
# Explorer
 | 
			
		||||
#
 | 
			
		||||
cat << eof
 | 
			
		||||
Now we need to create some basic directories:
 | 
			
		||||
 | 
			
		||||
   - ${__cdist_explorer_dir}: Contains explorer, which explore the target
 | 
			
		||||
   - ${__cdist_manifest_dir}: Contains manifests which define types being used
 | 
			
		||||
   - ${__cdist_type_dir}: Contains types
 | 
			
		||||
The first thing cdist always does is running different explorers on the
 | 
			
		||||
target host. The explorers can be found in the directory
 | 
			
		||||
 | 
			
		||||
   ${__cdist_explorer_dir}
 | 
			
		||||
 | 
			
		||||
An explorer is executed on the target host and its output is saved to a file.
 | 
			
		||||
You can use these files later to decide what or how to configure the host.
 | 
			
		||||
 | 
			
		||||
For a demonstration, we'll call the OS explorer locally now, but remember:
 | 
			
		||||
This is only for demonstration, normally it is run on the target host.
 | 
			
		||||
The os explorer will which either displays the detected operating system or
 | 
			
		||||
nothing if it does not know your OS.
 | 
			
		||||
 | 
			
		||||
See also:
 | 
			
		||||
 | 
			
		||||
   cdist-explorer(7)
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$create_continue"
 | 
			
		||||
explorer="${__cdist_explorer_dir}/os"
 | 
			
		||||
 | 
			
		||||
__prompt "Press enter to execute $explorer"
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
mkdir -p ${__cdist_explorer_dir}
 | 
			
		||||
mkdir -p ${__cdist_manifest_dir}
 | 
			
		||||
mkdir -p ${__cdist_type_dir}
 | 
			
		||||
"$explorer"
 | 
			
		||||
set +x
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# create manifest/init
 | 
			
		||||
# Manifest
 | 
			
		||||
#
 | 
			
		||||
cat << eof
 | 
			
		||||
At the beginning of a configuration deployment the first file cdist reads is
 | 
			
		||||
${__cdist_manifest_init}, which defines the types to be created on
 | 
			
		||||
a specific host.
 | 
			
		||||
 | 
			
		||||
We'll create the initial manifest and add some example types to it.
 | 
			
		||||
The initial manifest is the entry point for cdist to find out, what you would
 | 
			
		||||
like to have configured. It is located at
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$create_continue"
 | 
			
		||||
   ${__cdist_manifest_init}
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
cat << eof > "${__cdist_manifest_init}"
 | 
			
		||||
# Always create a marker
 | 
			
		||||
And can be as simple as
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
__file /etc/cdist-configured --type file
 | 
			
		||||
 | 
			
		||||
case "\$__target_host" in
 | 
			
		||||
   $(hostname)*)
 | 
			
		||||
      __file /tmp/cdist-quickstart --type file
 | 
			
		||||
   ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
set +x
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# show generated manifest/niit
 | 
			
		||||
#
 | 
			
		||||
cat << eof
 | 
			
		||||
Let's have a look how the initial manifest looks like currently:
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
eof
 | 
			
		||||
cat "${__cdist_manifest_init}"
 | 
			
		||||
cat << eof
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
eof
 | 
			
		||||
 | 
			
		||||
See also:
 | 
			
		||||
 | 
			
		||||
   cdist-manifest(7)
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
Let's take a deeper look at the initial manifest to understand what it means:
 | 
			
		||||
 | 
			
		||||
   __file /etc/cdist-configured --type file
 | 
			
		||||
      |     |                    |        \\
 | 
			
		||||
      |     |        The parameter type    \\ With the value file
 | 
			
		||||
      |     |
 | 
			
		||||
      |     |
 | 
			
		||||
      |     | This is the object id
 | 
			
		||||
      |
 | 
			
		||||
   __file is a so called "type"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
This essentially looks like a standard command executed in the shell.
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
And that's exactly true. Manifests are shell snippets that can use
 | 
			
		||||
types as commands with arguments. cdist prepends a special path
 | 
			
		||||
that contain links to the cdist-type-emulator, to \$PATH, so you
 | 
			
		||||
can use your types as a command.
 | 
			
		||||
 | 
			
		||||
This is also the reason why types should always be prefixed with
 | 
			
		||||
"__", to prevent collisions with existing binaries.
 | 
			
		||||
 | 
			
		||||
The object id is unique per type and used to prevent you from creating
 | 
			
		||||
the same object twice.
 | 
			
		||||
 | 
			
		||||
Parameters are type specific and are always specified as --parameter <value>.
 | 
			
		||||
 | 
			
		||||
See also:
 | 
			
		||||
 | 
			
		||||
   cdist-type-build-emulation(1), cdist-type-emulator(1)
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# add type file
 | 
			
		||||
# Types
 | 
			
		||||
#
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
Types are bundled functionality and are the main component of cdist.
 | 
			
		||||
If you want to have a feature x, you write the type __x. Types are stored in
 | 
			
		||||
 | 
			
		||||
   ${__cdist_type_dir}
 | 
			
		||||
 | 
			
		||||
And cdist ships with some types already!
 | 
			
		||||
 | 
			
		||||
See also:
 | 
			
		||||
 | 
			
		||||
   cdist-type(7)
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "Press enter to see available types"
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
ls ${__cdist_type_dir}
 | 
			
		||||
set +x
 | 
			
		||||
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
Types consist of the following parts:
 | 
			
		||||
 | 
			
		||||
   - ${__cdist_name_parameter} (${__cdist_name_parameter_required}/${__cdist_name_parameter_optional}
 | 
			
		||||
   - ${__cdist_name_manifest}
 | 
			
		||||
   - ${__cdist_name_explorer}
 | 
			
		||||
   - ${__cdist_name_gencode}
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
Every type must have a directory named ${__cdist_name_parameter}, which
 | 
			
		||||
contains required or optional parameters (in newline seperated files).
 | 
			
		||||
 | 
			
		||||
If an object of a specific type was created in the initial manifest,
 | 
			
		||||
the manifest of the type is run and may create other objects.
 | 
			
		||||
 | 
			
		||||
A type may have ${__cdist_name_explorer}, which are very similar to the
 | 
			
		||||
${__cdist_name_explorer} seen above, but with a different purpose:
 | 
			
		||||
They are specific to the type and are not relevant for other types.
 | 
			
		||||
 | 
			
		||||
You may use them for instance to find out details on the target host,
 | 
			
		||||
so you can decide what to do on the target host eventually.
 | 
			
		||||
 | 
			
		||||
After the ${__cdist_name_manifest} and the ${__cdist_name_explorer} of
 | 
			
		||||
a type have been run, ${__cdist_name_gencode} is executed, which creates
 | 
			
		||||
code to be executed on the target on stdout.
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
__prompt "$continue"
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Deployment
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
Now you've got some basic knowledge about cdist, let's configure your localhost!
 | 
			
		||||
 | 
			
		||||
Ensure that you have a ssh server running locally and that you can login as root.
 | 
			
		||||
 | 
			
		||||
The cdist distribution contains some sensible default initial manifest, which
 | 
			
		||||
will create 2 files, /etc/cdist-configured (for every host) and
 | 
			
		||||
/tmp/cdist-testfile (only for localhost).
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
 | 
			
		||||
cmd="cdist-deploy-to localhost"
 | 
			
		||||
 | 
			
		||||
__prompt "Press enter to run \"$cmd\""
 | 
			
		||||
 | 
			
		||||
# No quotes, we need field splitting
 | 
			
		||||
$cmd
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# End
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
cat << eof
 | 
			
		||||
 | 
			
		||||
That's it, this is the end of the cdist-introduction.
 | 
			
		||||
 | 
			
		||||
I hope you've got some impression on how cdist works, here are again some
 | 
			
		||||
pointers on where to continue to read:
 | 
			
		||||
 | 
			
		||||
cdist(7), cdist-deploy-to(1), cdist-type(7), cdist-stages(7)
 | 
			
		||||
 | 
			
		||||
eof
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,12 +39,10 @@ __cdist_explorer_dir="$1"; shift
 | 
			
		|||
# Write output here
 | 
			
		||||
__cdist_my_out_dir="$1"; shift
 | 
			
		||||
 | 
			
		||||
# cd to this dir
 | 
			
		||||
__cdist_work_dir="$__cdist_remote_base_dir"
 | 
			
		||||
 | 
			
		||||
# Setup environment
 | 
			
		||||
export $__cdist_variable_name="$__cdist_explorer_dir"
 | 
			
		||||
cd "${__cdist_work_dir}"
 | 
			
		||||
export __global="$__cdist_remote_out_dir"
 | 
			
		||||
 | 
			
		||||
mkdir -p "$__cdist_my_out_dir"
 | 
			
		||||
 | 
			
		||||
# Ensure there is at least one explorer
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,13 +28,56 @@ if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
 | 
			
		|||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
[ -f /etc/arch-release ] && echo archlinux
 | 
			
		||||
if [ -f /etc/arch-release ]; then
 | 
			
		||||
   echo archlinux
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
[ -f /etc/debian_version ] && echo debian
 | 
			
		||||
if [ -f /etc/debian_version ]; then
 | 
			
		||||
   echo debian
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
[ -f /etc/gentoo-release ] && echo gentoo
 | 
			
		||||
if [ -f /etc/gentoo-release ]; then
 | 
			
		||||
   echo gentoo
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
[ -f /etc/redhat-release ] && echo redhat
 | 
			
		||||
if [ -f /etc/redhat-release ]; then
 | 
			
		||||
   echo redhat
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# ensure correct exit, otherwise other explorer won't get started
 | 
			
		||||
exit 0
 | 
			
		||||
if [ -f /etc/SuSE-release ]; then
 | 
			
		||||
   echo suse
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
uname_s="$(uname -s)"
 | 
			
		||||
 | 
			
		||||
# Assume there is no tr on the client -> do lower case ourselves
 | 
			
		||||
case "$uname_s" in
 | 
			
		||||
   Darwin)
 | 
			
		||||
      echo macosx
 | 
			
		||||
      exit 0
 | 
			
		||||
   ;;
 | 
			
		||||
   NetBSD)
 | 
			
		||||
      echo netbsd
 | 
			
		||||
      exit 0
 | 
			
		||||
   ;;
 | 
			
		||||
   FreeBSD)
 | 
			
		||||
      echo freebsd
 | 
			
		||||
      exit 0
 | 
			
		||||
   ;;
 | 
			
		||||
   OpenBSD)
 | 
			
		||||
      echo openbsd
 | 
			
		||||
      exit 0
 | 
			
		||||
   ;;
 | 
			
		||||
   SunOS)
 | 
			
		||||
      echo solaris
 | 
			
		||||
      exit 0
 | 
			
		||||
   ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
echo "Unknown OS" >&2
 | 
			
		||||
exit 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,7 +10,6 @@ __file /etc/cdist-configured --type file
 | 
			
		|||
case "$__target_host" in
 | 
			
		||||
   # Everybody has this
 | 
			
		||||
   localhost)
 | 
			
		||||
      __issue iddoesnotmatterhere
 | 
			
		||||
      __file test --type file --destination /tmp/cdist-testfile
 | 
			
		||||
   ;;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -29,4 +28,7 @@ case "$__target_host" in
 | 
			
		|||
      __package_apt zsh --state installed
 | 
			
		||||
      __package_apt apache2 --state uninstalled
 | 
			
		||||
   ;;
 | 
			
		||||
   kr)
 | 
			
		||||
      __issue iddoesnotmatterhere
 | 
			
		||||
   ;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,12 +24,24 @@
 | 
			
		|||
if [ -f "$__object/parameter/destination" ]; then
 | 
			
		||||
   destination="$(cat "$__object/parameter/destination")"
 | 
			
		||||
else
 | 
			
		||||
   destination="$__object_id"
 | 
			
		||||
   destination="/$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
os="$(cat $__global/explorer/os)"
 | 
			
		||||
 | 
			
		||||
case "$os" in
 | 
			
		||||
   macosx)
 | 
			
		||||
      md5sum="md5"
 | 
			
		||||
   ;;
 | 
			
		||||
 | 
			
		||||
   *)
 | 
			
		||||
      md5sum="md5sum"
 | 
			
		||||
   ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
# No output if file does not exist - does definitely not match the md5sum :-)
 | 
			
		||||
if [ -e "$destination" ]; then
 | 
			
		||||
   md5sum "$destination"
 | 
			
		||||
   $md5sum < "$destination"
 | 
			
		||||
else
 | 
			
		||||
   echo "NO FILE NOT FOUND, NO CHECKSUM CALCULATED."
 | 
			
		||||
   echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,20 +40,26 @@ if ! $(echo "$destination" | grep -q ^/); then
 | 
			
		|||
   exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case "$os" in
 | 
			
		||||
   macosx)
 | 
			
		||||
      md5sum="md5"
 | 
			
		||||
   ;;  
 | 
			
		||||
 | 
			
		||||
   *)  
 | 
			
		||||
      md5sum="md5sum"
 | 
			
		||||
   ;;  
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
# Copy source if existing
 | 
			
		||||
# FIXME: directory handling not supported - add recursive flag?
 | 
			
		||||
if [ -f "$__object/parameter/source" ]; then
 | 
			
		||||
   source="$(cat "$__object/parameter/source")"
 | 
			
		||||
 | 
			
		||||
   exec 3>&1
 | 
			
		||||
   exec 1>&2
 | 
			
		||||
 | 
			
		||||
   set -x
 | 
			
		||||
   md5sum="$(md5sum "$source")"
 | 
			
		||||
   local_md5sum="$($md5sum < "$source")"
 | 
			
		||||
   remote_md5sum="$(cat "$__object/explorer/md5sum")"
 | 
			
		||||
 | 
			
		||||
   # Is md5sum the right approach?
 | 
			
		||||
   if [ "$md5sum" != "$remote_md5sum" ]; then
 | 
			
		||||
   if [ "$local_md5sum" != "$remote_md5sum" ]; then
 | 
			
		||||
      # FIXME: This is ugly and hardcoded, replace after 1.0!
 | 
			
		||||
      # Probably a better aproach is to have the user configured
 | 
			
		||||
      # ~/.ssh/config to contain the right username
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1354
									
								
								doc/dev/config.guess
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1354
									
								
								doc/dev/config.guess
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										9
									
								
								doc/dev/logs/2011-03-03
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								doc/dev/logs/2011-03-03
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
Update on env:
 | 
			
		||||
 | 
			
		||||
   general explorer: __explorer
 | 
			
		||||
   initial manifest: __manifest, __global
 | 
			
		||||
   type manifests  __object, __object_id, __global
 | 
			
		||||
   type explorers:  __object, __object_id, __type_explorers
 | 
			
		||||
   type codegen:  __object, __object_id, __global
 | 
			
		||||
   type code:  -
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										9
									
								
								doc/dev/logs/2011-03-07
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								doc/dev/logs/2011-03-07
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
Update on env:
 | 
			
		||||
 | 
			
		||||
   general explorer: __explorer
 | 
			
		||||
   initial manifest: __manifest, __global
 | 
			
		||||
   type manifests  __object, __object_id, __global
 | 
			
		||||
   type explorers:  __object, __object_id, __type_explorers, __global
 | 
			
		||||
   type codegen:  __object, __object_id, __global
 | 
			
		||||
   type code:  -
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1 @@
 | 
			
		|||
Prepare documentation for 1.0.0.
 | 
			
		||||
   - Check all references in manpages
 | 
			
		||||
      - cdist.text, cdist-quickstart
 | 
			
		||||
         - write cdist-quickstart
 | 
			
		||||
            - redefine installation + configuration base?
 | 
			
		||||
Prepare release 1.0.0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,3 +40,56 @@ Documentation:
 | 
			
		|||
   - Different environments (production, integration, development)
 | 
			
		||||
      - via version control
 | 
			
		||||
   - Define how to raise errors in types
 | 
			
		||||
 | 
			
		||||
   - = todo
 | 
			
		||||
   + = in progress -> S|N
 | 
			
		||||
   x = done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   x remove old documentation from doc/man/!
 | 
			
		||||
   - Check all references in manpages, ensure all manpages exist, generic ones:
 | 
			
		||||
      + cdist
 | 
			
		||||
         + cdist-deploy-to
 | 
			
		||||
         + cdist-manifest
 | 
			
		||||
         - cdist-quickstart: how to get started
 | 
			
		||||
      - cdist-type           [IMPORTANT]
 | 
			
		||||
         - only do necessary work [TYPE IMPLEMENTATION HINTS]
 | 
			
		||||
            - install packages only if not existent
 | 
			
		||||
            - copy file only if different
 | 
			
		||||
         - DOC document that $type/manifest is executed for every object/instance
 | 
			
		||||
      - cdist-explorer
 | 
			
		||||
      - exported variables:
 | 
			
		||||
         - general explorer: __explorer                           # cdist-explorer
 | 
			
		||||
         - initial manifest: __manifest, __global                 # cdist-manifest
 | 
			
		||||
         - type manifests  __object, __object_id, __global        # cdist-type
 | 
			
		||||
         - type explorers:  __object, __object_id, __type_explorers # cdist-type
 | 
			
		||||
         - type codegen:  __object, __object_id, __global         # cdist-type
 | 
			
		||||
         - type code:  -                                          # cdist-code
 | 
			
		||||
      - cdist-type-integration
 | 
			
		||||
         - Ensure available types are documented (!)
 | 
			
		||||
            - define how to in cdist-type-integration
 | 
			
		||||
         - referenced on the webpage via cdist-type(7)!
 | 
			
		||||
   - ensure every file in bin/ has a correspondent manpage
 | 
			
		||||
      - cdist-bin-transfer
 | 
			
		||||
      - cdist-code-run-all
 | 
			
		||||
      - cdist-config
 | 
			
		||||
      - cdist-deploy-to
 | 
			
		||||
      - cdist-dir
 | 
			
		||||
      - cdist-explorer-run-init
 | 
			
		||||
      - cdist-manifest-run
 | 
			
		||||
      - cdist-manifest-run-all
 | 
			
		||||
      - cdist-manifest-run-init
 | 
			
		||||
      - cdist-object-codegen
 | 
			
		||||
      - cdist-object-codegen-all
 | 
			
		||||
      - cdist-object-explorer-all
 | 
			
		||||
      - cdist-quickstart
 | 
			
		||||
      - cdist-remote-code-run-all
 | 
			
		||||
      - cdist-remote-explorer-run
 | 
			
		||||
      - cdist-run-remote
 | 
			
		||||
      - cdist-type-build-emulation
 | 
			
		||||
      - cdist-type-emulator
 | 
			
		||||
   - Cleanup READMEs
 | 
			
		||||
   - Ensure html output of manpages are published on the web
 | 
			
		||||
 | 
			
		||||
- Makefile:
 | 
			
		||||
   - Include manpage generation
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue