forked from ungleich-public/cdist
		
	Merge remote-tracking branch 'ungleich/master' into cdist-type__hosts
This commit is contained in:
		
				commit
				
					
						d3b3fef63b
					
				
			
		
					 227 changed files with 4524 additions and 427 deletions
				
			
		| 
						 | 
				
			
			@ -59,16 +59,24 @@ class UnresolvableRequirementsError(cdist.Error):
 | 
			
		|||
class CdistBetaRequired(cdist.Error):
 | 
			
		||||
    """Beta functionality is used but beta is not enabled"""
 | 
			
		||||
 | 
			
		||||
    def __init__(self, command, arg):
 | 
			
		||||
    def __init__(self, command, arg=None):
 | 
			
		||||
        self.command = command
 | 
			
		||||
        self.arg = arg
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        err_msg = ("\'{}\' argument of \'{}\' command is beta, but beta is "
 | 
			
		||||
        if self.arg is None:
 | 
			
		||||
            err_msg = ("\'{}\' command is beta, but beta is "
 | 
			
		||||
                       "not enabled. If you want to use it please enable beta "
 | 
			
		||||
                   "functionalities by using the -b/--enable-beta command "
 | 
			
		||||
                   "line flag.")
 | 
			
		||||
        return err_msg.format(self.arg, self.command)
 | 
			
		||||
                       "functionalities by using the -b/--beta command "
 | 
			
		||||
                       "line flag or setting CDIST_BETA env var.")
 | 
			
		||||
            fmt_args = [self.command, ]
 | 
			
		||||
        else:
 | 
			
		||||
            err_msg = ("\'{}\' argument of \'{}\' command is beta, but beta "
 | 
			
		||||
                       "is not enabled. If you want to use it please enable "
 | 
			
		||||
                       "beta functionalities by using the -b/--beta "
 | 
			
		||||
                       "command line flag or setting CDIST_BETA env var.")
 | 
			
		||||
            fmt_args = [self.arg, self.command, ]
 | 
			
		||||
        return err_msg.format(*fmt_args)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class CdistObjectError(Error):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										210
									
								
								cdist/argparse.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										210
									
								
								cdist/argparse.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,210 @@
 | 
			
		|||
import argparse
 | 
			
		||||
import cdist
 | 
			
		||||
import multiprocessing
 | 
			
		||||
import os
 | 
			
		||||
import logging
 | 
			
		||||
import collections
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# set of beta sub-commands
 | 
			
		||||
BETA_COMMANDS = set(('install', ))
 | 
			
		||||
# set of beta arguments for sub-commands
 | 
			
		||||
BETA_ARGS = {
 | 
			
		||||
    'config': set(('jobs', )),
 | 
			
		||||
}
 | 
			
		||||
EPILOG = "Get cdist at http://www.nico.schottelius.org/software/cdist/"
 | 
			
		||||
# Parser others can reuse
 | 
			
		||||
parser = None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
_verbosity_level = {
 | 
			
		||||
    0: logging.ERROR,
 | 
			
		||||
    1: logging.WARNING,
 | 
			
		||||
    2: logging.INFO,
 | 
			
		||||
}
 | 
			
		||||
_verbosity_level = collections.defaultdict(
 | 
			
		||||
    lambda: logging.DEBUG, _verbosity_level)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_beta_command(cmd):
 | 
			
		||||
    BETA_COMMANDS.add(cmd)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def add_beta_arg(cmd, arg):
 | 
			
		||||
    if cmd in BETA_ARGS:
 | 
			
		||||
        if arg not in BETA_ARGS[cmd]:
 | 
			
		||||
            BETA_ARGS[cmd].append(arg)
 | 
			
		||||
    else:
 | 
			
		||||
        BETA_ARGS[cmd] = set((arg, ))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def check_beta(args_dict):
 | 
			
		||||
    if 'beta' not in args_dict:
 | 
			
		||||
        args_dict['beta'] = False
 | 
			
		||||
    # Check only if beta is not enabled: if beta option is specified then
 | 
			
		||||
    # raise error.
 | 
			
		||||
    if not args_dict['beta']:
 | 
			
		||||
        cmd = args_dict['command']
 | 
			
		||||
        # first check if command is beta
 | 
			
		||||
        if cmd in BETA_COMMANDS:
 | 
			
		||||
            raise cdist.CdistBetaRequired(cmd)
 | 
			
		||||
        # then check if some command's argument is beta
 | 
			
		||||
        if cmd in BETA_ARGS:
 | 
			
		||||
            for arg in BETA_ARGS[cmd]:
 | 
			
		||||
                if arg in args_dict and args_dict[arg]:
 | 
			
		||||
                    raise cdist.CdistBetaRequired(cmd, arg)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def check_positive_int(value):
 | 
			
		||||
    import argparse
 | 
			
		||||
 | 
			
		||||
    try:
 | 
			
		||||
        val = int(value)
 | 
			
		||||
    except ValueError:
 | 
			
		||||
        raise argparse.ArgumentTypeError(
 | 
			
		||||
                "{} is invalid int value".format(value))
 | 
			
		||||
    if val <= 0:
 | 
			
		||||
        raise argparse.ArgumentTypeError(
 | 
			
		||||
                "{} is invalid positive int value".format(val))
 | 
			
		||||
    return val
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_parsers():
 | 
			
		||||
    global parser
 | 
			
		||||
 | 
			
		||||
    # Construct parser others can reuse
 | 
			
		||||
    if parser:
 | 
			
		||||
        return parser
 | 
			
		||||
    else:
 | 
			
		||||
        parser = {}
 | 
			
		||||
    # Options _all_ parsers have in common
 | 
			
		||||
    parser['loglevel'] = argparse.ArgumentParser(add_help=False)
 | 
			
		||||
    parser['loglevel'].add_argument(
 | 
			
		||||
            '-d', '--debug',
 | 
			
		||||
            help=('Set log level to debug (deprecated, use -vvv instead)'),
 | 
			
		||||
            action='store_true', default=False)
 | 
			
		||||
    parser['loglevel'].add_argument(
 | 
			
		||||
            '-v', '--verbose',
 | 
			
		||||
            help=('Increase the verbosity level. Every instance of -v '
 | 
			
		||||
                  'increments the verbosity level by one. Its default value is '
 | 
			
		||||
                  '0. There are 4 levels of verbosity. The order of levels '
 | 
			
		||||
                  'from the lowest to the highest are: ERROR (0), WARNING (1), '
 | 
			
		||||
                  'INFO (2) and DEBUG (3 or higher).'),
 | 
			
		||||
            action='count', default=0)
 | 
			
		||||
 | 
			
		||||
    parser['beta'] = argparse.ArgumentParser(add_help=False)
 | 
			
		||||
    parser['beta'].add_argument(
 | 
			
		||||
           '-b', '--beta',
 | 
			
		||||
           help=('Enable beta functionalities. '
 | 
			
		||||
                 'Can also be enabled using CDIST_BETA env var.'),
 | 
			
		||||
           action='store_true', dest='beta',
 | 
			
		||||
           default='CDIST_BETA' in os.environ)
 | 
			
		||||
 | 
			
		||||
    # Main subcommand parser
 | 
			
		||||
    parser['main'] = argparse.ArgumentParser(
 | 
			
		||||
            description='cdist ' + cdist.VERSION, parents=[parser['loglevel']])
 | 
			
		||||
    parser['main'].add_argument(
 | 
			
		||||
            '-V', '--version', help='Show version', action='version',
 | 
			
		||||
            version='%(prog)s ' + cdist.VERSION)
 | 
			
		||||
    parser['sub'] = parser['main'].add_subparsers(
 | 
			
		||||
            title="Commands", dest="command")
 | 
			
		||||
 | 
			
		||||
    # Banner
 | 
			
		||||
    parser['banner'] = parser['sub'].add_parser(
 | 
			
		||||
            'banner', parents=[parser['loglevel']])
 | 
			
		||||
    parser['banner'].set_defaults(func=cdist.banner.banner)
 | 
			
		||||
 | 
			
		||||
    # Config
 | 
			
		||||
    parser['config_main'] = argparse.ArgumentParser(add_help=False)
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
            '-c', '--conf-dir',
 | 
			
		||||
            help=('Add configuration directory (can be repeated, '
 | 
			
		||||
                  'last one wins)'), action='append')
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
           '-i', '--initial-manifest',
 | 
			
		||||
           help='path to a cdist manifest or \'-\' to read from stdin.',
 | 
			
		||||
           dest='manifest', required=False)
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
           '-j', '--jobs', nargs='?',
 | 
			
		||||
           type=check_positive_int,
 | 
			
		||||
           help=('Specify the maximum number of parallel jobs, currently '
 | 
			
		||||
                 'only global explorers are supported'),
 | 
			
		||||
           action='store', dest='jobs',
 | 
			
		||||
           const=multiprocessing.cpu_count())
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
           '-n', '--dry-run',
 | 
			
		||||
           help='do not execute code', action='store_true')
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
           '-o', '--out-dir',
 | 
			
		||||
           help='directory to save cdist output in', dest="out_path")
 | 
			
		||||
 | 
			
		||||
    # remote-copy and remote-exec defaults are environment variables
 | 
			
		||||
    # if set; if not then None - these will be futher handled after
 | 
			
		||||
    # parsing to determine implementation default
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
           '--remote-copy',
 | 
			
		||||
           help='Command to use for remote copy (should behave like scp)',
 | 
			
		||||
           action='store', dest='remote_copy',
 | 
			
		||||
           default=os.environ.get('CDIST_REMOTE_COPY'))
 | 
			
		||||
    parser['config_main'].add_argument(
 | 
			
		||||
           '--remote-exec',
 | 
			
		||||
           help=('Command to use for remote execution '
 | 
			
		||||
                 '(should behave like ssh)'),
 | 
			
		||||
           action='store', dest='remote_exec',
 | 
			
		||||
           default=os.environ.get('CDIST_REMOTE_EXEC'))
 | 
			
		||||
 | 
			
		||||
    # Config
 | 
			
		||||
    parser['config_args'] = argparse.ArgumentParser(add_help=False)
 | 
			
		||||
    parser['config_args'].add_argument(
 | 
			
		||||
            'host', nargs='*', help='host(s) to operate on')
 | 
			
		||||
    parser['config_args'].add_argument(
 | 
			
		||||
            '-f', '--file',
 | 
			
		||||
            help=('Read additional hosts to operate on from specified file '
 | 
			
		||||
                  'or from stdin if \'-\' (each host on separate line). '
 | 
			
		||||
                  'If no host or host file is specified then, by default, '
 | 
			
		||||
                  'read hosts from stdin.'),
 | 
			
		||||
            dest='hostfile', required=False)
 | 
			
		||||
    parser['config_args'].add_argument(
 | 
			
		||||
           '-p', '--parallel',
 | 
			
		||||
           help='operate on multiple hosts in parallel',
 | 
			
		||||
           action='store_true', dest='parallel')
 | 
			
		||||
    parser['config_args'].add_argument(
 | 
			
		||||
           '-s', '--sequential',
 | 
			
		||||
           help='operate on multiple hosts sequentially (default)',
 | 
			
		||||
           action='store_false', dest='parallel')
 | 
			
		||||
    parser['config'] = parser['sub'].add_parser(
 | 
			
		||||
            'config', parents=[parser['loglevel'], parser['beta'],
 | 
			
		||||
                               parser['config_main'],
 | 
			
		||||
                               parser['config_args']])
 | 
			
		||||
    parser['config'].set_defaults(func=cdist.config.Config.commandline)
 | 
			
		||||
 | 
			
		||||
    # Install
 | 
			
		||||
    parser['install'] = parser['sub'].add_parser('install', add_help=False,
 | 
			
		||||
                                                 parents=[parser['config']])
 | 
			
		||||
    parser['install'].set_defaults(func=cdist.install.Install.commandline)
 | 
			
		||||
 | 
			
		||||
    # Shell
 | 
			
		||||
    parser['shell'] = parser['sub'].add_parser(
 | 
			
		||||
            'shell', parents=[parser['loglevel']])
 | 
			
		||||
    parser['shell'].add_argument(
 | 
			
		||||
            '-s', '--shell',
 | 
			
		||||
            help=('Select shell to use, defaults to current shell. Used shell'
 | 
			
		||||
                  ' should be POSIX compatible shell.'))
 | 
			
		||||
    parser['shell'].set_defaults(func=cdist.shell.Shell.commandline)
 | 
			
		||||
 | 
			
		||||
    for p in parser:
 | 
			
		||||
        parser[p].epilog = EPILOG
 | 
			
		||||
 | 
			
		||||
    return parser
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def handle_loglevel(args):
 | 
			
		||||
    if args.debug:
 | 
			
		||||
        retval = "-d/--debug is deprecated, use -vvv instead"
 | 
			
		||||
        args.verbose = 3
 | 
			
		||||
    else:
 | 
			
		||||
        retval = None
 | 
			
		||||
 | 
			
		||||
    logging.root.setLevel(_verbosity_level[args.verbose])
 | 
			
		||||
 | 
			
		||||
    return retval
 | 
			
		||||
							
								
								
									
										2
									
								
								cdist/conf/explorer/disks
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/explorer/disks
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
cd /dev
 | 
			
		||||
