[SCM] crtmpserver/master: Add postrm script for crtmpserver-apps.
Alessio Treglia
alessio at debian.org
Tue Apr 24 00:34:46 UTC 2012
On Sat, Apr 14, 2012 at 9:45 PM, <jet-guest at users.alioth.debian.org> wrote:
> +compare() {
> + [ $# != 2 ] && exit 1
> + A=$(md5sum $1 | cut -d' ' -f1)
> + B=$(md5sum $2 | cut -d' ' -f1)
> + [ "$A" = "$B" ] && return 0 || return 1
> +}
> +
> +do_remove() {
> + for app in $APPLICATIONS; do
> + if [ -f "/etc/crtmpserver/applications/$app.lua" ]; then
> + compare "/etc/crtmpserver/applications/$app.lua" \
> + "/usr/share/doc/crtmpserver-apps/examples/$app.lua" \
> + && rm "/etc/crtmpserver/applications/$app.lua"
> + fi
> + done
I notice now you compare the md5s of the files before removing them,
but dpkg can handle all cases clean way, it would be enough to install
them under /etc/.
Plus, the following may also cause the script to exit with 1 as return
code in the case /etc/crtmpserver/ is not empty:
> + rmdir /etc/crtmpserver
What the following line does is unconditionally removing the
/etc/crtmpserver/ directory which is not good at all! Otherwise it
returns 1, which means error!
dpkg does not prune that directory if user's put custom files in it.
> +do_purge() {
> + rm -r /etc/crtmpserver || exit 1
> +}
--
Alessio Treglia | www.alessiotreglia.com
Debian Developer | alessio at debian.org
Ubuntu Core Developer | quadrispro at ubuntu.com
0416 0004 A827 6E40 BB98 90FB E8A4 8AE5 311D 765A
More information about the pkg-multimedia-maintainers
mailing list