Merge branch 'master' of https://github.com/jdguffey/cdist
This commit is contained in:
commit
230e9fe2f8
4 changed files with 32 additions and 6 deletions
|
@ -28,12 +28,26 @@ else
|
||||||
jaildir="/usr/jail"
|
jaildir="/usr/jail"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
jailbase="$(cat "$__object/parameter/jailbase")"
|
if [ -f "$__object/parameter/jailbase" ]; then
|
||||||
|
jailbase="$(cat "$__object/parameter/jailbase")"
|
||||||
|
else
|
||||||
|
jailbase=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
state="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
|
if [ "$state" = "present" ] && [ -z "$jailbase" ]; then
|
||||||
|
exec >&2
|
||||||
|
echo "jailbase is a REQUIRED parameter when state=present!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
remotebase="${jaildir}/jailbase.tgz"
|
remotebase="${jaildir}/jailbase.tgz"
|
||||||
basepresent="$(cat "$__object/explorer/basepresent")"
|
basepresent="$(cat "$__object/explorer/basepresent")"
|
||||||
|
|
||||||
if [ "$basepresent" = "NONE" ]; then
|
if [ "$state" = "present" ]; then
|
||||||
echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}"
|
if [ "$basepresent" = "NONE" ]; then
|
||||||
fi
|
echo "$__remote_copy" "${jailbase}" "$__target_host:${remotebase}"
|
||||||
|
fi # basepresent=NONE
|
||||||
|
fi # state=present
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,7 @@ cat <<EOF
|
||||||
mkdir -p ${jaildir}/${name}
|
mkdir -p ${jaildir}/${name}
|
||||||
if [ ! -d "${jaildir}/base" ]; then
|
if [ ! -d "${jaildir}/base" ]; then
|
||||||
mkdir "${jaildir}/base"
|
mkdir "${jaildir}/base"
|
||||||
|
chmod 755 "${jaildir}/base"
|
||||||
tar -xzf "${jaildir}/jailbase.tgz" -C "${jaildir}/base"
|
tar -xzf "${jaildir}/jailbase.tgz" -C "${jaildir}/base"
|
||||||
if [ ! -d "${jaildir}/base/usr/local" ]; then
|
if [ ! -d "${jaildir}/base/usr/local" ]; then
|
||||||
mkdir -p "${jaildir}/base/usr/local"
|
mkdir -p "${jaildir}/base/usr/local"
|
||||||
|
@ -184,6 +185,11 @@ cat <<EOF
|
||||||
if [ ! -d "${jaildir}/base/usr/home" ]; then
|
if [ ! -d "${jaildir}/base/usr/home" ]; then
|
||||||
mkdir -p "${jaildir}/base/usr/home"
|
mkdir -p "${jaildir}/base/usr/home"
|
||||||
fi
|
fi
|
||||||
|
if [ ! -d "${jaildir}/home" ]; then
|
||||||
|
SAVE=\$PWD; cd ${jaildir}/base
|
||||||
|
ln -s usr/home home
|
||||||
|
cd \$SAVE; unset SAVE
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! -d "${jaildir}/rw" ]; then
|
if [ ! -d "${jaildir}/rw" ]; then
|
||||||
mkdir "${jaildir}/rw"
|
mkdir "${jaildir}/rw"
|
||||||
|
@ -198,6 +204,12 @@ cat <<EOF
|
||||||
if [ -n "\$(ls ${jaildir}/base/var)" ]; then
|
if [ -n "\$(ls ${jaildir}/base/var)" ]; then
|
||||||
cp -r ${jaildir}/base/var/* "${jaildir}/rw/${name}/var/"
|
cp -r ${jaildir}/base/var/* "${jaildir}/rw/${name}/var/"
|
||||||
fi
|
fi
|
||||||
|
chmod 755 "${jaildir}/rw/${name}/var"
|
||||||
|
chmod 755 "${jaildir}/base/var"
|
||||||
|
if [ -n "\$(ls ${jaildir}/base/var/db)" ]; then
|
||||||
|
chmod 755 "${jaildir}/rw/${name}/var/db"
|
||||||
|
chmod 755 "${jaildir}/base/var/db"
|
||||||
|
fi
|
||||||
mkdir "${jaildir}/rw/${name}/home"
|
mkdir "${jaildir}/rw/${name}/home"
|
||||||
if [ -n "\$(ls ${jaildir}/base/usr/home)" ]; then
|
if [ -n "\$(ls ${jaildir}/base/usr/home)" ]; then
|
||||||
cp -r ${jaildir}/base/usr/home/* "${jaildir}/rw/${name}/home/"
|
cp -r ${jaildir}/base/usr/home/* "${jaildir}/rw/${name}/home/"
|
||||||
|
@ -293,7 +305,7 @@ if [ "$onboot" = "true" ]; then
|
||||||
# if necessary
|
# if necessary
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
jail_list="\$(grep '^jail_list=' /etc/rc.conf | cut -d= -f2)"
|
eval "\$(grep '^jail_list=' /etc/rc.conf)"
|
||||||
if [ -z "\$jail_list" ]; then # no jail_list line in rc.conf at all
|
if [ -z "\$jail_list" ]; then # no jail_list line in rc.conf at all
|
||||||
echo "jail_list=\"${name}\"" >>/etc/rc.conf
|
echo "jail_list=\"${name}\"" >>/etc/rc.conf
|
||||||
else
|
else
|
||||||
|
|
|
@ -7,3 +7,4 @@ devfs-enable
|
||||||
devfs-ruleset
|
devfs-ruleset
|
||||||
onboot
|
onboot
|
||||||
jaildir
|
jaildir
|
||||||
|
jailbase
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
state
|
state
|
||||||
jailbase
|
|
||||||
|
|
Loading…
Reference in a new issue