Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../lib/rpm
File: find-lang.sh
#!/bin/bash
[0] Fix | Delete
#findlang - automagically generate list of language specific files
[1] Fix | Delete
#for inclusion in an rpm spec file.
[2] Fix | Delete
#This does assume that the *.mo files are under .../locale/...
[3] Fix | Delete
#Run with no arguments gets a usage message.
[4] Fix | Delete
[5] Fix | Delete
#findlang is copyright (c) 1998 by W. L. Estes <wlestes@uncg.edu>
[6] Fix | Delete
[7] Fix | Delete
#Redistribution and use of this software are hereby permitted for any
[8] Fix | Delete
#purpose as long as this notice and the above copyright notice remain
[9] Fix | Delete
#in tact and are included with any redistribution of this file or any
[10] Fix | Delete
#work based on this file.
[11] Fix | Delete
[12] Fix | Delete
usage () {
[13] Fix | Delete
cat <<EOF
[14] Fix | Delete
[15] Fix | Delete
Usage: $0 TOP_DIR PACKAGE_NAME [prefix]
[16] Fix | Delete
[17] Fix | Delete
where TOP_DIR is
[18] Fix | Delete
the top of the tree containing the files to be processed--should be
[19] Fix | Delete
\$RPM_BUILD_ROOT usually. TOP_DIR gets sed'd out of the output list.
[20] Fix | Delete
PACKAGE_NAME is the %{name} of the package. This should also be
[21] Fix | Delete
the basename of the .mo files. the output is written to
[22] Fix | Delete
PACKAGE_NAME.lang unless \$3 is given in which case output is written
[23] Fix | Delete
to \$3.
[24] Fix | Delete
Additional options:
[25] Fix | Delete
--with-gnome find GNOME help files
[26] Fix | Delete
--with-mate find MATE help files
[27] Fix | Delete
--with-kde find KDE help files
[28] Fix | Delete
--with-qt find Qt translation files
[29] Fix | Delete
--with-html find HTML files
[30] Fix | Delete
--with-man find localized man pages
[31] Fix | Delete
--all-name match all package/domain names
[32] Fix | Delete
--without-mo do not find locale files
[33] Fix | Delete
EOF
[34] Fix | Delete
exit 1
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
if [ -z "$1" ] ; then usage
[38] Fix | Delete
elif [ $1 = / ] ; then echo $0: expects non-/ argument for '$1' 1>&2
[39] Fix | Delete
elif [ ! -d $1 ] ; then
[40] Fix | Delete
echo $0: $1: no such directory
[41] Fix | Delete
exit 1
[42] Fix | Delete
else TOP_DIR="`echo $1|sed -e 's:/$::'`"
[43] Fix | Delete
fi
[44] Fix | Delete
shift
[45] Fix | Delete
[46] Fix | Delete
if [ -z "$1" ] ; then usage
[47] Fix | Delete
else NAMES[0]=$1
[48] Fix | Delete
fi
[49] Fix | Delete
shift
[50] Fix | Delete
[51] Fix | Delete
GNOME=#
[52] Fix | Delete
MATE=#
[53] Fix | Delete
KDE=#
[54] Fix | Delete
QT=#
[55] Fix | Delete
MAN=#
[56] Fix | Delete
HTML=#
[57] Fix | Delete
MO=
[58] Fix | Delete
MO_NAME=${NAMES[0]}.lang
[59] Fix | Delete
ALL_NAME=#
[60] Fix | Delete
NO_ALL_NAME=
[61] Fix | Delete
while test $# -gt 0 ; do
[62] Fix | Delete
case "${1}" in
[63] Fix | Delete
--with-gnome )
[64] Fix | Delete
GNOME=
[65] Fix | Delete
shift
[66] Fix | Delete
;;
[67] Fix | Delete
--with-mate )
[68] Fix | Delete
MATE=
[69] Fix | Delete
shift
[70] Fix | Delete
;;
[71] Fix | Delete
--with-kde )
[72] Fix | Delete
KDE=
[73] Fix | Delete
shift
[74] Fix | Delete
;;
[75] Fix | Delete
--with-qt )
[76] Fix | Delete
QT=
[77] Fix | Delete
shift
[78] Fix | Delete
;;
[79] Fix | Delete
--with-man )
[80] Fix | Delete
MAN=
[81] Fix | Delete
shift
[82] Fix | Delete
;;
[83] Fix | Delete
--with-html )
[84] Fix | Delete
HTML=
[85] Fix | Delete
shift
[86] Fix | Delete
;;
[87] Fix | Delete
--without-mo )
[88] Fix | Delete
MO=#
[89] Fix | Delete
shift
[90] Fix | Delete
;;
[91] Fix | Delete
--all-name )
[92] Fix | Delete
ALL_NAME=
[93] Fix | Delete
NO_ALL_NAME=#
[94] Fix | Delete
shift
[95] Fix | Delete
;;
[96] Fix | Delete
* )
[97] Fix | Delete
if [ $MO_NAME != ${NAMES[$#]}.lang ]; then
[98] Fix | Delete
NAMES[${#NAMES[@]}]=$MO_NAME
[99] Fix | Delete
fi
[100] Fix | Delete
MO_NAME=${1}
[101] Fix | Delete
shift
[102] Fix | Delete
;;
[103] Fix | Delete
esac
[104] Fix | Delete
done
[105] Fix | Delete
[106] Fix | Delete
if [ -f $MO_NAME ]; then
[107] Fix | Delete
rm $MO_NAME
[108] Fix | Delete
fi
[109] Fix | Delete
[110] Fix | Delete
for NAME in ${NAMES[@]}; do
[111] Fix | Delete
[112] Fix | Delete
find "$TOP_DIR" -type f -o -type l|sed '
[113] Fix | Delete
s:'"$TOP_DIR"'::
[114] Fix | Delete
'"$ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3:
[115] Fix | Delete
'"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3:
[116] Fix | Delete
s:^\([^%].*\)::
[117] Fix | Delete
s:%lang(C) ::
[118] Fix | Delete
/^$/d' >> $MO_NAME
[119] Fix | Delete
[120] Fix | Delete
find "$TOP_DIR" -type d|sed '
[121] Fix | Delete
s:'"$TOP_DIR"'::
[122] Fix | Delete
'"$NO_ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/'"$NAME"'\)$:%lang(\2) %doc \1\2\3\4/:
[123] Fix | Delete
'"$ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/[a-zA-Z0-9.\_\-]\+\)$:%lang(\2) %doc \1\2\3\4/:
[124] Fix | Delete
s:^\([^%].*\)::
[125] Fix | Delete
s:%lang(C) ::
[126] Fix | Delete
/^$/d' >> $MO_NAME
[127] Fix | Delete
[128] Fix | Delete
find "$TOP_DIR" -type d|sed '
[129] Fix | Delete
s:'"$TOP_DIR"'::
[130] Fix | Delete
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'$\):%dir \1:
[131] Fix | Delete
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'/[a-zA-Z0-9.\_\-]/.\+\)::
[132] Fix | Delete
'"$NO_ALL_NAME$GNOME"'s:\(.*/gnome/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) \1\2:
[133] Fix | Delete
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
[134] Fix | Delete
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]/.\+\)::
[135] Fix | Delete
'"$ALL_NAME$GNOME"'s:\(.*/gnome/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) \1\2:
[136] Fix | Delete
s:%lang(.*) .*/gnome/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
[137] Fix | Delete
s:^\([^%].*\)::
[138] Fix | Delete
s:%lang(C) ::
[139] Fix | Delete
/^$/d' >> $MO_NAME
[140] Fix | Delete
[141] Fix | Delete
find "$TOP_DIR" -type d|sed '
[142] Fix | Delete
s:'"$TOP_DIR"'::
[143] Fix | Delete
'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
[144] Fix | Delete
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
[145] Fix | Delete
s:^\([^%].*\)::
[146] Fix | Delete
/^$/d' >> $MO_NAME
[147] Fix | Delete
[148] Fix | Delete
find "$TOP_DIR" -type f|sed '
[149] Fix | Delete
s:'"$TOP_DIR"'::
[150] Fix | Delete
'"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'/'"$NAME"'-\([^/.]\+\)\.omf\):%lang(\2) \1:
[151] Fix | Delete
'"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
[152] Fix | Delete
s:^[^%].*::
[153] Fix | Delete
s:%lang(C) ::
[154] Fix | Delete
/^$/d' >> $MO_NAME
[155] Fix | Delete
[156] Fix | Delete
find $TOP_DIR -type d|sed '
[157] Fix | Delete
s:'"$TOP_DIR"'::
[158] Fix | Delete
'"$NO_ALL_NAME$MATE"'s:\(.*/mate/help/'"$NAME"'$\):%dir \1:
[159] Fix | Delete
'"$NO_ALL_NAME$MATE"'s:\(.*/mate/help/'"$NAME"'/[a-zA-Z0-9.\_\-]/.\+\)::
[160] Fix | Delete
'"$NO_ALL_NAME$MATE"'s:\(.*/mate/help/'"$NAME"'\/\)\([^/_]\+\):%lang(\2) \1\2:
[161] Fix | Delete
'"$ALL_NAME$MATE"'s:\(.*/mate/help/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
[162] Fix | Delete
'"$ALL_NAME$MATE"'s:\(.*/mate/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]/.\+\)::
[163] Fix | Delete
'"$ALL_NAME$MATE"'s:\(.*/mate/help/[a-zA-Z0-9.\_\-]\+\/\)\([^/_]\+\):%lang(\2) \1\2:
[164] Fix | Delete
s:%lang(.*) .*/mate/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*::
[165] Fix | Delete
s:^\([^%].*\)::
[166] Fix | Delete
s:%lang(C) ::
[167] Fix | Delete
/^$/d' >> $MO_NAME
[168] Fix | Delete
[169] Fix | Delete
find "$TOP_DIR" -type d|sed '
[170] Fix | Delete
s:'"$TOP_DIR"'::
[171] Fix | Delete
'"$NO_ALL_NAME$MATE"'s:\(.*/omf/'"$NAME"'$\):%dir \1:
[172] Fix | Delete
'"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+$\):%dir \1:
[173] Fix | Delete
s:^\([^%].*\)::
[174] Fix | Delete
/^$/d' >> $MO_NAME
[175] Fix | Delete
[176] Fix | Delete
find "$TOP_DIR" -type f|sed '
[177] Fix | Delete
s:'"$TOP_DIR"'::
[178] Fix | Delete
'"$NO_ALL_NAME$MATE"'s:\(.*/omf/'"$NAME"'/'"$NAME"'-\([^/.]\+\)\.omf\):%lang(\2) \1:
[179] Fix | Delete
'"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1:
[180] Fix | Delete
s:^[^%].*::
[181] Fix | Delete
s:%lang(C) ::
[182] Fix | Delete
/^$/d' >> $MO_NAME
[183] Fix | Delete
[184] Fix | Delete
KDE3_HTML=`kde-config --expandvars --install html 2>/dev/null`
[185] Fix | Delete
if [ x"$KDE3_HTML" != x -a -d "$TOP_DIR$KDE3_HTML" ]; then
[186] Fix | Delete
find "$TOP_DIR$KDE3_HTML" -type d|sed '
[187] Fix | Delete
s:'"$TOP_DIR"'::
[188] Fix | Delete
'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'/\)::
[189] Fix | Delete
'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'\)$:%lang(\2) \1\2\3:
[190] Fix | Delete
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
[191] Fix | Delete
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
[192] Fix | Delete
s:^\([^%].*\)::
[193] Fix | Delete
s:%lang(C) ::
[194] Fix | Delete
/^$/d' >> $MO_NAME
[195] Fix | Delete
fi
[196] Fix | Delete
[197] Fix | Delete
KDE4_HTML=`kde4-config --expandvars --install html 2>/dev/null`
[198] Fix | Delete
if [ x"$KDE4_HTML" != x -a -d "$TOP_DIR$KDE4_HTML" ]; then
[199] Fix | Delete
find "$TOP_DIR$KDE4_HTML" -type d|sed '
[200] Fix | Delete
s:'"$TOP_DIR"'::
[201] Fix | Delete
'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'/\)::
[202] Fix | Delete
'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'\)$:%lang(\2) \1\2\3:
[203] Fix | Delete
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
[204] Fix | Delete
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
[205] Fix | Delete
s:^\([^%].*\)::
[206] Fix | Delete
s:%lang(C) ::
[207] Fix | Delete
/^$/d' >> $MO_NAME
[208] Fix | Delete
fi
[209] Fix | Delete
[210] Fix | Delete
KF5_HTML=`kf5-config --expandvars --install html 2>/dev/null`
[211] Fix | Delete
if [ x"$KF5_HTML" != x -a -d "$TOP_DIR$KF5_HTML" ]; then
[212] Fix | Delete
find "$TOP_DIR$KF5_HTML" -type d|sed '
[213] Fix | Delete
s:'"$TOP_DIR"'::
[214] Fix | Delete
'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'/\)::
[215] Fix | Delete
'"$NO_ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'\)$:%lang(\2) \1\2\3:
[216] Fix | Delete
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
[217] Fix | Delete
'"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
[218] Fix | Delete
s:^\([^%].*\)::
[219] Fix | Delete
s:%lang(C) ::
[220] Fix | Delete
/^$/d' >> $MO_NAME
[221] Fix | Delete
fi
[222] Fix | Delete
[223] Fix | Delete
find "$TOP_DIR" -type d|sed '
[224] Fix | Delete
s:'"$TOP_DIR"'::
[225] Fix | Delete
'"$NO_ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'/\)::
[226] Fix | Delete
'"$NO_ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/'"$NAME"'\)$:%lang(\2) \1\2\3:
[227] Fix | Delete
'"$ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\)::
[228] Fix | Delete
'"$ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3:
[229] Fix | Delete
s:^\([^%].*\)::
[230] Fix | Delete
s:%lang(C) ::
[231] Fix | Delete
/^$/d' >> $MO_NAME
[232] Fix | Delete
[233] Fix | Delete
find "$TOP_DIR" -type f -o -type l|sed '
[234] Fix | Delete
s:'"$TOP_DIR"'::
[235] Fix | Delete
'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\{2\}\([_@].*\)\?\)\.qm$\):%lang(\2) \1:
[236] Fix | Delete
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
[237] Fix | Delete
'"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
[238] Fix | Delete
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
[239] Fix | Delete
'"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
[240] Fix | Delete
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1:
[241] Fix | Delete
'"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1:
[242] Fix | Delete
s:^[^%].*::
[243] Fix | Delete
s:%lang(C) ::
[244] Fix | Delete
/^$/d' >> $MO_NAME
[245] Fix | Delete
[246] Fix | Delete
find "$TOP_DIR" -type d|sed '
[247] Fix | Delete
s:'"$TOP_DIR"'::
[248] Fix | Delete
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/\)::
[249] Fix | Delete
'"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1/*:
[250] Fix | Delete
s:^\([^%].*\)::
[251] Fix | Delete
s:%lang(C) ::
[252] Fix | Delete
/^$/d' >> $MO_NAME
[253] Fix | Delete
[254] Fix | Delete
find "$TOP_DIR" -type f -o -type l|sed -r 's/\.(bz2|gz|xz|lzma|Z)$//g' | sed '
[255] Fix | Delete
s:'"$TOP_DIR"'::
[256] Fix | Delete
'"$NO_ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/'"$NAME"'\.[a-z0-9].*\):%lang(\2) \1*:
[257] Fix | Delete
s:^\([^%].*\)::
[258] Fix | Delete
s:%lang(C) ::
[259] Fix | Delete
/^$/d' >> $MO_NAME
[260] Fix | Delete
[261] Fix | Delete
done # for NAME in ${NAMES[@]}
[262] Fix | Delete
[263] Fix | Delete
if ! grep -q / $MO_NAME; then
[264] Fix | Delete
echo "No translations found for ${NAME} in ${TOP_DIR}"
[265] Fix | Delete
exit 1
[266] Fix | Delete
fi
[267] Fix | Delete
exit 0
[268] Fix | Delete
[269] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function