From 847fc9d8c168d0395d1f29458005e30f6f9e922d Mon Sep 17 00:00:00 2001 From: Jake Guffey Date: Wed, 11 Apr 2012 14:53:28 -0400 Subject: [PATCH] Multiple bugfixes fixed remote copy command fixed problem with code-remote when jail_enable wasn't in rc.conf fixed problem with code-remote when jail_list wasn't in rc.conf added check to see if /etc/devfs.rules exists before trying to use it added dependency on __directory/usr/jail --- conf/type/__jail/gencode-local | 2 +- conf/type/__jail/gencode-remote | 30 +++++++++++++++++++++------- conf/type/__jail/manifest | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100755 conf/type/__jail/manifest diff --git a/conf/type/__jail/gencode-local b/conf/type/__jail/gencode-local index 2d4415e3..6a66c658 100755 --- a/conf/type/__jail/gencode-local +++ b/conf/type/__jail/gencode-local @@ -29,6 +29,6 @@ jailbase="/usr/jail/jailbase.tgz" basepresent="$(cat "$__object/explorer/basepresent")" if [ "$basepresent" = "NONE" ]; then - echo "$__remote_copy" "$__object/files/jailbase.tgz" "${target_host}:${jailbase}" + echo "$__remote_copy" "$__type/files/jailbase.tgz" "$__target_host:${jailbase}" fi diff --git a/conf/type/__jail/gencode-remote b/conf/type/__jail/gencode-remote index d32ea7d6..56fe9b9a 100755 --- a/conf/type/__jail/gencode-remote +++ b/conf/type/__jail/gencode-remote @@ -212,6 +212,16 @@ EOF # Add the jail_$name_* lines to rc.conf cat <>/etc/rc.conf + elif [ ! "\$(echo \$jail_enable | tr '[a-z]' '[A-Z]')" = "YES" ]; then # jail_enable="NO" + sed -i '.bak' 's/^jail_enable=.*$/jail_enable="YES"/g' /etc/rc.conf # fix this -^ + rm -f /etc/rc.conf.bak + fi cat >>/etc/rc.conf <>/etc/rc.conf else - echo jail_list=\"\${jail_list}\" >>/etc/rc.conf + jail_list="\${jail_list} ${name}" + sed -i '.bak' "s/^jail_list=\".*\"/jail_list=\"\${jail_list}\"/" /etc/rc.conf + rm -f /etc/rc.conf.bak fi unset jail_list - rm -f /etc/rc.conf.bak EOF fi diff --git a/conf/type/__jail/manifest b/conf/type/__jail/manifest new file mode 100755 index 00000000..fc3d2ac7 --- /dev/null +++ b/conf/type/__jail/manifest @@ -0,0 +1,35 @@ +#!/bin/sh +# +# 2012 Jake Guffey (jake.guffey at eprotex.com) +# +# 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 . +# +# +# The __jail type creates, configures, and deletes FreeBSD jails for use as +# virtual machines. +# + +# Debug +#exec >&2 +#set -x + +jaildir="/usr/jail" + +__directory ${jaildir} --parents yes + +# Debug +#set +x +