rewrite scripts
try to provide better syntax and avoid using bash
This commit is contained in:
29
debian/linux-perf.postrm
vendored
29
debian/linux-perf.postrm
vendored
@@ -2,21 +2,24 @@
|
||||
|
||||
set -e
|
||||
|
||||
old_version_suffix="$(echo "$2" | sed -rn 's/^([0-9]+\.[0-9]+).*/\1/p')"
|
||||
if [ "$old_version_suffix" ]; then
|
||||
old_version_suffix=$(printf '%s' "$2" | sed -En 's/^([0-9]+\.[0-9]+).*/\1/p')
|
||||
if [ -n "${old_version_suffix}" ] ; then
|
||||
dpkg-maintscript-helper symlink_to_dir \
|
||||
/usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" 5.16\~rc8-1\~exp1 linux-perf -- "$@"
|
||||
/usr/share/doc/linux-perf "linux-perf-${old_version_suffix}" '5.16~rc8-1~exp1' linux-perf -- "$@"
|
||||
fi
|
||||
unset old_version_suffix
|
||||
|
||||
if [ "$1" = remove ]
|
||||
then
|
||||
for wrapper in /usr/bin/perf \
|
||||
/usr/share/bash-completion/completions/perf \
|
||||
/usr/share/man/man1/perf.1.gz; do
|
||||
diversion="${wrapper%/perf*}/perf.wrapper${wrapper#*/perf}"
|
||||
dpkg-divert --package linux-perf --divert "$diversion" --rename \
|
||||
--remove "$wrapper"
|
||||
done
|
||||
fi
|
||||
case "$1" in
|
||||
remove )
|
||||
for wrapper in \
|
||||
/usr/bin/perf \
|
||||
/usr/share/bash-completion/completions/perf \
|
||||
/usr/share/man/man1/perf.1.gz \
|
||||
; do
|
||||
diversion="${wrapper%/perf*}/perf.wrapper${wrapper#*/perf}"
|
||||
dpkg-divert --package linux-perf --divert "${diversion}" --rename --remove "${wrapper}"
|
||||
done ; unset wrapper diversion
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
Reference in New Issue
Block a user