From a9109c94a480ef74937ac6680aa86f2682a17b4c Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 6 Sep 2013 12:22:57 +0200 Subject: [PATCH] add missing types from private repo Signed-off-by: Steven Armstrong --- cdist/conf/type/__chroot_mount/gencode-remote | 36 ++++++++++++++++ cdist/conf/type/__chroot_mount/man.text | 42 +++++++++++++++++++ .../conf/type/__chroot_umount/gencode-remote | 33 +++++++++++++++ cdist/conf/type/__chroot_umount/man.text | 42 +++++++++++++++++++ 4 files changed, 153 insertions(+) create mode 100755 cdist/conf/type/__chroot_mount/gencode-remote create mode 100644 cdist/conf/type/__chroot_mount/man.text create mode 100755 cdist/conf/type/__chroot_umount/gencode-remote create mode 100644 cdist/conf/type/__chroot_umount/man.text diff --git a/cdist/conf/type/__chroot_mount/gencode-remote b/cdist/conf/type/__chroot_mount/gencode-remote new file mode 100755 index 00000000..ec0b83ae --- /dev/null +++ b/cdist/conf/type/__chroot_mount/gencode-remote @@ -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 . +# + +chroot="/$__object_id" + +cat << DONE +# Prepare chroot +[ -d "${chroot}/proc" ] || mkdir "${chroot}/proc" +mount -t proc none "${chroot}/proc" +[ -d "${chroot}/sys" ] || mkdir "${chroot}/sys" +mount -t sysfs none "${chroot}/sys" +[ -d "${chroot}/dev" ] || mkdir "${chroot}/dev" +mount --rbind /dev "${chroot}/dev" +[ -d "${chroot}/tmp" ] || mkdir -m 1777 "${chroot}/tmp" +mount -t tmpfs none "${chroot}/tmp" +if [ ! -f "${chroot}/etc/resolv.conf" ]; then + cp /etc/resolv.conf "${chroot}/etc/" +fi +DONE diff --git a/cdist/conf/type/__chroot_mount/man.text b/cdist/conf/type/__chroot_mount/man.text new file mode 100644 index 00000000..adce80d9 --- /dev/null +++ b/cdist/conf/type/__chroot_mount/man.text @@ -0,0 +1,42 @@ +cdist-type__install_chroot_mount(7) +=================================== +Steven Armstrong + + +NAME +---- +cdist-type__install_chroot_mount - mount a chroot + + +DESCRIPTION +----------- +Mount and prepare a chroot for running commands within it. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__install_chroot_mount /path/to/chroot +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3). diff --git a/cdist/conf/type/__chroot_umount/gencode-remote b/cdist/conf/type/__chroot_umount/gencode-remote new file mode 100755 index 00000000..aad9ac76 --- /dev/null +++ b/cdist/conf/type/__chroot_umount/gencode-remote @@ -0,0 +1,33 @@ +#!/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 . +# + +chroot="/$__object_id" + +cat << DONE +umount -l "${chroot}/tmp" +umount -l "${chroot}/dev" +umount -l "${chroot}/sys" +umount -l "${chroot}/proc" +rm -f "${chroot}/etc/resolv.conf" +# 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" +DONE diff --git a/cdist/conf/type/__chroot_umount/man.text b/cdist/conf/type/__chroot_umount/man.text new file mode 100644 index 00000000..a5ca1ef0 --- /dev/null +++ b/cdist/conf/type/__chroot_umount/man.text @@ -0,0 +1,42 @@ +cdist-type__install_chroot_umount(7) +==================================== +Steven Armstrong + + +NAME +---- +cdist-type__install_chroot_umount - unmount a chroot mounted by __chroot_mount + + +DESCRIPTION +----------- +Undo what __chroot_mount did. + + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +EXAMPLES +-------- + +-------------------------------------------------------------------------------- +__install_chroot_umount /path/to/chroot +-------------------------------------------------------------------------------- + + +SEE ALSO +-------- +- cdist-type(7) + + +COPYING +------- +Copyright \(C) 2012 Steven Armstrong. Free use of this software is +granted under the terms of the GNU General Public License version 3 (GPLv3).