2017-06-28 11:19:32 +00:00
|
|
|
#!/bin/sh -e
|
2012-04-11 18:53:28 +00:00
|
|
|
#
|
|
|
|
# 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 <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# The __jail type creates, configures, and deletes FreeBSD jails for use as
|
|
|
|
# virtual machines.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Debug
|
|
|
|
#exec >&2
|
|
|
|
#set -x
|
|
|
|
|
2012-04-27 15:45:34 +00:00
|
|
|
# Can only be used on FreeBSD
|
|
|
|
os="$(cat "$__global/explorer/os")"
|
|
|
|
if [ ! "$os" = "freebsd" ]; then
|
2014-04-04 18:00:51 +00:00
|
|
|
echo "__jail can only be used on FreeBSD targets!" >&2
|
|
|
|
exit 1
|
2012-04-27 15:45:34 +00:00
|
|
|
fi
|
|
|
|
|
2014-02-03 20:43:39 +00:00
|
|
|
jaildir="$(cat "$__object/parameter/jaildir")"
|
2012-04-11 18:53:28 +00:00
|
|
|
|
2018-10-02 19:44:27 +00:00
|
|
|
__directory "${jaildir}" --parents
|
2012-04-11 18:53:28 +00:00
|
|
|
|
2018-10-07 08:20:08 +00:00
|
|
|
set -- "$@" "$__object_id"
|
2016-06-06 01:57:21 +00:00
|
|
|
cd "$__object/parameter"
|
2018-10-04 14:01:45 +00:00
|
|
|
for property in *; do
|
2016-06-06 01:57:21 +00:00
|
|
|
set -- "$@" "--$property" "$(cat "$property")"
|
|
|
|
done
|
|
|
|
|
2018-10-05 13:14:03 +00:00
|
|
|
if grep -q '^10\.' "$(cat "$__global/explorer/os_version")" ; then # Version is 10.x
|
2016-06-06 01:57:21 +00:00
|
|
|
__jail_freebsd10 "$@"
|
|
|
|
else
|
|
|
|
__jail_freebsd9 "$@"
|
|
|
|
fi
|
|
|
|
|
2012-04-11 18:53:28 +00:00
|
|
|
# Debug
|
|
|
|
#set +x
|
|
|
|
|