diff --git a/bin/cdist-config b/bin/cdist-config index 363f95fb..f7fb5ac0 100644 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -355,15 +355,17 @@ __cdist_tmp_removal() rm -rf "${__cdist_tmp_dir}" } -__cdist_exit_on_kill() +# Does not work in children, will be called again in every script! +# Use only in interactive "front end" scripts +__cdist_kill_on_interrupt() { - # FIXME: before 1.8.0 -> kill all children, but do not segfault - # kill 0 __cdist_tmp_removal + kill 0 + exit 1 } +# Remove tempfiles at normal exit trap __cdist_tmp_removal EXIT -trap __cdist_exit_on_kill INT TERM ################################################################################ diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index 138248d6..bf5614bc 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -25,6 +25,9 @@ [ $# -eq 1 ] || __cdist_usage "" set -eu +# Kill children on interrupt - only in interactive scripts +trap __cdist_kill_on_interrupt INT TERM + __cdist_target_host="$1" # Make target host available for non-core diff --git a/bin/cdist-mass-deploy b/bin/cdist-mass-deploy index 96427f7a..5ebfa1c2 100755 --- a/bin/cdist-mass-deploy +++ b/bin/cdist-mass-deploy @@ -25,18 +25,8 @@ [ $# -ge 1 ] || __cdist_usage "[-p] [target host ]" set -u -# trap __cdist_tmp_removal EXIT -trap killandclean EXIT - -killandclean() -{ - __cdist_echo info "Existing and killing children..." - kill 0 - - # Ensure tmp stuff is being removed - __cdist_cleanly_exit -} - +# Kill children on interrupt - only in interactive scripts +trap __cdist_kill_on_interrupt INT TERM filter() { diff --git a/doc/dev/logs/2011-06-13.installation-via-cdist b/doc/dev/logs/2011-06-13.installation-via-cdist new file mode 100644 index 00000000..1b7e6c97 --- /dev/null +++ b/doc/dev/logs/2011-06-13.installation-via-cdist @@ -0,0 +1,112 @@ +Provisioning Server ideas + + - bootup kernel on target host via TFTP/PXE + - start our code that + - enables networking (dhcp) + - enables sshd + +Requires: + - Program that creates our blob that needs to be started + - for Linux: initrd + - Including ssh keys -> known! + - startup sshd + +-------------------------------------------------------------------------------- +Setup for installation server: + + - have dhcpd available + - install tftpd server + - configure dhcp to tell clients to boot from tftp server + - have a kernel + +-------------------------------------------------------------------------------- +Ideas on how to create "blob" + + - Use tools from system? + -> requires same arch on destination! + - Use debian|...| base? + -> works with cuni! +-------------------------------------------------------------------------------- +tftp via cuni: +debian pxelinux.0 pxelinux.cfg + +[19:44] kr:tftp% ln -s /usr/lib/syslinux/ + +-------------------------------------------------------------------------------- +How to create the initrd? + Base from ... + arch? + debian? + +- needs many hardware support / in kernel? + - fit to kernel? + +-------------------------------------------------------------------------------- +Based on Debian +[21:33] kr:tftp% sudo debootstrap --arch=i386 squeeze debian-squeeze + +sudo chroot debian-squeeze /bin/bash + apt-get install openssh-server + + +-------------------------------------------------------------------------------- +Based on Archlinux + +Edit / create pacman.conf +Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 + +[21:40] kr:~% grep -v ^# pacman.conf | grep -v '^$' +[options] +HoldPkg = pacman glibc +SyncFirst = pacman +Architecture = auto +[core] +Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 +[extra] +Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 +[community] +Include = Server = ftp://mirrors.kernel.org/archlinux/$repo/os/i686 +[archlinuxfr] +Server = http://repo.archlinux.fr/$arch + +[21:40] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot + +[21:42] kr:tftp% sudo mkarchroot -C ~/pacman.conf archlinuxroot base + +-------------------------------------------------------------------------------- +Initramfs general: + + - need /init + +Test in Debian: + root@kr:/# ln -s /sbin/init init + +Create initramfs: + [22:47] kr:debian-squeeze% sudo find . -print0 | sudo cpio --null -ov --format=newc | gzip -9 > ../pre-os/initrd.gz + + + +-------------------------------------------------------------------------------- +Gentoo: http://en.gentoo-wiki.com/wiki/Initramfs + +It is possible to specify multiple initramfs to be extracted during boot. This can be useful if you want to create a generic initramfs (for example one that does mdadm) and then add modifications in separate files (for example a custom /etc/mdadm.conf for every machine). + +http://syslinux.zytor.com/wiki/index.php/SYSLINUX#INITRD_initrd_file + It supports multiple filenames separated by commas. This is mostly useful for initramfs, which can be composed of multiple separate cpio or cpio.gz archives. Note: all files except the last one are zero-padded to a 4K page boundary. This should not affect initramfs. +-------------------------------------------------------------------------------- +Multiple initrds, #1: + +LABEL preos + MENU LABEL Pre OS (Debian Squeeze) + KERNEL debian-squeeze/boot/vmlinuz-2.6.32-5-686 + INITRD debian-squeeze/boot/initrd.img-2.6.32-5-686,pre-os/initrd.gz + +-------------------------------------------------------------------------------- +Debug in rootfs: +root@kr:/# passwd +Enter new UNIX password: +Retype new UNIX password: +passwd: password updated successfully +test +-------------------------------------------------------------------------------- +Multiple nics in Debian... diff --git a/doc/dev/logs/2011-06-14.library_for_user b/doc/dev/logs/2011-06-14.library_for_user new file mode 100644 index 00000000..325150e2 --- /dev/null +++ b/doc/dev/logs/2011-06-14.library_for_user @@ -0,0 +1,19 @@ +How to make library functions available to manifest, explorer, etc. + +Some ideas / background: + + - do not have the user to source $__lib/foo if not needed + - have $__cdist_lib for internal stuff (probably referring to core/) + +Implementation: + +load_lib() +{ + . $__cdist_lib/* +} + +run_code_from_user() +{ + load_lib + . file_from_user +} diff --git a/doc/dev/todo/TAKEME b/doc/dev/todo/TAKEME index 871045f2..d626493d 100644 --- a/doc/dev/todo/TAKEME +++ b/doc/dev/todo/TAKEME @@ -37,6 +37,9 @@ CORE -> add function to cdist-config, import from cdist-cache - check all all internal variables are prefixed with __cdist +- Define / document "this is what should be on host X" + and have it parsable by different (shinken) tool + -> given after manifest run already! TYPES ------ diff --git a/doc/man/man7/cdist-hacker.text b/doc/man/man7/cdist-hacker.text index 027f28aa..efd6ef7d 100644 --- a/doc/man/man7/cdist-hacker.text +++ b/doc/man/man7/cdist-hacker.text @@ -54,6 +54,7 @@ everybody using cdist, you're welcome to propose inclusion into upstream. There are though some requirements to ensure your changes don't break others work nor kill the authors brain: +- All files should contain the usual header (Author, Copying, etc.) - Code submission must be done via git - Do not add conf/manifest/init - This file should only be touched in your private branch! diff --git a/doc/man/man7/cdist-type.text b/doc/man/man7/cdist-type.text index 8d1b9ae4..1af386fb 100644 --- a/doc/man/man7/cdist-type.text +++ b/doc/man/man7/cdist-type.text @@ -183,12 +183,12 @@ level tools like ruby installed. If a type requires specific tools to be present on the target, there must be another type that provides this tool and the first type should create an object of the specific type. -If your type wants to save temporay data, that may be used by other types +If your type wants to save temporary data, that may be used by other types later on (for instance __file), you can save them in the subdirectory "files" below $__object (but you must create it yourself). cdist will not touch this directory. -If your type contains static files, it's also recommened to place them in +If your type contains static files, it's also recommended to place them in a folder named "files" within the type (again, because cdist guarantees to never ever touch this folder). diff --git a/doc/man/man7/cdist.text b/doc/man/man7/cdist.text index a4c88c1d..9f7dbbab 100644 --- a/doc/man/man7/cdist.text +++ b/doc/man/man7/cdist.text @@ -34,7 +34,7 @@ pull mechanism (client requests configuration). SEE ALSO -------- -- Website: http://www.nico.schottelius.org/cdist/[] +- Website: http://www.nico.schottelius.org/software/cdist/[] - cdist-best-practise(7) - cdist-deploy-to(1) - cdist-hacker(7)