echo sd? hd? vd?
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +39,11 @@ if [ -f /etc/cdist-preos ]; then
 | 
			
		|||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -d /gnu/store ]; then
 | 
			
		||||
   echo guixsd
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
### Debian and derivatives
 | 
			
		||||
if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
 | 
			
		||||
   echo ubuntu
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,11 @@ case "$($__explorer/os)" in
 | 
			
		|||
      cat /etc/slackware-version
 | 
			
		||||
   ;;
 | 
			
		||||
   suse)
 | 
			
		||||
      if [ -f /etc/os-release ]; then
 | 
			
		||||
        cat /etc/os-release
 | 
			
		||||
      else
 | 
			
		||||
        cat /etc/SuSE-release
 | 
			
		||||
      fi
 | 
			
		||||
   ;;
 | 
			
		||||
   ubuntu)
 | 
			
		||||
      lsb_release -sr
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										31
									
								
								cdist/conf/type/__apt_mark/explorer/apt_version
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								cdist/conf/type/__apt_mark/explorer/apt_version
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Ander Punnar (cdist at kvlt.ee)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
apt_version_is=$(dpkg-query --show --showformat '${Version}' apt)
 | 
			
		||||
 | 
			
		||||
# from APT changelog:
 | 
			
		||||
#   apt (0.8.14.2) UNRELEASED; urgency=low
 | 
			
		||||
#   provide a 'dpkg --set-selections' wrapper to set/release holds
 | 
			
		||||
 | 
			
		||||
apt_version_should=0.8.14.2
 | 
			
		||||
 | 
			
		||||
dpkg --compare-versions $apt_version_should le $apt_version_is \
 | 
			
		||||
    && echo 0 \
 | 
			
		||||
    || echo 1
 | 
			
		||||
							
								
								
									
										30
									
								
								cdist/conf/type/__apt_mark/explorer/package_installed
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								cdist/conf/type/__apt_mark/explorer/package_installed
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,30 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Ander Punnar (cdist at kvlt.ee)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/name" ]; then
 | 
			
		||||
    name="$(cat "$__object/parameter/name")"
 | 
			
		||||
else
 | 
			
		||||
    name="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
dpkg-query --show --showformat '${Status}' $name 2>/dev/null \
 | 
			
		||||
    | grep -q 'ok installed' \
 | 
			
		||||
    && echo 0 \
 | 
			
		||||
    || echo 1
 | 
			
		||||
							
								
								
									
										27
									
								
								cdist/conf/type/__apt_mark/explorer/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								cdist/conf/type/__apt_mark/explorer/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Ander Punnar (cdist at kvlt.ee)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/name" ]; then
 | 
			
		||||
    name="$(cat "$__object/parameter/name")"
 | 
			
		||||
else
 | 
			
		||||
    name="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
apt-mark showhold | grep -q $name && echo hold || echo unhold
 | 
			
		||||
							
								
								
									
										56
									
								
								cdist/conf/type/__apt_mark/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								cdist/conf/type/__apt_mark/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Ander Punnar (cdist at kvlt.ee)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/name" ]; then
 | 
			
		||||
    name="$(cat "$__object/parameter/name")"
 | 
			
		||||
else
 | 
			
		||||
    name="$__object_id"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
apt_version="$(cat "$__object/explorer/apt_version")"
 | 
			
		||||
 | 
			
		||||
if [ "$apt_version" != '0' ]; then
 | 
			
		||||
    echo 'APT version not supported' >&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
package_installed="$(cat "$__object/explorer/package_installed")"
 | 
			
		||||
 | 
			
		||||
if [ "$package_installed" != '0' ]; then
 | 
			
		||||
    exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
state_should="$(cat "$__object/parameter/state")"
 | 
			
		||||
 | 
			
		||||
state_is="$(cat "$__object/explorer/state")"
 | 
			
		||||
 | 
			
		||||
if [ "$state_should" = "$state_is" ]; then
 | 
			
		||||
    exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    hold|unhold)
 | 
			
		||||
        echo "apt-mark $state_should $name > /dev/null"
 | 
			
		||||
    ;;
 | 
			
		||||
    *)
 | 
			
		||||
        echo "Unknown state: $state_should" >&2
 | 
			
		||||
        exit 1
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
							
								
								
									
										47
									
								
								cdist/conf/type/__apt_mark/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								cdist/conf/type/__apt_mark/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
cdist-type__apt_mark(7)
 | 
			
		||||
=======================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__apt_mark - set package state as 'hold' or 'unhold'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
See apt-mark(8) for details.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
state
 | 
			
		||||
   Either "hold" or "unhold".
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
name
 | 
			
		||||
   If supplied, use the name and not the object id as the package name.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # hold package
 | 
			
		||||
    __apt_mark quagga --state hold
 | 
			
		||||
    # unhold package
 | 
			
		||||
    __apt_mark quagga --state unhold
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Ander Punnar <cdist--@--kvlt.ee>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2016 Ander Punnar. 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.
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__apt_mark/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__apt_mark/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
name
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__apt_mark/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__apt_mark/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
state
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ username
 | 
			
		|||
 | 
			
		||||
source
 | 
			
		||||
    Select the source from which to clone cdist from.
 | 
			
		||||
    Defaults to "git://github.com/telmich/cdist.git".
 | 
			
		||||
    Defaults to "git://github.com/ungleich/cdist.git".
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
branch
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ EXAMPLES
 | 
			
		|||
    __cdist /home/cdist/cdist
 | 
			
		||||
 | 
			
		||||
    # Use alternative source
 | 
			
		||||
    __cdist --source "git://git.schottelius.org/cdist" /home/cdist/cdist
 | 
			
		||||
    __cdist --source "git://github.com/ungleich/cdist" /home/cdist/cdist
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1 @@
 | 
			
		|||
