OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/update-desktop-files?expand=0&rev=59
This commit is contained in:
parent
da725b057b
commit
5b3f134aa0
@ -22,8 +22,63 @@ COMMENT=no
|
|||||||
GNAME=no
|
GNAME=no
|
||||||
BASEDIR=/no
|
BASEDIR=/no
|
||||||
PROJECT=
|
PROJECT=
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
local exitcode="$1"
|
||||||
|
if [ -z "$exitcode" ]; then
|
||||||
|
exitcode=1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "Usage: $(basename $0) [OPTIONS] <APPLICATION> [CATEGORIES]"
|
||||||
|
echo
|
||||||
|
echo " Summary:"
|
||||||
|
echo " Used to add easily a category to .desktop files according to XDG"
|
||||||
|
echo " standard. More information is available on"
|
||||||
|
echo " http://en.opensuse.org/SUSE_Package_Conventions/RPM_Macros"
|
||||||
|
echo " If you have any questions, please use our mailinglist: "
|
||||||
|
echo " opensuse-packaging@opensuse.org"
|
||||||
|
echo " Options:"
|
||||||
|
echo " <APPLICATION> : The name of the desktop file."
|
||||||
|
echo " Example: use \"qbrew\" to edit qbrew.desktop"
|
||||||
|
echo " If APPLICATION has multiple desktop files, try the exact path"
|
||||||
|
echo " to the desktop file."
|
||||||
|
echo " Example: use \"%suse_update_desktop_file \\"
|
||||||
|
echo " %{buildroot}%{_datadir}/susehelp/meta/%name/%name.desktop\""
|
||||||
|
echo " to edit the susehelp desktop entry file instead."
|
||||||
|
echo " -u|--unimportant : add \"X-SuSE-Unimportant=true\" to the resulting desktop"
|
||||||
|
echo " file."
|
||||||
|
echo " -n|--no-i18n : Do not prepare the desktop file for translators (obsoletes -t)."
|
||||||
|
echo " (adds X-SuSE-translate=false to the desktop file)"
|
||||||
|
echo " -t|--trim-i18n : Trim translations (desktops will use gettext to find them)"
|
||||||
|
echo " otherwise upstream translations are preferred."
|
||||||
|
echo " -i|--install : Install an existing desktop file in /usr/share/applications/"
|
||||||
|
echo " The to be installed desktop file can be located in:"
|
||||||
|
echo " - RPM_SOURCE_DIR or"
|
||||||
|
echo " - RPM_BUILD_DIR"
|
||||||
|
echo " A referenced icon file (ending *.png; *.xpm) is installed in"
|
||||||
|
echo " /usr/share/pixmaps/ automatically if it is located in one of the "
|
||||||
|
echo " directories mentioned above (-maxdepth 1)."
|
||||||
|
echo " -r|--reset : Reset the \"Categories\" line in an existing desktop file."
|
||||||
|
echo " Normally, categories mentioned in an existing desktop file will be"
|
||||||
|
echo " obtained. Additional categories from commandline are added."
|
||||||
|
echo " -d|--docid <string> : Add \"X-SuSE-DocTeamID=<string>\" to the desktop file."
|
||||||
|
echo " -D|--docpath <path> : Add \"DocPath=<path>\" to the desktop file - do not guess it"
|
||||||
|
echo " automatically."
|
||||||
|
echo " -c|--create <name> : Create a new desktop file in /usr/share/applications/<name>.desktop ."
|
||||||
|
echo " -C|--comment <string> : Use <string> as \"Comment=<string>\" in desktop file."
|
||||||
|
echo " -N|--name <string> : Use <string> as \"Name=<string>\" in desktop file."
|
||||||
|
echo " -G|--genericname <string> : Use <string> as \"GenericName=<string>\" in desktop file."
|
||||||
|
echo " --basedir <path> : needed only for -t; normally %_srcrpmdir"
|
||||||
|
echo " --project <string> : set some default values for <string> if any."
|
||||||
|
echo ""
|
||||||
|
exit $exitcode
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while [ "${1:0:1}" = "-" ]; do
|
while [ "${1:0:1}" = "-" ]; do
|
||||||
case ${1} in
|
case ${1} in
|
||||||
|
-h|--help)
|
||||||
|
usage 0 ;;
|
||||||
-u|--unimportant)
|
-u|--unimportant)
|
||||||
UNIMPORTANT=yes
|
UNIMPORTANT=yes
|
||||||
shift
|
shift
|
||||||
@ -89,7 +144,7 @@ while [ "${1:0:1}" = "-" ]; do
|
|||||||
continue;;
|
continue;;
|
||||||
*)
|
*)
|
||||||
echo "UNKNOWN OPTION: $1"
|
echo "UNKNOWN OPTION: $1"
|
||||||
exit 1 ;;
|
usage 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -114,9 +169,9 @@ if [ "$CREATE" = "yes" ]; then
|
|||||||
ICON="$1"
|
ICON="$1"
|
||||||
shift
|
shift
|
||||||
if [ -z "$NAME" -o -z "$EXEC" ]; then
|
if [ -z "$NAME" -o -z "$EXEC" ]; then
|
||||||
echo ERROR: after --create you should define
|
echo "ERROR: after --create you should define" >&2
|
||||||
echo DESKTOP_FILE_NAME NAME GENERICNAME EXECUTABLE \[ ICON CATEGORIES... \]
|
echo " DESKTOP_FILE_NAME NAME GENERICNAME EXECUTABLE \[ ICON CATEGORIES... \]" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
mkdir -p $RPM_BUILD_ROOT/usr/share/applications/
|
mkdir -p $RPM_BUILD_ROOT/usr/share/applications/
|
||||||
cat > $RPM_SOURCE_DIR/$APPLICATION.desktop << EOF
|
cat > $RPM_SOURCE_DIR/$APPLICATION.desktop << EOF
|
||||||
@ -150,9 +205,9 @@ while [ "$1" ]; do
|
|||||||
done
|
done
|
||||||
CATEGORIES="${CATEGORIES#;}"
|
CATEGORIES="${CATEGORIES#;}"
|
||||||
if [ -z "$APPLICATION" ]; then
|
if [ -z "$APPLICATION" ]; then
|
||||||
echo ERROR: suse_update_desktop_file: no application argument given
|
echo "ERROR: suse_update_desktop_file: no application argument given" >&2
|
||||||
echo Example: use "qbrew" to edit qbrew.desktop
|
echo " Example: use "qbrew" to edit qbrew.desktop" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -171,8 +226,8 @@ else
|
|||||||
FILE_=`find $DIRS -name $APPLICATION.desktop`
|
FILE_=`find $DIRS -name $APPLICATION.desktop`
|
||||||
fi
|
fi
|
||||||
if [ -z "$FILE_" ]; then
|
if [ -z "$FILE_" ]; then
|
||||||
echo ERROR: suse_update_desktop_file: unable to find $APPLICATION
|
echo "ERROR: suse_update_desktop_file: unable to find $APPLICATION" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
FILE=""
|
FILE=""
|
||||||
for i in $FILE_; do
|
for i in $FILE_; do
|
||||||
@ -185,8 +240,8 @@ for i in $FILE_; do
|
|||||||
sed -e 's/
//' "$i" > "${i}_" && mv "${i}_" "$i"
|
sed -e 's/
//' "$i" > "${i}_" && mv "${i}_" "$i"
|
||||||
|
|
||||||
if [ "$FILE" ]; then
|
if [ "$FILE" ]; then
|
||||||
echo ERROR: suse_update_desktop_file: $APPLICATION has multiple desktop files
|
echo "ERROR: suse_update_desktop_file: $APPLICATION has multiple desktop files" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
FILE=$i
|
FILE=$i
|
||||||
done
|
done
|
||||||
@ -198,7 +253,7 @@ if echo $FILE | grep -q /opt/kde3/share/applnk/ ; then
|
|||||||
if ! echo $FILE | grep -q /opt/kde3/share/applnk/.hidden/ ; then
|
if ! echo $FILE | grep -q /opt/kde3/share/applnk/.hidden/ ; then
|
||||||
if ! echo $FILE | grep -q /opt/kde3/share/applnk/Settings/ ; then
|
if ! echo $FILE | grep -q /opt/kde3/share/applnk/Settings/ ; then
|
||||||
if ! echo $FILE | grep -q /opt/kde3/share/applnk/System/ScreenSavers/ ; then
|
if ! echo $FILE | grep -q /opt/kde3/share/applnk/System/ScreenSavers/ ; then
|
||||||
echo WARNING: file is in old KDE legacy path, moving it to XDG path
|
echo "WARNING: file is in old KDE legacy path, moving it to XDG path"
|
||||||
mkdir -p $RPM_BUILD_ROOT/opt/kde3/share/applications/kde/
|
mkdir -p $RPM_BUILD_ROOT/opt/kde3/share/applications/kde/
|
||||||
mv "$FILE" $RPM_BUILD_ROOT/opt/kde3/share/applications/kde/
|
mv "$FILE" $RPM_BUILD_ROOT/opt/kde3/share/applications/kde/
|
||||||
FILE="$RPM_BUILD_ROOT/opt/kde3/share/applications/kde/${FILE##*/}"
|
FILE="$RPM_BUILD_ROOT/opt/kde3/share/applications/kde/${FILE##*/}"
|
||||||
@ -211,8 +266,8 @@ fi
|
|||||||
# validate file
|
# validate file
|
||||||
#
|
#
|
||||||
if [ ! -r "$FILE" ]; then
|
if [ ! -r "$FILE" ]; then
|
||||||
echo ERROR: suse_update_desktop_file: unable to read $FILE
|
echo "ERROR: suse_update_desktop_file: unable to read $FILE" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
# esp. for susehelp
|
# esp. for susehelp
|
||||||
FILE_DOCPATH=`sed -n -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,;, ,g' -e 's,^DocPath=\\(.*\\),\\1,p' ${FILE}`
|
FILE_DOCPATH=`sed -n -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,;, ,g' -e 's,^DocPath=\\(.*\\),\\1,p' ${FILE}`
|
||||||
@ -242,7 +297,7 @@ for i in $CATIN; do
|
|||||||
mapCategory $i
|
mapCategory $i
|
||||||
if [ -z "$ret" ]; then
|
if [ -z "$ret" ]; then
|
||||||
echo "WARNING: Category \"$i\" is unknown \!"
|
echo "WARNING: Category \"$i\" is unknown \!"
|
||||||
echo WARNING: it is ignored, until you registered a Category at adrian@suse.de .
|
echo WARNING: it is ignored, until you registered a Category at opensuse-packaging@opensuse.org .
|
||||||
else
|
else
|
||||||
echo "$CAT" | grep -q "[=;]$i;" || CAT="$CAT$ret;"
|
echo "$CAT" | grep -q "[=;]$i;" || CAT="$CAT$ret;"
|
||||||
fi
|
fi
|
||||||
@ -303,8 +358,8 @@ if [ -n "$DOCPATH" ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -q ^X-SuSE-translate= $FILE; then
|
if grep -q ^X-SuSE-translate= $FILE; then
|
||||||
echo "ERROR: $FILE contains X-SuSE-translate - called the macro twice?"
|
echo "ERROR: $FILE contains X-SuSE-translate - called the macro twice?" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$NAME" != "no" ]; then
|
if [ "$NAME" != "no" ]; then
|
||||||
@ -349,8 +404,8 @@ fi
|
|||||||
if [ "$I18N" = "yes" ]; then
|
if [ "$I18N" = "yes" ]; then
|
||||||
|
|
||||||
if ! iconv -f utf-8 -t utf-8 $FILE &> /dev/null ; then
|
if ! iconv -f utf-8 -t utf-8 $FILE &> /dev/null ; then
|
||||||
echo "ERROR: $FILE is not an UTF-8 file"
|
echo "ERROR: $FILE is not an UTF-8 file" >&2
|
||||||
exit 1
|
usage 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRIM" = "yes" ]; then
|
if [ "$TRIM" = "yes" ]; then
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 8 16:35:32 CEST 2009 - lrupp@suse.de
|
||||||
|
|
||||||
|
- added first usage()
|
||||||
|
- fix email
|
||||||
|
- print errors to stderr
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed May 20 19:55:00 CEST 2009 - cmorve69o@yahoo.es
|
Wed May 20 19:55:00 CEST 2009 - cmorve69o@yahoo.es
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
Name: update-desktop-files
|
Name: update-desktop-files
|
||||||
Version: 11.1
|
Version: 11.1
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: A Build Tool to Update Desktop Files
|
Summary: A Build Tool to Update Desktop Files
|
||||||
License: GPL v2 or later
|
License: GPL v2 or later
|
||||||
Group: Development/Tools/Building
|
Group: Development/Tools/Building
|
||||||
@ -64,6 +64,10 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
/etc/rpm/*
|
/etc/rpm/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jun 08 2009 lrupp@suse.de
|
||||||
|
- added first usage()
|
||||||
|
- fix email
|
||||||
|
- print errors to stderr
|
||||||
* Wed May 20 2009 cmorve69o@yahoo.es
|
* Wed May 20 2009 cmorve69o@yahoo.es
|
||||||
- fix error message when an unknown category is found
|
- fix error message when an unknown category is found
|
||||||
* Sun Nov 02 2008 coolo@suse.de
|
* Sun Nov 02 2008 coolo@suse.de
|
||||||
|
Loading…
Reference in New Issue
Block a user