Magellan Linux

Contents of /trunk/mage/usr/lib/mage/create_desktop_app.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 223 - (show annotations) (download) (as text)
Fri Sep 9 16:34:35 2005 UTC (18 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1672 byte(s)
added ${MROOT} support for upcoming mage-0.4.x

1 #!/bin/bash
2 # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/create_desktop_app.sh,v 1.7 2005-09-09 16:34:35 niro Exp $
3
4 usage()
5 {
6 echo
7 echo "Usage: $0 --command [args] ..."
8 echo
9 echo " -n, --name [name] name of the desktop file"
10 echo " -m, --comment [comment] comment to the programm"
11 echo " -e, --exec [executable] /path/to/the/executable"
12 echo " -i, --icon [icon] icon of the desktop file"
13 echo " -c, --categorie [categorie] categories of the program"
14 echo " -n, --notify enables notify"
15 echo " -t, --terminal runs the program in a terminal"
16 echo
17 exit 1
18 }
19
20 [ $# -lt 1 ] && usage
21
22
23 # default values
24 d_name=""
25 d_comment=""
26 d_exec=""
27 d_icon=""
28 d_categorie=""
29 d_notify="true"
30 d_terminal="true"
31
32 # very basic getops
33 for i in $*
34 do
35 case $1 in
36 --name|-n) shift; d_name="$1" ;;
37 --comment|-m) shift; d_comment="$1" ;;
38 --exec|-e) shift; d_exec="$1" ;;
39 --icon|-i) shift; d_icon="$1" ;;
40 --categorie|c) shift; d_categorie="$1" ;;
41 --notify|f) d_notify="true" ;;
42 --terminal|-t) d_terminal="true" ;;
43 esac
44 shift
45 done
46
47 # sanity checks; abort if not given
48 [ -z "${d_name}" ] && usage
49 [ -z "${d_exec}" ] && usage
50 [ -z "${d_categorie}" ] && usage
51 [ -z "${d_notify}" ] && d_notify="false"
52 [ -z "${d_terminal}" ] && d_terminal="false"
53
54 [ ! -d ${MROOT}/usr/share/applications ] && \
55 install -d ${MROOT}/usr/share/applications
56
57 echo "[Desktop Entry]
58 Encoding=UTF-8
59 Name=${d_name}
60 Comment=${d_comment}
61 Exec=${d_exec}
62 Icon=${d_icon}
63 Terminal=${d_terminal}
64 Type=Application
65 Categories=${d_categorie}
66 StartupNotify=${d_notify}
67 " > ${MROOT}/usr/share/applications/${d_name}.desktop

Properties

Name Value
svn:executable *