git://github.com/telmich/cdist.git
 | 
			
		||||
git://github.com/ungleich/cdist.git
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
#
 | 
			
		||||
# Copyright (C) 2011 Daniel Maher (phrawzty+cdist at gmail.com)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist (https://github.com/telmich/cdist/).
 | 
			
		||||
# 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										48
									
								
								cdist/conf/type/__chroot_mount/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										48
									
								
								cdist/conf/type/__chroot_mount/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
chroot="/$__object_id"
 | 
			
		||||
 | 
			
		||||
cat << DONE
 | 
			
		||||
# Prepare chroot
 | 
			
		||||
[ -d "${chroot}/proc" ] || mkdir "${chroot}/proc"
 | 
			
		||||
mountpoint -q "${chroot}/proc" \
 | 
			
		||||
   || mount -t proc -o nosuid,noexec,nodev proc "${chroot}/proc"
 | 
			
		||||
 | 
			
		||||
[ -d "${chroot}/sys" ] || mkdir "${chroot}/sys"
 | 
			
		||||
mountpoint -q "${chroot}/sys" \
 | 
			
		||||
   || mount -t sysfs -o nosuid,noexec,nodev sys "${chroot}/sys"
 | 
			
		||||
 | 
			
		||||
[ -d "${chroot}/dev" ] || mkdir "${chroot}/dev"
 | 
			
		||||
mountpoint -q "${chroot}/dev" \
 | 
			
		||||
   || mount -t devtmpfs -o mode=0755,nosuid udev "${chroot}/dev"
 | 
			
		||||
 | 
			
		||||
[ -d "${chroot}/dev/pts" ] || mkdir "${chroot}/dev/pts"
 | 
			
		||||
mountpoint -q "${chroot}/dev/pts" \
 | 
			
		||||
   || mount -t devpts -o mode=0620,gid=5,nosuid,noexec devpts "${chroot}/dev/pts"
 | 
			
		||||
 | 
			
		||||
[ -d "${chroot}/tmp" ] || mkdir -m 1777 "${chroot}/tmp"
 | 
			
		||||
mountpoint -q "${chroot}/tmp" \
 | 
			
		||||
   || mount -t tmpfs -o mode=1777,strictatime,nodev,nosuid tmpfs "${chroot}/tmp"
 | 
			
		||||
 | 
			
		||||
if [ ! -f "${chroot}/etc/resolv.conf" ]; then
 | 
			
		||||
   cp /etc/resolv.conf "${chroot}/etc/"
 | 
			
		||||
fi
 | 
			
		||||
DONE
 | 
			
		||||
							
								
								
									
										42
									
								
								cdist/conf/type/__chroot_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								cdist/conf/type/__chroot_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
cdist-type__chroot_mount(7)
 | 
			
		||||
===================================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__chroot_mount - mount a chroot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Mount and prepare a chroot for running commands within it.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __chroot_mount /path/to/chroot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2012 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										36
									
								
								cdist/conf/type/__chroot_umount/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								cdist/conf/type/__chroot_umount/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
chroot="/$__object_id"
 | 
			
		||||
 | 
			
		||||
cat << DONE
 | 
			
		||||
umount -l "${chroot}/tmp"
 | 
			
		||||
umount -l "${chroot}/dev/pts"
 | 
			
		||||
umount -l "${chroot}/dev"
 | 
			
		||||
umount -l "${chroot}/sys"
 | 
			
		||||
umount -l "${chroot}/proc"
 | 
			
		||||
rm -f "${chroot}/etc/resolv.conf"
 | 
			
		||||
if [ -d "${chroot}/etc/resolvconf/resolv.conf.d" ]; then
 | 
			
		||||
   # ensure /etc/resolvconf/resolv.conf.d/tail is not linked to \
 | 
			
		||||
   # e.g. /etc/resolvconf/resolv.conf.d/original
 | 
			
		||||
   rm -f "${chroot}/etc/resolvconf/resolv.conf.d/tail"
 | 
			
		||||
   touch "${chroot}/etc/resolvconf/resolv.conf.d/tail"
 | 
			
		||||
fi
 | 
			
		||||
DONE
 | 
			
		||||
							
								
								
									
										47
									
								
								cdist/conf/type/__chroot_umount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								cdist/conf/type/__chroot_umount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
cdist-type__chroot_umount(7)
 | 
			
		||||
============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__chroot_umount - unmount a chroot mounted by __chroot_mount
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Undo what __chroot_mount did.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __chroot_umount /path/to/chroot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
:strong:`cdist-type__chroot_mount`\ (7)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2012 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.0/cksum
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.0/cksum
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
695240564 24003648 consul
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.0/source
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.0/source
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
https://releases.hashicorp.com/consul/0.7.0/consul_0.7.0_linux_amd64.zip
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.1/cksum
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.1/cksum
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
3128343188 28402769 consul
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.1/source
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__consul/files/versions/0.7.1/source
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_linux_amd64.zip
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +107,7 @@ rejoin-after-leave
 | 
			
		|||
server
 | 
			
		||||
   used to control if an agent is in server or client mode
 | 
			
		||||
 | 
			
		||||
syslog
 | 
			
		||||
enable-syslog
 | 
			
		||||
   enables logging to syslog
 | 
			
		||||
 | 
			
		||||
verify-incoming
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,7 @@ for param in $(ls "$__object/parameter/"); do
 | 
			
		|||
         key="$(echo "${param%-*}" | tr '-' '_')"
 | 
			
		||||
         printf '   ,"%s": "%s"\n' "$key" "$destination"
 | 
			
		||||
      ;;
 | 
			
		||||
      disable-remote-exec|disable-update-check|leave-on-terminate|rejoin-after-leave|server|syslog|verify-incoming|verify-outgoing)
 | 
			
		||||
      disable-remote-exec|disable-update-check|leave-on-terminate|rejoin-after-leave|server|enable-syslog|verify-incoming|verify-outgoing)
 | 
			
		||||
         # handle boolean parameters
 | 
			
		||||
         key="$(echo "$param" | tr '-' '_')"
 | 
			
		||||
         printf '   ,"%s": true\n' "$key"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,6 @@ disable-update-check
 | 
			
		|||
leave-on-terminate
 | 
			
		||||
rejoin-after-leave
 | 
			
		||||
server
 | 
			
		||||
syslog
 | 
			
		||||
enable-syslog
 | 
			
		||||
verify-incoming
 | 
			
		||||
verify-outgoing
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ DESCRIPTION
 | 
			
		|||
Generate and deploy check definitions for a consul agent.
 | 
			
		||||
See http://www.consul.io/docs/agent/checks.html for parameter documentation.
 | 
			
		||||
 | 
			
		||||
Use either script toghether with interval, or use ttl.
 | 
			
		||||
Use either script together with interval, or use ttl.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,4 +22,9 @@
 | 
			
		|||
name="$__object_name"
 | 
			
		||||
user="$(cat "$__object/parameter/user")"
 | 
			
		||||
 | 
			
		||||
if [ -f "$__object/parameter/raw_command" ]; then
 | 
			
		||||
    command="$(cat "$__object/parameter/command")"
 | 
			
		||||
    crontab -u $user -l 2>/dev/null | grep "^$command\$" || true
 | 
			
		||||
else
 | 
			
		||||
    crontab -u $user -l 2>/dev/null | grep "# $name\$" || true
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										13
									
								
								cdist/conf/type/__cron/gencode-remote
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										13
									
								
								cdist/conf/type/__cron/gencode-remote
									
										
									
									
									
										
										
										Executable file → Normal file
									
								
							| 
						 | 
				
			
			@ -3,6 +3,7 @@
 | 
			
		|||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
# 2013      Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
# 2013      Thomas Oettli (otho at sfs.biz)
 | 
			
		||||
# 2017      Daniel Heule (hda at sfs.biz)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +27,7 @@ command="$(cat "$__object/parameter/command")"
 | 
			
		|||
 | 
			
		||||
if [ -f "$__object/parameter/raw" ]; then
 | 
			
		||||
   raw="$(cat "$__object/parameter/raw")"
 | 
			
		||||
   entry="$raw $command"
 | 
			
		||||
   entry="$raw $command # $name"
 | 
			
		||||
elif [ -f "$__object/parameter/raw_command" ]; then
 | 
			
		||||
   entry="$command"
 | 
			
		||||
else
 | 
			
		||||
| 
						 | 
				
			
			@ -35,10 +36,9 @@ else
 | 
			
		|||
   day_of_month="$(cat "$__object/parameter/day_of_month" 2>/dev/null || echo "*")"
 | 
			
		||||
   month="$(cat "$__object/parameter/month" 2>/dev/null || echo "*")"
 | 
			
		||||
   day_of_week="$(cat "$__object/parameter/day_of_week" 2>/dev/null || echo "*")"
 | 
			
		||||
   entry="$minute $hour $day_of_month $month $day_of_week $command"
 | 
			
		||||
   entry="$minute $hour $day_of_month $month $day_of_week $command # $name"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
entry="$entry # $name"
 | 
			
		||||
mkdir "$__object/files"
 | 
			
		||||
echo "$entry" > "$__object/files/entry"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ state_should="$(cat "$__object/parameter/state" 2>/dev/null || echo "present")"
 | 
			
		|||
# These are the old markers
 | 
			
		||||
