2002-03-25 23:37:46 +03:00
#!/bin/sh -e
#
# brp-cleanup - cleanup buildroot.
#
2005-06-16 20:18:15 +04:00
# Copyright (C) 2000-2005 Dmitry V. Levin <ldv@altlinux.org>
2002-03-25 23:37:46 +03:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
2022-12-23 16:08:41 +03:00
. @RPMCONFIGDIR@/rpmb-functions
2003-11-09 19:47:45 +03:00
ValidateBuildRoot
cd "$RPM_BUILD_ROOT"
2002-03-25 23:37:46 +03:00
2002-08-28 19:06:42 +04:00
RPM_CLEANUP_METHOD="${RPM_CLEANUP_METHOD## }"
RPM_CLEANUP_METHOD="${RPM_CLEANUP_METHOD%% }"
2002-07-21 17:48:37 +04:00
echo "Cleaning files in $RPM_BUILD_ROOT ($RPM_CLEANUP_METHOD)"
2003-11-09 19:47:45 +03:00
if [ "$RPM_CLEANUP_METHOD" = skip -o "$RPM_CLEANUP_METHOD" = none ]; then
2002-07-21 17:48:37 +04:00
exit 0
fi
2002-09-27 17:41:26 +04:00
: ${RPM_CLEANUP_TOPDIR:=}
[ -d "$RPM_BUILD_ROOT$RPM_CLEANUP_TOPDIR" ] || exit 0
: ${RPM_CLEANUP_SKIPLIST:=}
export RPM_CLEANUP_SKIPLIST
2002-07-21 17:48:37 +04:00
if [ -n "$RPM_CLEANUP_METHOD" -a "$RPM_CLEANUP_METHOD" != auto ]; then
exec "$RPM_CLEANUP_METHOD"
fi
2002-09-27 17:41:26 +04:00
find .$RPM_CLEANUP_TOPDIR -type f \( \
2002-03-25 23:37:46 +03:00
-name '#*#' \
-o -name '*~' \
-o -name DEADJOE \
-o -name '*.orig' \
-o -name '*.rej' \
-o -name '*.bak' \
-o -name '.*.orig' \
-o -name '.*.rej' \
-o -name '.*.bak' \
-o -name .SUMS \
-o -name TAGS \
-o -name core \
2008-04-09 21:48:26 +04:00
-o -name .cvsignore \
2008-10-17 18:46:22 +04:00
-o -name .gitignore \
2002-03-25 23:37:46 +03:00
-o \( -path '*/.deps/*' -a -name '*.P' \) \
2002-07-21 17:48:37 +04:00
\) -print0 |
xargs -r0 rm -vf --
2002-03-25 23:37:46 +03:00
2002-09-27 17:41:26 +04:00
find .$RPM_CLEANUP_TOPDIR -type d -name CVS -print0 |
2002-07-21 17:48:37 +04:00
xargs -r0 rm -vrf --
2002-03-25 23:37:46 +03:00
2004-01-21 19:08:37 +03:00
if [ -z "$RPM_KEEP_LIBTOOL_FILES" ]; then
2005-06-16 20:18:15 +04:00
for d in ./lib ./usr/lib ./usr/X11R6/lib ./lib64 ./usr/lib64 ./usr/X11R6/lib64; do
2004-01-21 19:08:37 +03:00
[ -d "$d" ] || continue
2004-11-11 13:07:16 +03:00
find "$d" -mindepth 1 -maxdepth 1 -type f -name 'lib*.la' -print0 |
2004-01-21 19:08:37 +03:00
xargs -r0 rm -fv --
done
fi
2003-12-03 14:51:33 +03:00
if [ -d ./etc/pam.d ]; then
2004-11-11 13:07:16 +03:00
find ./etc/pam.d -mindepth 1 -maxdepth 1 -type f -print0 |
2009-06-27 00:35:36 +04:00
xargs -r0 sed -i '
s,^[[:space:]]*\(#\?\)[[:space:]]*\(-\?auth\|account\|session\)[[:space:]]\+,\1\2 ,
s,^[[:space:]]*\(#\?\)[[:space:]]*\(-account\|-session\|-\?password\)[[:space:]]\+,\1\2 ,
s,^[[:space:]]*\(#\?[[:space:]]*-\?\(auth\|account\|password\|session\)[[:space:]]\+\)\(include\)[[:space:]]\+,\1\3 ,
s,^[[:space:]]*\(#\?[[:space:]]*-\?\(auth\|account\|password\|session\)[[:space:]]\+\)\(required\|requisite\|sufficient\|optional\|substack\|\[[^]]\+\]\)[[:space:]]\+,\1\3 ,
2024-10-14 17:00:00 +03:00
s,\([[:space:]]\)\(/usr\)\?/lib\(64\)\?/security/\(pam_\),\1\4,g
2009-06-27 00:12:52 +04:00
s,\([[:space:]]\)required[[:space:]]\+pam_stack.so[[:space:]]\+service=,\1substack ,g
2003-05-26 01:01:24 +04:00
' --
fi
2011-10-21 01:26:58 +04:00
# Run ancillary cleanup methods.
for f in @RPMCONFIGDIR@/*.clean; do
"$f"
done