Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Dec 2014 09:10:38 +0000
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        freebsd-ports@freebsd.org
Subject:   Re: removing a dir, regardless of content
Message-ID:  <54968E8E.9070609@FreeBSD.org>
In-Reply-To: <355B8A8B-1224-4D09-9516-AEF4AAA7F2FE@langille.org>
References:  <355B8A8B-1224-4D09-9516-AEF4AAA7F2FE@langille.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--PjfsV31BajfcX0c4K7fMG9lblRFsmoLSv
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 20/12/2014 23:29, Dan Langille wrote:
> A webapp, www/bacula-web puts cache files at
> %%BASE%%/application/view/cache and on deinstall, that directory
> should be removed, even though there are files there.
>=20
> Can that be done?
>=20
> I=E2=80=99ve tried this in pkg-plist: @unexec rm -rf
> %%BASE%%/application/view/cache

The best way to handle this is by writing a pkg-deinstall.sh script:

https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/pkg-de=
install.html

(it's usually the case that you'ld create a pkg-deinstall.sh.in and add
that to SUBFILES so you can add whatever %%TOKENS%% you want to pull in
settings from the port Makefile. There are plenty of examples in the
ports, but more usually of the very similar pkg-install.sh mechanism.)

On deinstall, the pkg-deinstall.sh script should be run the first time
before processing the plist, so you can delete everything in your cache
directory at that point.  Just make the second run do nothing.

I'd still put the cache directory itself into the pkg-plist as an @dir
item, as that will simplify the installation side of things.

However, one point is that this sort of cache directory should live
somewhere under /var according to hier(7).  Does this application allow
relocating the cace directory there?  Not that most web application
writers have any conception of the filesystem management disipline we
impose on ourselves...

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey



--PjfsV31BajfcX0c4K7fMG9lblRFsmoLSv
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)

iQJ8BAEBCgBmBQJUlo6ZXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NTNBNjhCOTEzQTRFNkNGM0UxRTEzMjZC
QjIzQUY1MThFMUE0MDEzAAoJELsjr1GOGkAT9uEP/1IgAtWLylxZgEg/T3q8s0bF
j1Gg3MuatsVvHn7qA8f6kZCv0CA1iYH8O+B6cfUXuBeunaIjcYydJeXZlze7lRxu
leVE6qLPjC/o/iIW6JZrj8NVqTmDaASr5kYguXcn+vPKPfMK7k8bGGlcgrFjs4jM
zz4kIf0lYHsHQXJiJObqCfpLwfvQ3cPqriUNy4T9IqZdhO3iy4gbbLLJv5BqldB1
9ZsZP/wGC7JEd769IsED+VVFiaF3RoGqRtDlQ9AWaLch0OlUQjpJLuh8YI86Gy4y
C7k/Ck1hpyK24gsRrVS40NYe5cXVxNxGtsXtJDWTCRpoFKkCrRpbjNLtbtxBXGfR
fYSHvFwH5X12THuMSwPSRmN2snUDedY5I45UpKcHUTC5TChWU2TeWbUVdxSLJaUR
PNFnQmAXLcT4tYGt2JfCSxgAD0bTOuVeiM5lJJC2msPIdftBJIJ+K1LMi32XA7hX
UhbJiD5IX+3dJ/HURPs1ev9ezcN92qNpet4xXuUTIfV9pxu43mqZOylOrrdzDlRE
/DbkSbDNyLxyqe4qz/45wGfwsQ+X4m6/Sap8NsQm09J9QjzTz9FGXfDWzSWeqqgx
30lM/BMDLGoEigGQq6RboBFGbXiXu0bZszv9uHxFCqbM3qOylCSIMj4nPOMnR1QQ
LiDj2OYMoweuKM0mEC+U
=i5G6
-----END PGP SIGNATURE-----

--PjfsV31BajfcX0c4K7fMG9lblRFsmoLSv--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54968E8E.9070609>