prefix="#cdist:__cron/$__object_id"
 | 
			
		||||
suffix="#/cdist:__cron/$__object_id"
 | 
			
		||||
filter="^# DO NOT EDIT THIS FILE|^# \(.* installed on |^# \(Cron version V"
 | 
			
		||||
filter="^# DO NOT EDIT THIS FILE|^# \(.* installed on |^# \(Cron version V|^# \(Cronie version .\..\)$"
 | 
			
		||||
cat << DONE
 | 
			
		||||
crontab -u $user -l 2>/dev/null | grep -v -E "$filter" | awk -v prefix="$prefix" -v suffix="$suffix" '
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +85,12 @@ case "$state_should" in
 | 
			
		|||
        echo ") | crontab -u $user -"
 | 
			
		||||
    ;;
 | 
			
		||||
    absent)
 | 
			
		||||
        if [ -f "$__object/parameter/raw_command" ]; then
 | 
			
		||||
            echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
 | 
			
		||||
            echo "grep -v \"^$entry\\$\" | crontab -u $user -"
 | 
			
		||||
        else
 | 
			
		||||
            echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
 | 
			
		||||
            echo "grep -v \"# $name\\$\" | crontab -u $user -"
 | 
			
		||||
        fi
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										56
									
								
								cdist/conf/type/__docker/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								cdist/conf/type/__docker/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,56 @@
 | 
			
		|||
cdist-type__docker(7)
 | 
			
		||||
=====================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__docker - install docker-engine
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Installs latest docker-engine package from dockerproject.org.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOLEAN PARAMETERS
 | 
			
		||||
------------------
 | 
			
		||||
experimental
 | 
			
		||||
   Install the experimental docker-engine package instead of the latest stable release.
 | 
			
		||||
 | 
			
		||||
state
 | 
			
		||||
   'present' or 'absent', defaults to 'present'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # Install docker
 | 
			
		||||
    __docker
 | 
			
		||||
 | 
			
		||||
    # Install experimental
 | 
			
		||||
    __docker --experimental
 | 
			
		||||
 | 
			
		||||
    # Remove docker
 | 
			
		||||
    __docker --state absent
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2016 Steven Armstrong. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
			
		||||
							
								
								
									
										83
									
								
								cdist/conf/type/__docker/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										83
									
								
								cdist/conf/type/__docker/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,83 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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")
 | 
			
		||||
state=$(cat "$__object/parameter/state")
 | 
			
		||||
 | 
			
		||||
case "$os" in
 | 
			
		||||
    centos)
 | 
			
		||||
        component="main"
 | 
			
		||||
        if [ -f "$__object/parameter/experimental" ]; then
 | 
			
		||||
          component="experimental"
 | 
			
		||||
        fi
 | 
			
		||||
        __yum_repo docker \
 | 
			
		||||
          --name 'Docker Repository' \
 | 
			
		||||
          --baseurl "https://yum.dockerproject.org/repo/$component/centos/\$releasever/" \
 | 
			
		||||
          --enabled \
 | 
			
		||||
          --gpgcheck 1 \
 | 
			
		||||
          --gpgkey 'https://yum.dockerproject.org/gpg' \
 | 
			
		||||
          --state ${state} 
 | 
			
		||||
        require="__yum_repo/docker" __package docker-engine --state ${state}
 | 
			
		||||
    ;;
 | 
			
		||||
    ubuntu)
 | 
			
		||||
        component="main"
 | 
			
		||||
      if [ -f "$__object/parameter/experimental" ]; then
 | 
			
		||||
         component="experimental"
 | 
			
		||||
      fi
 | 
			
		||||
      __package apparmor --state ${state}
 | 
			
		||||
      __package ca-certificates --state ${state}
 | 
			
		||||
      __package apt-transport-https --state ${state}
 | 
			
		||||
      __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D --state ${state}
 | 
			
		||||
      export CDIST_ORDER_DEPENDENCY=on
 | 
			
		||||
      __apt_source docker \
 | 
			
		||||
         --uri https://apt.dockerproject.org/repo \
 | 
			
		||||
         --distribution "ubuntu-$(cat "$__global/explorer/lsb_codename")" \
 | 
			
		||||
         --state ${state} \
 | 
			
		||||
         --component "$component"
 | 
			
		||||
      __package docker-engine --state ${state}
 | 
			
		||||
      unset CDIST_ORDER_DEPENDENCY
 | 
			
		||||
   ;;
 | 
			
		||||
   debian)
 | 
			
		||||
       component="main"
 | 
			
		||||
      if [ -f "$__object/parameter/experimental" ]; then
 | 
			
		||||
         component="experimental"
 | 
			
		||||
      fi
 | 
			
		||||
 | 
			
		||||
      __package apt-transport-https --state ${state}
 | 
			
		||||
      __package ca-certificates --state ${state}
 | 
			
		||||
      __package gnupg2 --state ${state}
 | 
			
		||||
      __apt_key docker --keyid 58118E89F3A912897C070ADBF76221572C52609D --state ${state}
 | 
			
		||||
      export CDIST_ORDER_DEPENDENCY=on
 | 
			
		||||
      __apt_source docker \
 | 
			
		||||
          --uri https://apt.dockerproject.org/repo \
 | 
			
		||||
          --distribution "debian-$(cat "$__global/explorer/lsb_codename")" \
 | 
			
		||||
          --state ${state} \
 | 
			
		||||
          --component "$component"
 | 
			
		||||
      __package docker-engine --state ${state}
 | 
			
		||||
      unset CDIST_ORDER_DEPENDENCY
 | 
			
		||||
 | 
			
		||||
   ;;
 | 
			
		||||
   *)
 | 
			
		||||
      echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
 | 
			
		||||
      echo "Please contribute an implementation for it if you can." >&2
 | 
			
		||||
      exit 1
 | 
			
		||||
   ;;
 | 
			
		||||
esac
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker/parameter/boolean
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
experimental
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
present
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
state
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__docker/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__docker/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										31
									
								
								cdist/conf/type/__docker_compose/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								cdist/conf/type/__docker_compose/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Dominique Roux (dominique.roux at ungleich.ch)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# Variables
 | 
			
		||||
version="$(cat "$__object/parameter/version")"
 | 
			
		||||
state="$(cat "$__object/parameter/state")"
 | 
			
		||||
 | 
			
		||||
if [ ${state} = "present" ]; then
 | 
			
		||||
    # Download docker-compose file
 | 
			
		||||
        echo 'curl -L "https://github.com/docker/compose/releases/download/'${version}'/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose'
 | 
			
		||||
        echo 'mv /tmp/docker-compose /usr/local/bin/docker-compose'
 | 
			
		||||
    # Change permissions
 | 
			
		||||
    echo 'chmod +x /usr/local/bin/docker-compose'
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										58
									
								
								cdist/conf/type/__docker_compose/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								cdist/conf/type/__docker_compose/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
cdist-type__docker_compose(7)
 | 
			
		||||
=============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__docker_compose - install docker-compose
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Installs docker-compose package.
 | 
			
		||||
State 'absent' will not remove docker binary itself,
 | 
			
		||||
only docker-compose binary will be removed
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
version
 | 
			
		||||
   Define docker_compose version, defaults to "1.9.0" 
 | 
			
		||||
 | 
			
		||||
state
 | 
			
		||||
   'present' or 'absent', defaults to 'present'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOLEAN PARAMETERS
 | 
			
		||||
------------------
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # Install docker-compose
 | 
			
		||||
    __docker_compose
 | 
			
		||||
 | 
			
		||||
    # Install version 1.9.0-rc4
 | 
			
		||||
    __docker_compose --version 1.9.0-rc4
 | 
			
		||||
 | 
			
		||||
    # Remove docker-compose 
 | 
			
		||||
    __docker_compose --state absent
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Dominique Roux <dominique.roux--@--ungleich.ch>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2016 Dominique Roux. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 or later (GPLv3+).
 | 
			
		||||
							
								
								
									
										33
									
								
								cdist/conf/type/__docker_compose/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								cdist/conf/type/__docker_compose/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Dominique Roux (dominique.roux at ungleich.ch)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
state="$(cat "$__object/parameter/state")"
 | 
			
		||||
 | 
			
		||||
# Needed packages
 | 
			
		||||
if [ ${state} = "present" ]; then
 | 
			
		||||
    __docker
 | 
			
		||||
    __package curl
 | 
			
		||||
elif [ ${state} = "absent" ]; then
 | 
			
		||||
    __file /usr/local/bin/docker-compose --state absent
 | 
			
		||||
else
 | 
			
		||||
    echo "Unknown state: ${state}" >&2
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__docker_compose/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__docker_compose/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
present
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
1.9.0
 | 
			
		||||
							
								
								
									
										2
									
								
								cdist/conf/type/__docker_compose/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__docker_compose/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
state
 | 
			
		||||
version
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__docker_compose/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__docker_compose/singleton
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -66,8 +66,15 @@ destination_upload="\$($__remote_exec $__target_host "mktemp $tempfile_template"
 | 
			
		|||
DONE
 | 
			
		||||
      if [ "$upload_file" ]; then
 | 
			
		||||
         echo upload >> "$__messages_out"
 | 
			
		||||
         # IPv6 fix
 | 
			
		||||
         if $(echo "${__target_host}" | grep -q -E '^[0-9a-fA-F:]+$')
 | 
			
		||||
         then
 | 
			
		||||
             my_target_host="[${__target_host}]"
 | 
			
		||||
         else
 | 
			
		||||
             my_target_host="${__target_host}"
 | 
			
		||||
         fi
 | 
			
		||||
         cat << DONE
 | 
			
		||||
