Re: ["Davide G. M. Salvetti" <salve@debian.org>] emacsen: need plan to fix leftover cruft in share/emacs/XX.Y...
Davide G. M. Salvetti writes:
> >>>>> DGMS == Davide G M Salvetti [2001-2-3]
>
> DGMS> What about this (bash) shell code?
^^^^
All Debian packaging scripts should be written to the posix shell,
not to bash.
>
> Whew, I forgot «shopt -s nullglob», which is quite essential indeed, and
^^^^^^^^^^^^^^^
> should probably be always on in your shell scripts:
^^^^^^^^^
Nonsense, here are just two portable ways,
1. if ls /usr/share/emacs/*/site-lisp/mailcrypt/ 2>/dev/null >&2
then
: "glob succeeded"
else
: "glob failed"
fi
2. glob=$(echo /usr/share/emacs/*/site-lisp/mailcrypt/)
if test "/usr/share/emacs/*/site-lisp/mailcrypt/" = "${glob}"
then
: "glob failed"
else
: "glob succeeded"
fi
> >----------------------------------------------------------------------<
> ### Historic cleanup code
> clean_old_cruft () {
> rm -f /usr/share/emacs/$1/site-lisp/mailcrypt/CompilationLog.gz
> rmdir --ignore-fail-on-non-empty --parents \
> /usr/share/emacs/$1/site-lisp/mailcrypt/
> }
> shopt -s nullglob
> ## Note that /usr/share/emacs/site-lisp/mailcrypt is _not_ enclosed in the
> ## following pattern, and it shouldn't be.
> for i in /usr/share/emacs/*/site-lisp/mailcrypt/; do
> i=${i#/usr/share/emacs/}
> i=${i%/site-lisp/mailcrypt/}
> test -e /usr/bin/emacs-$i || clean_old_cruft $i
> done
> >----------------------------------------------------------------------<
[snip]
--
Jeff Sheinberg <jeffsh@erols.com>
Reply to: