[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ezjail] stale /usr/jails/*.devices



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nathan Gardner wrote:

> I just switched to using ezjail for a new FreeBSD 6.2 system I'm
> running. I'd like to say thanks, it sure beats the custom 300+ line
> shell script I wrote for FreeBSD 5.x.

Thanks for the flowers :) Anything you miss from your old self-hacked
script days?

> It seems a bit lacking in elegance... Does anyone have any better ways
> of doing this?

Now I do the following to check, whether a (locking) link still is valid:

    if [ -L "${ezjail_rootdir}.device" ]; then
      # Fetch destination of soft link
      ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device`

      mount -p -v | grep -E
"^${ezjail_rootdir}.device.${ezjail_rootdir}" && echo "Warning: Skipping
jail. Jail image file ${ezjail} already attached as ${ezjail_devic
e}. 'ezjail-admin config -i detach' it first." && return 1
      mount -p -v | grep -E "^${ezjail_device}.${ezjail_rootdir}" &&
echo "Warning: Skipping jail. Jail image file ${ezjail} already attached
as ${ezjail_device}. 'ezj
ail-admin config -i detach' it first." && return 1

      # Remove stale device link
      rm -f ${ezjail_rootdir}.device
    fi

in ezjail.sh and similar in ezjail-admin.

I checked it into CVS and would love to see some testing.

Is this solution considered sexy enough?

Regards

  erdgeist
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFGA/2hImmQdUyYEgkRAlGiAKCOLTWlA1hHC/hqitTINJXdm1mCRACghiYd
XDtR7LWxGD4BriEWxFxJ33A=
=86C/
-----END PGP SIGNATURE-----