Flavours now head to their final layout:

the whole bunch of stuff found below flavour dir is being installed into the new jails root, including the flavour config, packages and files.
The startup scripts now only creates users, chowns the files it is told to and installs packages.
This commit is contained in:
erdgeist 2005-12-31 01:50:10 +00:00
parent ddbf80c98f
commit 523224e63e
3 changed files with 25 additions and 21 deletions

View File

@ -17,15 +17,16 @@
# admin::wheel::Admin=User:$1$p75bbfK.$Kz3dwkoVlgZrfLZdAXQt91:/home/admin:/bin/sh \
# pgsql:1002:pgsql:1002:Post=Gres::-/usr/local/psql:/bin/nologin'
# ezjails init script tries to install all files listed here from the path
# /config to the corresponding location inside the jail. Directories are being
# copied recursively.
# ezjail-admin script installs all files found in FLAVOUR/root to the
# new jail's root
#
# Files or directories that should not belong to root:wheel will be
# chowned -R according to the following variable
#
# Format is as follows:
#
# user:group:file(s)
#
# Example:
#
# ezjail_flavour_files='root:wheel:/etc/*.conf \
# root:wheel:/etc/localtime \
# admin:wheel:/home/admin/'
# ezjail_flavour_files='admin:wheel:/home/admin/'

View File

@ -85,7 +85,6 @@ create)
# do some sanity checks on the selected flavour (if any)
if [ "${newjail_flavour}" ]; then
[ -d ${ezjail_flavours}/${newjail_flavour}/ ] || exerr "Error: Flavour config directory ${ezjail_flavours}/${newjail_flavour} not found"
[ -d ${ezjail_flavours}/${newjail_flavour}/ezjail.flavour ] || exerr "Error: Flavour config ${ezjail_flavours}/${newjail_flavour}/ezjail.flavour not found"
fi
# now take a copy of our template jail
@ -138,7 +137,11 @@ create)
# Final steps for flavour installation
if [ "${newjail_flavour}" ]; then
cp -r -p ${ezjail_jaildir}/${newjail_flavour} ${newjail_root}/config
# install files, packages and config to new jail
# user creating, chown and package installation on jails startup
cd ${ezjail_jaildir}/${newjail_flavour}
find * | cpio -p -v ${newjail_root} > /dev/null
install -o root -g wheel -m 0755 ${ezjail_share}/ezjail-config.sh ${newjail_root}/etc/rc.d/ezjail-config.sh
echo "Note: Shell scripts installed, flavourizing on jails first startup"
fi

View File

@ -1,18 +1,17 @@
#!/bin/sh
#
# BEFORE: rcconf
set -o noglob
if [ -f /config/ezjail.flavour ]; then
. /config/ezjail.flavour
if [ -f /ezjail.flavour ]; then
. /ezjail.flavour
# we do need to install only once
rm -f /config/ezjail.flavour
# we do need to install only once delete here to avoid errors
# in this script to prevent jail startup forever
rm -f /ezjail.flavour
fi
# set defaults
ezjail_flavour_files=${ezjail_flavour_files:-""}
ezjail_flavour_users=${ezjail_flavour_users:-""}
ezjail_flavour_files=${ezjail_flavour_files:-""}
# try to create users
for user in $ezjail_flavour_users; do
@ -42,24 +41,25 @@ for user in $ezjail_flavour_users; do
fi
done
# try to install files
cd /config
# chmod all files not belonging to root
for file in $ezjail_flavour_files; do
TIFS=$IFS; IFS=:; set -- $file; IFS=$TIFS
set +o noglob
if [ $# -eq 3 -a "$3" ]; then
owner=$1; [ $2 ] && owner="$1:$2"
for file in ./$3; do
find ${file} | cpio -p -d /
chown -R $owner /$file
done
fi
set -o noglob
done
# finally install packages
# install packages
set -o noglob
[ -d /config/pkg ] && cd /config/pkg && pkg_add *
[ -d /pkg ] && cd /pkg && pkg_add *
# source post install script
[ -d /ezjail.postinstall ] && . /ezjail.postinstall
# Get rid off ourself
rm -f /etc/rc.d/ezjail-config.sh
rm -rf /pkg /etc/rc.d/ezjail-config.sh /ezjail.postinstall