$__remote_copy "$source" "${__target_host}:\$destination_upload"
 | 
			
		||||
$__remote_copy "$source" "${my_target_host}:\$destination_upload"
 | 
			
		||||
DONE
 | 
			
		||||
      fi
 | 
			
		||||
# move uploaded file into place
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ device
 | 
			
		|||
    |    or /dev/mapper/xxxx
 | 
			
		||||
 | 
			
		||||
label
 | 
			
		||||
   Label which sould apply on the filesystem.
 | 
			
		||||
   Label which should be applied on the filesystem.
 | 
			
		||||
 | 
			
		||||
mkfsoptions
 | 
			
		||||
   Additional options which are inserted to the mkfs.xxx call.
 | 
			
		||||
| 
						 | 
				
			
			@ -46,15 +46,15 @@ mkfsoptions
 | 
			
		|||
BOOLEAN PARAMETERS
 | 
			
		||||
------------------
 | 
			
		||||
force
 | 
			
		||||
   Normaly, this type does nothing if a filesystem is found
 | 
			
		||||
   on the target device. If you specify force, it's formated
 | 
			
		||||
   Normally, this type does nothing if a filesystem is found
 | 
			
		||||
   on the target device. If you specify force, it's formatted
 | 
			
		||||
   if the filesystem type or label differs from parameters.
 | 
			
		||||
   Warning: This option can easily lead into data loss!
 | 
			
		||||
 | 
			
		||||
MESSAGES
 | 
			
		||||
--------
 | 
			
		||||
filesystem <fstype> on <device> \: <discoverd device> created
 | 
			
		||||
   Filesytem was created on <discoverd device>
 | 
			
		||||
   Filesystem was created on <discoverd device>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ EXAMPLES
 | 
			
		|||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # Ensures that device /dev/sdb is formated with xfs 
 | 
			
		||||
    # Ensures that device /dev/sdb is formatted with xfs
 | 
			
		||||
    __filesystem /dev/sdb --fstype xfs --label Testdisk1
 | 
			
		||||
    # The same thing with btrfs and disk spezified by pci path to disk 1:0 on vmware
 | 
			
		||||
    __filesystem dev_sdb --fstype btrfs --device /dev/disk/by-path/pci-0000:0b:00.0-scsi-0:0:0:0 --label Testdisk2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										84
									
								
								cdist/conf/type/__firewalld_start/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										84
									
								
								cdist/conf/type/__firewalld_start/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,84 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Darko Poljak(darko.poljak at ungleich.ch)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
startstate="$(cat "$__object/parameter/startstate")"
 | 
			
		||||
init=$(cat "$__global/explorer/init")
 | 
			
		||||
 | 
			
		||||
os=$(cat "$__global/explorer/os")
 | 
			
		||||
os_version=$(cat "$__global/explorer/os_version")
 | 
			
		||||
name="firewalld"
 | 
			
		||||
 | 
			
		||||
case "${startstate}" in
 | 
			
		||||
    present)
 | 
			
		||||
        cmd="start"
 | 
			
		||||
        ;;
 | 
			
		||||
    absent)
 | 
			
		||||
        cmd="stop"
 | 
			
		||||
        ;;
 | 
			
		||||
    *)
 | 
			
		||||
        echo "Unknown startstate: ${startstate}" >&2
 | 
			
		||||
        exit 1
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if [ "$init" = 'systemd' ]; then
 | 
			
		||||
    # this handles ALL linux distros with systemd
 | 
			
		||||
    # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
 | 
			
		||||
    echo "systemctl \"$cmd\" \"$name\""
 | 
			
		||||
else
 | 
			
		||||
    case "$os" in
 | 
			
		||||
        debian)
 | 
			
		||||
            case "$os_version" in
 | 
			
		||||
                [1-7]*)
 | 
			
		||||
                    echo "service \"$name\" \"$cmd\""
 | 
			
		||||
                ;;
 | 
			
		||||
                8*)
 | 
			
		||||
                    echo "systemctl \"$cmd\" \"$name\""
 | 
			
		||||
                ;;
 | 
			
		||||
                *)
 | 
			
		||||
                    echo "Unsupported version $os_version of $os" >&2
 | 
			
		||||
                    exit 1
 | 
			
		||||
                ;;
 | 
			
		||||
            esac
 | 
			
		||||
        ;;
 | 
			
		||||
 | 
			
		||||
        gentoo)
 | 
			
		||||
            echo service \"$name\" \"$cmd\"
 | 
			
		||||
        ;;
 | 
			
		||||
 | 
			
		||||
        amazon|scientific|centos|fedora|owl|redhat|suse)
 | 
			
		||||
            echo service \"$name\" \"$cmd\"
 | 
			
		||||
        ;;
 | 
			
		||||
 | 
			
		||||
        openwrt)
 | 
			
		||||
            echo "/etc/init.d/\"$name\" \"$cmd\""
 | 
			
		||||
        ;;
 | 
			
		||||
 | 
			
		||||
        ubuntu)
 | 
			
		||||
            echo "service \"$name\" \"$cmd\""
 | 
			
		||||
        ;;
 | 
			
		||||
 | 
			
		||||
        *)
 | 
			
		||||
           echo "Unsupported os: $os" >&2
 | 
			
		||||
           exit 1
 | 
			
		||||
        ;;
 | 
			
		||||
    esac
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										53
									
								
								cdist/conf/type/__firewalld_start/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								cdist/conf/type/__firewalld_start/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
cdist-type__firewalld_start(7)
 | 
			
		||||
==============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__firewalld_start - start and enable firewalld
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
This cdist type allows you to start and enable firewalld.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
startstate
 | 
			
		||||
    'present' or 'absent', start/stop firewalld. Default is 'present'.
 | 
			
		||||
bootstate
 | 
			
		||||
    'present' or 'absent', enable/disable firewalld on boot. Default is 'present'.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # start and enable firewalld
 | 
			
		||||
    __firewalld_start
 | 
			
		||||
 | 
			
		||||
    # only enable firewalld to start on boot
 | 
			
		||||
    __firewalld_start --startstate present --bootstate absent
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
:strong:`firewalld`\ (8)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Darko Poljak <darko.poljak--@--ungleich.ch>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2016 Darko Poljak. 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.
 | 
			
		||||
							
								
								
									
										23
									
								
								cdist/conf/type/__firewalld_start/manifest
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								cdist/conf/type/__firewalld_start/manifest
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2016 Darko Poljak (darko.poljak at ungleich.ch)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
 | 
			
		||||
bootstate="$(cat "$__object/parameter/bootstate")"
 | 
			
		||||
 | 
			
		||||
__package firewalld
 | 
			
		||||
require="__package/firewalld" __start_on_boot firewalld --state "${bootstate}"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
present
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
present
 | 
			
		||||
							
								
								
									
										2
									
								
								cdist/conf/type/__firewalld_start/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__firewalld_start/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
bootstate
 | 
			
		||||
startstate
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__firewalld_start/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__firewalld_start/singleton
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -44,7 +44,7 @@ EXAMPLES
 | 
			
		|||
    __git /home/services/dokuwiki --source git://github.com/splitbrain/dokuwiki.git
 | 
			
		||||
 | 
			
		||||
    # Checkout cdist, stay on branch 2.1
 | 
			
		||||
    __git /home/nico/cdist --source git://github.com/telmich/cdist.git --branch 2.1
 | 
			
		||||
    __git /home/nico/cdist --source git://github.com/ungleich/cdist.git --branch 2.1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@ case "$os" in
 | 
			
		|||
            exit 0
 | 
			
		||||
        fi
 | 
			
		||||
    ;;
 | 
			
		||||
    scientific|centos)
 | 
			
		||||
    scientific|centos|openbsd)
 | 
			
		||||
        if [ "$name_sysconfig" = "$name_should" -a "$name_running" = "$name_should" ]; then
 | 
			
		||||
            exit 0
 | 
			
		||||
        fi
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ else
 | 
			
		|||
            echo "hostname '$name_should'"
 | 
			
		||||
            echo "printf '%s\n' '$name_should' > /etc/hostname"
 | 
			
		||||
        ;;
 | 
			
		||||
        centos)
 | 
			
		||||
        centos|openbsd)
 | 
			
		||||
            echo "hostname '$name_should'"
 | 
			
		||||
        ;;
 | 
			
		||||
        suse)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,14 @@ os=$(cat "$__global/explorer/os")
 | 
			
		|||
if [ -f "$__object/parameter/name" ]; then
 | 
			
		||||
    name_should="$(cat "$__object/parameter/name")"
 | 
			
		||||
else
 | 
			
		||||
    case "$os" in
 | 
			
		||||
    openbsd)
 | 
			
		||||
        name_should="$(echo "${__target_host}")"
 | 
			
		||||
    ;;
 | 
			
		||||
    *)
 | 
			
		||||
        name_should="$(echo "${__target_host%%.*}")"
 | 
			
		||||
    ;;
 | 
			
		||||
    esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -45,6 +52,9 @@ case "$os" in
 | 
			
		|||
            --key HOSTNAME \
 | 
			
		||||
            --value "$name_should" --exact_delimiter
 | 
			
		||||
    ;;
 | 
			
		||||
    openbsd)
 | 
			
		||||
        echo "$name_should" | __file /etc/myname --source -
 | 
			
		||||
    ;;
 | 
			
		||||
    *)
 | 
			
		||||
        not_supported
 | 
			
		||||
    ;;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										73
									
								
								cdist/conf/type/__install_bootloader_grub/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										73
									
								
								cdist/conf/type/__install_bootloader_grub/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,73 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
