1#!/bin/bash
2#
3#   tidy.sh - functions for modifying/removing installed files before
4#   package creation
5#
6#   Copyright (c) 2015-2018 Pacman Development Team <pacman-dev@archlinux.org>
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 2 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[[ -n "$LIBMAKEPKG_TIDY_SH" ]] && return
23LIBMAKEPKG_TIDY_SH=1
24
25LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
26
27source "$LIBRARY/util/message.sh"
28
29
30declare -a packaging_options tidy_remove tidy_modify
31
32for lib in "$LIBRARY/tidy/"*.sh; do
33	source "$lib"
34done
35
36readonly -a packaging_options tidy_remove tidy_modify
37
38
39tidy_install() {
40	cd_safe "$pkgdir"
41	msg "$(gettext "Tidying install...")"
42
43	# options that remove unwanted files
44	for func in ${tidy_remove[@]}; do
45		$func
46	done
47
48	# options that modify files
49	for func in ${tidy_modify[@]}; do
50		$func
51	done
52}
53