postgresql: upgrade to release 13.8
[LibreOffice.git] / bin / distro-install-clean-up
blob701c9ffa0972a448fef3c1f9a2a32e3ec3bfbc65
1 #!/bin/sh
3 if test -z "${SRC_ROOT}"; then
4 echo "distro-install-clean-up: No environment set!"
5 exit 1
6 fi
8 echo "Cleaning up ...";
10 remove_help_localization()
12 lang=$1
14 # nothing to be done if the localization is en-US if it does not exist
15 # or if it is already removed
16 test "$lang" = "en-US" -o \
17 ! -e $DESTDIR$INSTALLDIR/help/$lang -o \
18 -L $DESTDIR$INSTALLDIR/help/$lang && return;
20 echo "... remove \"$lang\""
22 rm -rf $DESTDIR$INSTALLDIR/help/$lang
23 grep -v "$INSTALLDIR/help/$lang" $DESTDIR/gid_Module_Root.$lang >$DESTDIR/gid_Module_Root.$lang.new
24 mv -f $DESTDIR/gid_Module_Root.$lang.new $DESTDIR/gid_Module_Root.$lang
25 # FIXME: the following code could be used without the condition
26 # and should replace the lines above after only the milestones
27 # providing gid_Module_Helppack_Help and fixed gid_Module_Root.$lang
28 # are supported
29 # Note: The problem with gid_Module_Root.$lang is that it still includes
30 # %dir */help/* entries.
31 # Note: It was still necessary on ppc with gcj (OOo-2.0.2). Strange. Have to
32 # investigate it later.
33 if test -f $DESTDIR/gid_Module_Helppack_Help.$lang ; then
34 grep -v "$INSTALLDIR/help/$lang" $DESTDIR/gid_Module_Helppack_Help.$lang >$DESTDIR/gid_Module_Helppack_Help.$lang.new
35 mv -f $DESTDIR/gid_Module_Helppack_Help.$lang.new $DESTDIR/gid_Module_Helppack_Help.$lang
38 # Note: We created a compat symlink in the past. It is no longer necessary.
39 # We do not want it because RPM has problems with update when we remove
40 # poor localizations in never packages
43 # Check if the English help is installed and is in the main package (is first on the list)
44 # Note that Java-disabled builds do not create help at all.
45 if test -f $DESTDIR$INSTALLDIR/help/en/sbasic.cfg -a \
46 "`for lang in $WITH_LANG_LIST ; do echo $lang ; break ; done`" = "en-US" ; then
48 echo "Removing duplicated English help..."
50 for lang in $WITH_LANG_LIST ; do
51 test ! -f $DESTDIR$INSTALLDIR/help/en/sbasic.cfg -o ! -f $DESTDIR$INSTALLDIR/help/$lang/sbasic.cfg && continue;
52 if diff $DESTDIR$INSTALLDIR/help/en/sbasic.cfg $DESTDIR$INSTALLDIR/help/$lang/sbasic.cfg >/dev/null 2>&1 ; then
53 remove_help_localization $lang
55 done
57 echo "Removing poor help localizations..."
59 for lang in $WITH_POOR_HELP_LOCALIZATIONS ; do
60 remove_help_localization $lang
61 done
64 echo "Fixing permissions..."
65 for dir in $DESTDIR$DOCDIR $DESTDIR$INSTALLDIR/sdk/examples ; do
66 if test -d $dir -a -w $dir ; then
67 find "$dir" -type f \( -name "*.txt" -o -name "*.java" -o -name "*.xml" -o \
68 -name "*.xcu" -o -name "*.xcs" -o -name "*.html" -o \
69 -name "*.pdf" -o -name "*.ps" -o -name "*.gif" -o \
70 -name "*.png" -o -name "*.jpg" -o -name "Makefile" -o \
71 -name "manifest.mf" \) -exec chmod 644 {} \;
73 done
75 if test "z$DESTDIR" != "z" ; then
76 echo "Checking for DESTDIR inside installed files..."
77 found_destdir=
78 for file in `find $DESTDIR -type f` ; do
79 grep -q "$DESTDIR" $file && echo "$file: includes the string \"$DESTDIR\"" && found_destdir=1
80 done
81 if test "z$found_destdir" != "z" ; then
82 echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!"
83 echo "The path DESTDIR:$DESTDIR was found inside some"
84 echo "installed files. It is probably a bug."
85 echo
86 echo "Especially, if the DESTDIR is set to \$RPM_BUILD_ROOT"
87 echo "when creating RPM packages. Even it could be a security hole"
88 echo "if the application searches /var/tmp for binaries or"
89 echo "config files because the directory is world-writable."
90 echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!"