don't throw away command output when packaging installsets
[LibreOffice.git] / bin / sanitize-image-links
blob143eeec3ce55e31c4e2bf10f0b2e14f58572f815
1 #!/usr/bin/env bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # This will reorder icon-themes/*/links.txt to the right order
12 for I in icon-themes/*/links.txt ; do
13 D="${I%/links.txt}"
14 cat "$I" | while read LINK ORIG
16 if [ -f "$D/$LINK" -a -f "$D/$ORIG" ] ; then
17 if diff "$D/$LINK" "$D/$ORIG" >/dev/null 2>&1 ; then
18 echo "$I: removing $LINK from git: both $LINK and $ORIG are the same files" 1>&2
19 git rm "$D/$LINK" 1>/dev/null
20 echo $LINK $ORIG
21 else
22 echo "$I: link and orig differs, check the images, and remove manually: $LINK $ORIG" 1>&2
23 echo $LINK $ORIG
25 elif [ -f "$D/$LINK" ] ; then
26 echo "$I: swapping to right order: $ORIG $LINK" 1>&2
27 echo $ORIG $LINK
28 elif [ -n "$LINK" -a "${LINK:0:1}" != "#" -a ! -f "$D/$LINK" -a ! -f "$D/$ORIG" ] ; then
29 echo "$I: neither exists, removing the line: $LINK $ORIG" 1>&2
30 else
31 echo $LINK $ORIG
33 done > "$I-fixed"
35 mv "$I-fixed" "$I"
36 done
38 # vim: set expandtab sw=4 ts=4: