Got the first running image-jails. Need more testing and sanity checking.

This commit is contained in:
erdgeist 2006-03-18 22:04:03 +00:00
parent b924c9a6c7
commit c6763b6e35

View File

@ -1,7 +1,8 @@
#!/bin/sh #!/bin/sh
# ugly: this variable is set during port install time # ugly: this variable is set during port install time
ezjail_prefix=EZJAIL_PREFIX #ezjail_prefix=EZJAIL_PREFIX
ezjail_prefix=/usr/local/
ezjail_etc=${ezjail_prefix}/etc ezjail_etc=${ezjail_prefix}/etc
ezjail_share=${ezjail_prefix}/share/ezjail ezjail_share=${ezjail_prefix}/share/ezjail
ezjail_examples=${ezjail_prefix}/share/examples/ezjail ezjail_examples=${ezjail_prefix}/share/examples/ezjail
@ -29,13 +30,12 @@ ezjail_fdescfs_enable=${ezjail_fdescfs_enable:-"YES"}
exerr () { echo -e "$*"; exit 1; } exerr () { echo -e "$*"; exit 1; }
# define detach strategy for image jails # define detach strategy for image jails
detach () { detach_images () {
# unmount and detach memory disc # unmount and detach memory disc
if [ "${newjail_device}" ]; then if [ "${newjail_device}" ]; then
umount ${newjail_root} umount ${newjail_root}
mdconfig -d -u ${newjail_device} mdconfig -d -u ${newjail_device}
fi fi
return 0
} }
# check for command # check for command
@ -140,7 +140,7 @@ create)
if [ "${newjail_fill}" = "YES" ]; then if [ "${newjail_fill}" = "YES" ]; then
mkdir -p ${newjail_root} && cd ${ezjail_jailtemplate} && \ mkdir -p ${newjail_root} && cd ${ezjail_jailtemplate} && \
find * | cpio -p -v ${newjail_root} > /dev/null find * | cpio -p -v ${newjail_root} > /dev/null
[ $? != 0 ] || detach() || exerr "Error: Could not copy template jail." [ $? = 0 ] || detach_images || exerr "Error: Could not copy template jail."
fi fi
# if a soft link is necessary, create it now # if a soft link is necessary, create it now
@ -148,7 +148,10 @@ create)
# if the automount feature is not disabled, this fstab entry for new jail # if the automount feature is not disabled, this fstab entry for new jail
# will be obeyed # will be obeyed
echo ${ezjail_jailbase} ${newjail_root}/basejail nullfs ro 0 0 > /etc/fstab.${newjail_nname} echo -n > /etc/fstab.${newjail_nname}
[ "${newjail_imagesize}" ] && \
echo ${newjail_root}.device ${newjail_root} ufs rw 0 0 >> /etc/fstab.${newjail_nname}
echo ${ezjail_jailbase} ${newjail_root}/basejail nullfs ro 0 0 >> /etc/fstab.${newjail_nname}
# now, where everything seems to have gone right, create control file in # now, where everything seems to have gone right, create control file in
# ezjails config dir # ezjails config dir
@ -181,7 +184,8 @@ create)
fi fi
fi fi
detach() # Detach (crypto and) memory discs
detach_images
# #
# For user convenience some scenarios commonly causing headaches are checked # For user convenience some scenarios commonly causing headaches are checked