Debian Codegraph @

scripts/manpages-uninstall.sh.in

raw
1 #!/bin/bash
2 #
3 # Authors:
4 # Pavel Březina <[email protected]>
5 #
6 # Copyright (C) 2018 Red Hat
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #
21 #
22 # Uninstall manual pages.
23 #
24 # Usage: manpages-uninstall.sh prefix
25 #
26
27 prefix=$1
28 DESTDIR=$2
29 shift 2
30 MANPAGES=$@
31 MANDIR="$DESTDIR/@mandir@"
32
33 # Find translated and compiled manual pages.
34 # Usage: manpages-find PAGE
35 manpages-find() {
36 local PAGE="$1"
37
38 /usr/bin/find $MANDIR \
39 -type f -name "$PAGE" -printf '%d\t%p\n' | sort -nk1 | cut -f2-
40 }
41
42 for MANPAGE in $MANPAGES; do
43 PAGES=`manpages-find $MANPAGE`
44 for PAGE in $PAGES; do
45 /usr/bin/rm -f $PAGE
46 done
47 done