device="$(cat "$__object/parameter/device")"
 | 
			
		||||
chroot="$(cat "$__object/parameter/chroot")"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cat << DONE
 | 
			
		||||
os=\$(
 | 
			
		||||
if grep -q ^DISTRIB_ID=Ubuntu ${chroot}/etc/lsb-release 2>/dev/null; then
 | 
			
		||||
   echo ubuntu
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -f ${chroot}/etc/arch-release ]; then
 | 
			
		||||
   echo archlinux
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ -f ${chroot}/etc/debian_version ]; then
 | 
			
		||||
   echo debian
 | 
			
		||||
   exit 0
 | 
			
		||||
fi
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# Ensure /tmp exists
 | 
			
		||||
[ -d "${chroot}/tmp" ] || mkdir -m 1777 "${chroot}/tmp"
 | 
			
		||||
# Generate script to run in chroot
 | 
			
		||||
script=\$(mktemp "${chroot}/tmp/__install_bootloader_grub.XXXXXXXXXX")
 | 
			
		||||
# Link file descriptor #6 with stdout
 | 
			
		||||
exec 6>&1
 | 
			
		||||
# Link stdout with \$script
 | 
			
		||||
exec > \$script
 | 
			
		||||
 | 
			
		||||
echo "#!/bin/sh -l"
 | 
			
		||||
echo "grub-install $device"
 | 
			
		||||
case \$os in
 | 
			
		||||
   archlinux)
 | 
			
		||||
      # bugfix/workarround: rebuild initramfs
 | 
			
		||||
      # FIXME: doesn't belong here
 | 
			
		||||
      echo "mkinitcpio -p linux"
 | 
			
		||||
      echo "grub-mkconfig -o /boot/grub/grub.cfg"
 | 
			
		||||
   ;;
 | 
			
		||||
   ubuntu|debian) echo "update-grub" ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
# Restore stdout and close file descriptor #6.
 | 
			
		||||
exec 1>&6 6>&-
 | 
			
		||||
 | 
			
		||||
# Make script executable
 | 
			
		||||
chmod +x "\$script"
 | 
			
		||||
 | 
			
		||||
# Run script in chroot
 | 
			
		||||
relative_script="\${script#$chroot}"
 | 
			
		||||
chroot "$chroot" "\$relative_script"
 | 
			
		||||
DONE
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_bootloader_grub/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_bootloader_grub/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										48
									
								
								cdist/conf/type/__install_bootloader_grub/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								cdist/conf/type/__install_bootloader_grub/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
cdist-type__install_bootloader_grub(7)
 | 
			
		||||
======================================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_bootloader_grub - install grub2 bootloader on given disk
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
This cdist type allows you to install grub2 bootloader on given disk.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
device
 | 
			
		||||
   The device to install grub to. Defaults to object_id
 | 
			
		||||
 | 
			
		||||
chroot
 | 
			
		||||
   where to chroot before running grub-install. Defaults to /target.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_bootloader_grub /dev/sda
 | 
			
		||||
 | 
			
		||||
    __install_bootloader_grub /dev/sda --chroot /mnt/foobar
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										25
									
								
								cdist/conf/type/__install_bootloader_grub/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								cdist/conf/type/__install_bootloader_grub/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,25 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# set defaults
 | 
			
		||||
device="$(cat "$__object/parameter/device" 2>/dev/null \
 | 
			
		||||
   || echo "/$__object_id" | tee "$__object/parameter/device")"
 | 
			
		||||
chroot="$(cat "$__object/parameter/chroot" 2>/dev/null \
 | 
			
		||||
   || echo "/target" | tee "$__object/parameter/chroot")"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
device
 | 
			
		||||
chroot
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_chroot_mount/gencode-remote
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_chroot_mount/gencode-remote
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../__chroot_mount/gencode-remote
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_chroot_mount/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_chroot_mount/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										42
									
								
								cdist/conf/type/__install_chroot_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								cdist/conf/type/__install_chroot_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
cdist-type__install_chroot_mount(7)
 | 
			
		||||
===================================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_chroot_mount - mount a chroot with install command
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Mount and prepare a chroot for running commands within it.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_chroot_mount /path/to/chroot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2012 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_chroot_umount/gencode-remote
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_chroot_umount/gencode-remote
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../__chroot_umount/gencode-remote
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_chroot_umount/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_chroot_umount/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										47
									
								
								cdist/conf/type/__install_chroot_umount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								cdist/conf/type/__install_chroot_umount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
cdist-type__install_chroot_umount(7)
 | 
			
		||||
====================================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_chroot_umount - unmount a chroot mounted by __install_chroot_mount
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Undo what __install_chroot_mount did.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_chroot_umount /path/to/chroot
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
:strong:`cdist-type__install_chroot_mount`\ (7)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2012 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										48
									
								
								cdist/conf/type/__install_config/files/remote/copy
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										48
									
								
								cdist/conf/type/__install_config/files/remote/copy
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# __remote_copy script to run cdist against a chroot on a remote host via ssh.
 | 
			
		||||
#
 | 
			
		||||
# Usage:
 | 
			
		||||
