From bf540836f8e9404d31fd5a33def2d547467a2cb0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 25 Sep 2010 12:36:30 +0200 Subject: [PATCH] big rename Signed-off-by: Nico Schottelius --- Makefile | 3 ++ bin/cdist-config | 33 +++++++++++-------- bin/cdist-explore | 2 +- cdist.mdwn | 9 +++++ conf/hosts/kr/manifest | 3 ++ conf/lib/{cdist_dir => cdist_dir.sh} | 0 ...ore_hostname => cdist_explore_hostname.sh} | 0 conf/lib/cdist_explore_os | 29 ---------------- ...pkg_system => cdist_explore_pkg_system.sh} | 0 conf/lib/{cdist_file => cdist_file.sh} | 0 conf/lib/{cdist_package => cdist_package.sh} | 2 +- ...> cdist_package_backend_pacman_install.sh} | 0 ...ackend => cdist_package_select_backend.sh} | 0 conf/modules/efsh/manifest | 5 +++ doc/internal/logs/2010-09-25 | 12 +++++++ doc/internal/profile | 2 ++ 16 files changed, 55 insertions(+), 45 deletions(-) create mode 100644 Makefile rename conf/lib/{cdist_dir => cdist_dir.sh} (100%) rename conf/lib/{cdist_explore_hostname => cdist_explore_hostname.sh} (100%) delete mode 100644 conf/lib/cdist_explore_os rename conf/lib/{cdist_explore_pkg_system => cdist_explore_pkg_system.sh} (100%) rename conf/lib/{cdist_file => cdist_file.sh} (100%) rename conf/lib/{cdist_package => cdist_package.sh} (96%) rename conf/lib/{cdist_package_backend_pacman_install => cdist_package_backend_pacman_install.sh} (100%) rename conf/lib/{cdist_package_select_backend => cdist_package_select_backend.sh} (100%) create mode 100644 conf/modules/efsh/manifest create mode 100644 doc/internal/logs/2010-09-25 create mode 100644 doc/internal/profile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..1dd8eb9b --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +sync: + .rsync lyni@tablett:cdist + .rsync nicosc@free.ethz.ch:cdist diff --git a/bin/cdist-config b/bin/cdist-config index 935071af..34fe4a86 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -27,23 +27,28 @@ : ${CDIST_HOSTS:=$CDIST_CONFIG/hosts} : ${CDIST_MODULES:=$CDIST_CONFIG/modules} -set -e +cdist_debug_echo() +{ + [ "$CDIST_DEBUG" ] && echo "Debug: $@" +} + +: ${CDIST_TMP:=$(mktemp /tmp/cdist.XXXXXXXXXXXX)} + +#set -e # load libraries so every program has them available -__cdist_cur="$(pwd -P)" -cd "${CDIST_LIBDIR}" -for __cdist_lib in *; do - . "./${__cdist_lib}" -done +find "${CDIST_LIBDIR}" -type f > "${CDIST_TMP}" +while read __cdist_lib; do + cdist_debug_echo "Loading $__cdist_lib ..." + . "${__cdist_lib}" +done < "${CDIST_TMP}" -# load modules -cd "${CDIST_MODULES}" -for __cdist_mod in *; do - . "./${__cdist_mod}/manifest" -done +# load modules, all parts +#find "${CDIST_MODULES}" -name manifest > "${CDIST_TMP}" - -set +e +#set +e #echo $CDIST_CONFIG -#echo $CDIST_LIBDIR +# FIXME: here or somewhere else? other parts may reuse tmp +rm -f $CDIST_TMP +#__cdist_cur="$(pwd -P)" diff --git a/bin/cdist-explore b/bin/cdist-explore index 74e7a3e7..9704057c 100755 --- a/bin/cdist-explore +++ b/bin/cdist-explore @@ -21,7 +21,7 @@ . cdist-config -find "${CDIST_LIBDIR}" -type f -name cdist_explore\* > "${CDIST_TMP}" +find "${CDIST_LIBDIR}" -type f -name cdist_explore\*.sh > "${CDIST_TMP}" while read funcfull; do sh="${funcfull##*/}" diff --git a/cdist.mdwn b/cdist.mdwn index 4c3de40b..3def440b 100644 --- a/cdist.mdwn +++ b/cdist.mdwn @@ -25,6 +25,15 @@ Before initial release, document: to a subdirectory named "files" +## Architecture + + - User write shell scripts, which are run on the server + - Shell scripts call cdist functions + - cdist functions generate cconfig, which can be verified + - if verified, generate "command file" to execute on the client + - client only sees the commands + - no special requirements on the client + ## next: cdist-deploy-to - sync conf/{lib/,modules,host/$name} diff --git a/conf/hosts/kr/manifest b/conf/hosts/kr/manifest index ed5ec791..53c91f37 100644 --- a/conf/hosts/kr/manifest +++ b/conf/hosts/kr/manifest @@ -1,6 +1,9 @@ +# works cdist_package install vim zsh rxvt-unicode +# works cdist_file files/notebook /etc/nicos_notebook + #collectd #cdist_file /etc/issue issue #cdist_file /etc/issue --via my_func diff --git a/conf/lib/cdist_dir b/conf/lib/cdist_dir.sh similarity index 100% rename from conf/lib/cdist_dir rename to conf/lib/cdist_dir.sh diff --git a/conf/lib/cdist_explore_hostname b/conf/lib/cdist_explore_hostname.sh similarity index 100% rename from conf/lib/cdist_explore_hostname rename to conf/lib/cdist_explore_hostname.sh diff --git a/conf/lib/cdist_explore_os b/conf/lib/cdist_explore_os deleted file mode 100644 index 1d67c3f0..00000000 --- a/conf/lib/cdist_explore_os +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# -# 2010 Nico Schottelius (nico-cdist at schottelius.org) -# -# 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 . -# -# - -cdist_explore_os() -{ - [ -f /etc/arch-release ] && echo archlinux - - [ -f /etc/debian_version ] && echo debian - - grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null && echo ubuntu -} diff --git a/conf/lib/cdist_explore_pkg_system b/conf/lib/cdist_explore_pkg_system.sh similarity index 100% rename from conf/lib/cdist_explore_pkg_system rename to conf/lib/cdist_explore_pkg_system.sh diff --git a/conf/lib/cdist_file b/conf/lib/cdist_file.sh similarity index 100% rename from conf/lib/cdist_file rename to conf/lib/cdist_file.sh diff --git a/conf/lib/cdist_package b/conf/lib/cdist_package.sh similarity index 96% rename from conf/lib/cdist_package rename to conf/lib/cdist_package.sh index 0fa9b2eb..65378ac9 100644 --- a/conf/lib/cdist_package +++ b/conf/lib/cdist_package.sh @@ -25,7 +25,7 @@ cdist_package() backend="$(cdist_package_select_backend)" case "$1" in - install|uninstall) + install|is_installed|uninstall) operation="$1"; shift ${backend}_${operation} "$@" ;; diff --git a/conf/lib/cdist_package_backend_pacman_install b/conf/lib/cdist_package_backend_pacman_install.sh similarity index 100% rename from conf/lib/cdist_package_backend_pacman_install rename to conf/lib/cdist_package_backend_pacman_install.sh diff --git a/conf/lib/cdist_package_select_backend b/conf/lib/cdist_package_select_backend.sh similarity index 100% rename from conf/lib/cdist_package_select_backend rename to conf/lib/cdist_package_select_backend.sh diff --git a/conf/modules/efsh/manifest b/conf/modules/efsh/manifest new file mode 100644 index 00000000..ac3a043c --- /dev/null +++ b/conf/modules/efsh/manifest @@ -0,0 +1,5 @@ +efsh() +{ + cdist_dir /home/services /home/users /home/groups + +} diff --git a/doc/internal/logs/2010-09-25 b/doc/internal/logs/2010-09-25 new file mode 100644 index 00000000..b2d22b0e --- /dev/null +++ b/doc/internal/logs/2010-09-25 @@ -0,0 +1,12 @@ +[12:15] kr:cdist% CDIST_DEBUG=1 cdist-config +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_dir.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_explore_hostname.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_explore_os.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_explore_pkg_system.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_file.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_package.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_package_backend_pacman_install.sh ... +Debug: Loading /home/users/nico/p/cdist/conf/lib/cdist_package_select_backend.sh ... +[12:15] kr:cdist% cdist-config +[12:15] kr:cdist% + diff --git a/doc/internal/profile b/doc/internal/profile new file mode 100644 index 00000000..e18cf3e3 --- /dev/null +++ b/doc/internal/profile @@ -0,0 +1,2 @@ +export PATH=$PATH:$HOME/cdist/bin +export CDIST_CONFIG=$HOME/cdist/conf