#  __remote_copy="/path/to/this/script /path/to/your/chroot" cdist config target-id
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
log() {
 | 
			
		||||
   echo "$@" | logger -t "__install_config copy"
 | 
			
		||||
   :
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
chroot="$1"; shift
 | 
			
		||||
target_host="$__target_host"
 | 
			
		||||
 | 
			
		||||
scp="scp -o User=root -q"
 | 
			
		||||
 | 
			
		||||
# postfix target_host with chroot location
 | 
			
		||||
code="$(echo "$@" | sed "s|$target_host:|$target_host:$chroot|g")"
 | 
			
		||||
 | 
			
		||||
log "target_host: $target_host"
 | 
			
		||||
log "chroot: $chroot"
 | 
			
		||||
log "@: $@"
 | 
			
		||||
log "code: $code"
 | 
			
		||||
 | 
			
		||||
# copy files into chroot
 | 
			
		||||
$scp $code
 | 
			
		||||
 | 
			
		||||
log "-----"
 | 
			
		||||
							
								
								
									
										48
									
								
								cdist/conf/type/__install_config/files/remote/exec
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										48
									
								
								cdist/conf/type/__install_config/files/remote/exec
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# __remote_exec script to run cdist against a chroot on a remote host via ssh.
 | 
			
		||||
#
 | 
			
		||||
# Usage:
 | 
			
		||||
#  __remote_exec="/path/to/this/script /path/to/your/chroot" cdist config target-id
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
log() {
 | 
			
		||||
   echo "$@" | logger -t "__install_config exec"
 | 
			
		||||
   :
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
chroot="$1"; shift
 | 
			
		||||
target_host="$__target_host"
 | 
			
		||||
# In exec mode the first argument is the __target_host which we already got from env. Get rid of it.
 | 
			
		||||
shift
 | 
			
		||||
 | 
			
		||||
ssh="ssh -o User=root -q $target_host"
 | 
			
		||||
code="$ssh chroot $chroot sh -c '$@'"
 | 
			
		||||
 | 
			
		||||
log "target_host: $target_host"
 | 
			
		||||
log "chroot: $chroot"
 | 
			
		||||
log "@: $@"
 | 
			
		||||
log "code: $code"
 | 
			
		||||
 | 
			
		||||
# Run the code
 | 
			
		||||
$code
 | 
			
		||||
 | 
			
		||||
log "-----"
 | 
			
		||||
							
								
								
									
										50
									
								
								cdist/conf/type/__install_config/gencode-local
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										50
									
								
								cdist/conf/type/__install_config/gencode-local
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
chroot="$(cat "$__object/parameter/chroot")"
 | 
			
		||||
remote_exec="$__type/files/remote/exec"
 | 
			
		||||
remote_copy="$__type/files/remote/copy"
 | 
			
		||||
 | 
			
		||||
cdist_args="-v"
 | 
			
		||||
[ "$__debug" = "yes" ] && cdist_args="$cdist_args -d"
 | 
			
		||||
 | 
			
		||||
cat << DONE
 | 
			
		||||
#echo "__apt_noautostart --state present" \
 | 
			
		||||
#   | cdist $cdist_args \
 | 
			
		||||
#      config \
 | 
			
		||||
#      --initial-manifest - \
 | 
			
		||||
#      --remote-exec="$remote_exec $chroot" \
 | 
			
		||||
#      --remote-copy="$remote_copy $chroot" \
 | 
			
		||||
#      $__target_host
 | 
			
		||||
 | 
			
		||||
cdist $cdist_args \
 | 
			
		||||
   config \
 | 
			
		||||
   --remote-exec="$remote_exec $chroot" \
 | 
			
		||||
   --remote-copy="$remote_copy $chroot" \
 | 
			
		||||
   $__target_host
 | 
			
		||||
 | 
			
		||||
#echo "__apt_noautostart --state absent" \
 | 
			
		||||
#   | cdist $cdist_args \
 | 
			
		||||
#      config \
 | 
			
		||||
#      --initial-manifest - \
 | 
			
		||||
#      --remote-exec="$remote_exec $chroot" \
 | 
			
		||||
#      --remote-copy="$remote_copy $chroot" \
 | 
			
		||||
#      $__target_host
 | 
			
		||||
DONE
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_config/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_config/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										47
									
								
								cdist/conf/type/__install_config/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								cdist/conf/type/__install_config/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
cdist-type__install_config(7)
 | 
			
		||||
=============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_config - run cdist config as part of the installation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
This cdist type allows you to run cdist config as part of the installation.
 | 
			
		||||
It does this by using a custom __remote_{copy,exec} prefix which runs
 | 
			
		||||
cdist config against the /target chroot on the remote host.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
chroot
 | 
			
		||||
   where to chroot before running grub-install. Defaults to /target.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_config
 | 
			
		||||
 | 
			
		||||
    __install_config --chroot /mnt/somewhere
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										23
									
								
								cdist/conf/type/__install_config/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								cdist/conf/type/__install_config/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# set defaults
 | 
			
		||||
chroot="$(cat "$__object/parameter/chroot" 2>/dev/null \
 | 
			
		||||
   || echo "/target" | tee "$__object/parameter/chroot")"
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_config/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_config/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
chroot
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_config/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_config/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										1
									
								
								cdist/conf/type/__install_file/explorer
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_file/explorer
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../__file/explorer
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_file/gencode-local
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_file/gencode-local
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../__file/gencode-local
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_file/gencode-remote
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_file/gencode-remote
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../__file/gencode-remote
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_file/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_file/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										112
									
								
								cdist/conf/type/__install_file/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								cdist/conf/type/__install_file/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,112 @@
 | 
			
		|||
cdist-type__install_file(7)
 | 
			
		||||
===========================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_file - Manage files with install command.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
This cdist type allows you to create files, remove files and set file
 | 
			
		||||
attributes on the target.
 | 
			
		||||
 | 
			
		||||
If the file already exists on the target, then if it is a:
 | 
			
		||||
 | 
			
		||||
regular file, and state is:
 | 
			
		||||
  present
 | 
			
		||||
    replace it with the source file if they are not equal
 | 
			
		||||
  exists
 | 
			
		||||
    do nothing
 | 
			
		||||
symlink
 | 
			
		||||
  replace it with the source file
 | 
			
		||||
directory
 | 
			
		||||
  replace it with the source file
 | 
			
		||||
 | 
			
		||||
In any case, make sure that the file attributes are as specified.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None.
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
state
 | 
			
		||||
   'present', 'absent' or 'exists', defaults to 'present' where:
 | 
			
		||||
 | 
			
		||||
   present
 | 
			
		||||
      the file is exactly the one from source
 | 
			
		||||
   absent
 | 
			
		||||
      the file does not exist
 | 
			
		||||
   exists
 | 
			
		||||
      the file from source but only if it doesn't already exist
 | 
			
		||||
 | 
			
		||||
group
 | 
			
		||||
   Group to chgrp to.
 | 
			
		||||
 | 
			
		||||
mode
 | 
			
		||||
   Unix permissions, suitable for chmod.
 | 
			
		||||
 | 
			
		||||
owner
 | 
			
		||||
   User to chown to.
 | 
			
		||||
 | 
			
		||||
source
 | 
			
		||||
   If supplied, copy this file from the host running cdist to the target.
 | 
			
		||||
   If not supplied, an empty file or directory will be created.
 | 
			
		||||
   If source is '-' (dash), take what was written to stdin as the file content.
 | 
			
		||||
 | 
			
		||||
MESSAGES
 | 
			
		||||
--------
 | 
			
		||||
chgrp <group>
 | 
			
		||||
   Changed group membership
 | 
			
		||||
chown <owner>
 | 
			
		||||
   Changed owner
 | 
			
		||||
chmod <mode>
 | 
			
		||||
   Changed mode
 | 
			
		||||
create
 | 
			
		||||
   Empty file was created (no --source specified)
 | 
			
		||||
remove
 | 
			
		||||
   File exists, but state is absent, file will be removed by generated code.
 | 
			
		||||
upload
 | 
			
		||||
   File was uploaded
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # Create  /etc/cdist-configured as an empty file
 | 
			
		||||
    __install_file /etc/cdist-configured
 | 
			
		||||
    # The same thing
 | 
			
		||||
    __install_file /etc/cdist-configured --state present
 | 
			
		||||
    # Use __file from another type
 | 
			
		||||
    __install_file /etc/issue --source "$__type/files/archlinux" --state present
 | 
			
		||||
    # Delete existing file
 | 
			
		||||
    __install_file /etc/cdist-configured --state absent
 | 
			
		||||
    # Supply some more settings
 | 
			
		||||
    __install_file /etc/shadow --source "$__type/files/shadow" \
 | 
			
		||||
       --owner root --group shadow --mode 0640 \
 | 
			
		||||
       --state present
 | 
			
		||||
    # Provide a default file, but let the user change it
 | 
			
		||||
    __install_file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
 | 
			
		||||
       --state exists \
 | 
			
		||||
       --owner frodo --mode 0600
 | 
			
		||||
    # Take file content from stdin
 | 
			
		||||
    __install_file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
 | 
			
		||||
        Here goes the content for /tmp/whatever
 | 
			
		||||
    DONE
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Nico Schottelius <nico-cdist--@--schottelius.org>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011-2013 Nico Schottelius. 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.
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_file/parameter
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_file/parameter
									
										
									
									
									
										Symbolic link
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
../__file/parameter
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_fstab/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_fstab/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										53
									
								
								cdist/conf/type/__install_fstab/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								cdist/conf/type/__install_fstab/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
cdist-type__install_fstab(7)
 | 
			
		||||
============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_fstab - generate /etc/fstab during installation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Uses __install_generate_fstab to generate a /etc/fstab file and uploads it
 | 
			
		||||
to the target machine at ${prefix}/etc/fstab.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
prefix
 | 
			
		||||
   The prefix under which to generate the /etc/fstab file.
 | 
			
		||||
   Defaults to /target.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_fstab
 | 
			
		||||
 | 
			
		||||
    __install_fstab --prefix /mnt/target
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
:strong:`cdist-type__install_generate_fstab`\ (7),
 | 
			
		||||
:strong:`cdist-type__install_mount`\ (7)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										29
									
								
								cdist/conf/type/__install_fstab/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								cdist/conf/type/__install_fstab/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,29 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
prefix="$(cat "$__object/parameter/prefix" 2>/dev/null || echo "/target")"
 | 
			
		||||
 | 
			
		||||
[ -d "$__object/files" ] || mkdir "$__object/files"
 | 
			
		||||
__install_generate_fstab --uuid --destination "$__object/files/fstab"
 | 
			
		||||
require="__install_generate_fstab" \
 | 
			
		||||
   __install_file "${prefix}/etc/fstab" --source "$__object/files/fstab" \
 | 
			
		||||
      --mode 644 \
 | 
			
		||||
      --owner root \
 | 
			
		||||
      --group root
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_fstab/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_fstab/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
file
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_fstab/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_fstab/singleton
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
# Generated by cdist __install_generate_fstab
 | 
			
		||||
							
								
								
									
										59
									
								
								cdist/conf/type/__install_generate_fstab/gencode-local
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										59
									
								
								cdist/conf/type/__install_generate_fstab/gencode-local
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,59 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
destination="$(cat "$__object/parameter/destination")"
 | 
			
		||||
cat "$__type/files/fstab.header" > "$destination"
 | 
			
		||||
 | 
			
		||||
mkdir "$__object/files"
 | 
			
		||||
# get current UUID's from target_host
 | 
			
		||||
$__remote_exec $__target_host blkid > "$__object/files/blkid"
 | 
			
		||||
 | 
			
		||||
for object in $(find "$__global/object/__install_mount" -path "*.cdist"); do
 | 
			
		||||
   device="$(cat "$object/parameter/device")"
 | 
			
		||||
   dir="$(cat "$object/parameter/dir")"
 | 
			
		||||
   prefix="$(cat "$object/parameter/prefix")"
 | 
			
		||||
   type="$(cat "$object/parameter/type")"
 | 
			
		||||
   if [ -f "$object/parameter/options" ]; then
 | 
			
		||||
      options="$(cat "$object/parameter/options")"
 | 
			
		||||
   else
 | 
			
		||||
      options="defaults"
 | 
			
		||||
   fi
 | 
			
		||||
   dump=0
 | 
			
		||||
   case "$type" in
 | 
			
		||||
      swap)
 | 
			
		||||
         pass=0
 | 
			
		||||
         dir="$type"
 | 
			
		||||
      ;;
 | 
			
		||||
      tmpfs)
 | 
			
		||||
         pass=0
 | 
			
		||||
      ;;
 | 
			
		||||
      *)
 | 
			
		||||
         pass=1
 | 
			
		||||
      ;;
 | 
			
		||||
   esac
 | 
			
		||||
   if [ -f "$__object/parameter/uuid" ]; then
 | 
			
		||||
      uuid="$(grep -w $device "$__object/files/blkid" | awk '{print $2}')"
 | 
			
		||||
      if [ -n "$uuid" ]; then
 | 
			
		||||
         echo "# $dir was on $device during installation" >> "$destination"
 | 
			
		||||
         device="$uuid"
 | 
			
		||||
      fi
 | 
			
		||||
   fi
 | 
			
		||||
   echo "$device $dir $type $options $dump $pass" >> "$destination"
 | 
			
		||||
done
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_generate_fstab/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_generate_fstab/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										53
									
								
								cdist/conf/type/__install_generate_fstab/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								cdist/conf/type/__install_generate_fstab/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
cdist-type__install_generate_fstab(7)
 | 
			
		||||
=====================================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_generate_fstab - generate /etc/fstab during installation
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Generates a /etc/fstab file from information retrieved from
 | 
			
		||||
__install_mount definitions.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
destination
 | 
			
		||||
   The path where to store the generated fstab file.
 | 
			
		||||
   Note that this is a path on the server, where cdist is running, not the target host.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
BOOLEAN PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
uuid
 | 
			
		||||
   use UUID instead of device in fstab 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_generate_fstab --destination /path/where/you/want/fstab
 | 
			
		||||
 | 
			
		||||
    __install_generate_fstab --uuid --destination /path/where/you/want/fstab
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2012 Steven Armstrong. 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.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
uuid
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
destination
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_generate_fstab/singleton
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_generate_fstab/singleton
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										53
									
								
								cdist/conf/type/__install_mkfs/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										53
									
								
								cdist/conf/type/__install_mkfs/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,53 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
device="$(cat "$__object/parameter/device")"
 | 
			
		||||
type="$(cat "$__object/parameter/type")"
 | 
			
		||||
 | 
			
		||||
case "$type" in
 | 
			
		||||
   swap)
 | 
			
		||||
      echo "mkswap $device"
 | 
			
		||||
   ;;
 | 
			
		||||
   xfs)
 | 
			
		||||
      command="mkfs.xfs -f -q"
 | 
			
		||||
      if [ -f "$__object/parameter/options" ]; then
 | 
			
		||||
         options="$(cat "$__object/parameter/options")"
 | 
			
		||||
         command="$command $options"
 | 
			
		||||
      fi
 | 
			
		||||
      command="$command $device"
 | 
			
		||||
      if [ -f "$__object/parameter/blocks" ]; then
 | 
			
		||||
         blocks="$(cat "$__object/parameter/blocks")"
 | 
			
		||||
         command="$command $blocks"
 | 
			
		||||
      fi
 | 
			
		||||
      echo "$command"
 | 
			
		||||
   ;;
 | 
			
		||||
   *)
 | 
			
		||||
      command="mkfs -t $type -q"
 | 
			
		||||
      if [ -f "$__object/parameter/options" ]; then
 | 
			
		||||
         options="$(cat "$__object/parameter/options")"
 | 
			
		||||
         command="$command $options"
 | 
			
		||||
      fi
 | 
			
		||||
      command="$command $device"
 | 
			
		||||
      if [ -f "$__object/parameter/blocks" ]; then
 | 
			
		||||
         blocks="$(cat "$__object/parameter/blocks")"
 | 
			
		||||
         command="$command $blocks"
 | 
			
		||||
      fi
 | 
			
		||||
      echo "$command"
 | 
			
		||||
esac
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_mkfs/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_mkfs/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										62
									
								
								cdist/conf/type/__install_mkfs/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								cdist/conf/type/__install_mkfs/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
cdist-type__install_mkfs(7)
 | 
			
		||||
===========================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_mkfs - build a linux file system
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
This cdist type is a wrapper for the mkfs command.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
type
 | 
			
		||||
   The filesystem type to use. Same as used with mkfs -t.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
device
 | 
			
		||||
   defaults to object_id
 | 
			
		||||
 | 
			
		||||
options
 | 
			
		||||
   file system-specific options to be passed to the mkfs command
 | 
			
		||||
 | 
			
		||||
blocks
 | 
			
		||||
   the number of blocks to be used for the file system
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    # reiserfs /dev/sda5
 | 
			
		||||
    __install_mkfs /dev/sda5 --type reiserfs
 | 
			
		||||
 | 
			
		||||
    # same thing with explicit device
 | 
			
		||||
    __install_mkfs whatever --device /dev/sda5 --type reiserfs
 | 
			
		||||
 | 
			
		||||
    # jfs with journal on /dev/sda2
 | 
			
		||||
    __install_mkfs /dev/sda1 --type jfs --options "-j /dev/sda2"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
:strong:`mkfs`\ (8)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Steven Armstrong. 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.
 | 
			
		||||
							
								
								
									
										31
									
								
								cdist/conf/type/__install_mkfs/manifest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								cdist/conf/type/__install_mkfs/manifest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# set defaults
 | 
			
		||||
if [ -f "$__object/parameter/device" ]; then
 | 
			
		||||
   device="(cat "$__object/parameter/device")"
 | 
			
		||||
else
 | 
			
		||||
   device="/$__object_id"
 | 
			
		||||
   echo "$device" > "$__object/parameter/device"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
type="(cat "$__object/parameter/type")"
 | 
			
		||||
 | 
			
		||||
options="(cat "$__object/parameter/options")"
 | 
			
		||||
							
								
								
									
										3
									
								
								cdist/conf/type/__install_mkfs/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								cdist/conf/type/__install_mkfs/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
device
 | 
			
		||||
options
 | 
			
		||||
blocks
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__install_mkfs/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__install_mkfs/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
type
 | 
			
		||||
							
								
								
									
										59
									
								
								cdist/conf/type/__install_mount/gencode-remote
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										59
									
								
								cdist/conf/type/__install_mount/gencode-remote
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,59 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
 | 
			
		||||
#
 | 
			
		||||
# 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
get_type_from_mkfs() {
 | 
			
		||||
   _device="$1"
 | 
			
		||||
   for mkfs_object in $(find "$__global/object/__install_mkfs" -path "*.cdist"); do
 | 
			
		||||
      mkfs_device="$(cat "$mkfs_object/parameter/device")"
 | 
			
		||||
      if [ "$_device" = "$mkfs_device" ]; then
 | 
			
		||||
         cat "$mkfs_object/parameter/type"
 | 
			
		||||
         break
 | 
			
		||||
      fi
 | 
			
		||||
   done
 | 
			
		||||
   unset _device
 | 
			
		||||
   unset mkfs_device
 | 
			
		||||
   unset mkfs_object
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
device="$(cat "$__object/parameter/device")"
 | 
			
		||||
dir="$(cat "$__object/parameter/dir")"
 | 
			
		||||
prefix="$(cat "$__object/parameter/prefix")"
 | 
			
		||||
if [ -f "$__object/parameter/type" ]; then
 | 
			
		||||
   type="$(cat "$__object/parameter/type")"
 | 
			
		||||
else
 | 
			
		||||
   type="$(get_type_from_mkfs "$device")"
 | 
			
		||||
   # store for later use by others
 | 
			
		||||
   echo "$type" > "$__object/parameter/type"
 | 
			
		||||
fi
 | 
			
		||||
[ -n "$type" ] || die "Can't determine type for $__object"
 | 
			
		||||
if [ "$type" = "swap" ]; then
 | 
			
		||||
   echo "swapon \"$device\""
 | 
			
		||||
else
 | 
			
		||||
   if [ -f "$__object/parameter/options" ]; then
 | 
			
		||||
      options="$(cat "$__object/parameter/options")"
 | 
			
		||||
   else
 | 
			
		||||
      options=""
 | 
			
		||||
   fi
 | 
			
		||||
   [ -n "$options" ] && options="-o $options"
 | 
			
		||||
   mount_point="${prefix}${dir}"
 | 
			
		||||
 | 
			
		||||
   echo "[ -d \"$mount_point\" ] || mkdir -p \"$mount_point\""
 | 
			
		||||
   echo "mount -t \"$type\" $options \"$device\" \"$mount_point\""
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										0
									
								
								cdist/conf/type/__install_mount/install
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								cdist/conf/type/__install_mount/install
									
										
									
									
									
										Normal file
									
								
							
							
								
								
									
										65
									
								
								cdist/conf/type/__install_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								cdist/conf/type/__install_mount/man.rst
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,65 @@
 | 
			
		|||
cdist-type__install_mount(7)
 | 
			
		||||
============================
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__install_mount - mount filesystems in the installer
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
Mounts filesystems in the installer. Collects data to generate /etc/fstab.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
device
 | 
			
		||||
   the device to mount
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
dir
 | 
			
		||||
   where to mount device. Defaults to object_id.
 | 
			
		||||
 | 
			
		||||
options
 | 
			
		||||
   mount options passed to mount(8) and used in /etc/fstab
 | 
			
		||||
 | 
			
		||||
type
 | 
			
		||||
   filesystem type passed to mount(8) and used in /etc/fstab.
 | 
			
		||||
   If type is swap, 'dir' is ignored.
 | 
			
		||||
   Defaults to the filesystem used in __install_mkfs for the same 'device'.
 | 
			
		||||
 | 
			
		||||
prefix
 | 
			
		||||
   the prefix to prepend to 'dir' when mounting in the installer.
 | 
			
		||||
   Defaults to /target.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
.. code-block:: sh
 | 
			
		||||
 | 
			
		||||
    __install_mount slash --dir / --device /dev/sda5 --options noatime
 | 
			
		||||
    require="__install_mount/slash" __install_mount /boot --device /dev/sda1
 | 
			
		||||
    __install_mount swap --device /dev/sda2 --type swap
 | 
			
		||||
    require="__install_mount/slash" __install_mount /tmp --device tmpfs --type tmpfs
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
:strong:`cdist-type__install_mkfs`\ (7),
 | 
			
		||||
:strong:`cdist-type__install_mount_apply` (7)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
AUTHORS
 | 
			
		||||
-------
 | 
			
		||||
Steven Armstrong <steven-cdist--@--armstrong.cc>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2011 Steven Armstrong. 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.
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue