Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-generate-icon-info.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2360 - (hide annotations) (download)
Tue Aug 25 10:00:30 2015 UTC (8 years, 8 months ago) by niro
File size: 1647 byte(s)
-fixed missing die() function
1 niro 2358 #!/bin/bash
2    
3     MCORE_LIBDIR="@@MCORE_LIBDIR@@"
4     source @@SYSCONFDIR@@/mcore/mcore.conf
5     source ${MCORE_LIBDIR}/include/common.global.class
6    
7     GLOBAL_PIXMAPS_PATH="@@GLOBAL_PIXMAPS_PATH@@"
8     LOCAL_PIXMAPS_PATH="${MCORE_CONFIG_PATH}/icons/default"
9    
10     ICON_INFO_PATH="${MCORE_CONFIG_PATH}/icons/info"
11     ICON_INFO_SUFFIX="@@ICON_INFO_SUFFIX@@"
12    
13 niro 2360 die() { echo "ERROR: $@"; exit 1; }
14    
15 niro 2358 # very basic getops
16     for i in $*
17     do
18     case $1 in
19     --name|-n) shift; name="$1" ;;
20     --command|-c) shift; command="$1" ;;
21     --icon|-i) shift; icon="$1" ;;
22     --filename|-f) shift; filename="$1" ;;
23     --xres|-x) shift; xres="$1" ;;
24     --yres|-y) shift; yres="$1" ;;
25     --icon-width|-w) shift; iwidth="$1" ;;
26     --icon-height|-h) shift; iheight="$1" ;;
27     --default-icon) shift; deficon="$1" ;;
28     esac
29     shift
30     done
31    
32     # some sanity checks:
33    
34     # abort if name or command not given
35     [[ -z ${name} ]] && die "No name given"
36     [[ -z ${command} ]] && die "No command given"
37    
38     [[ -z ${filename} ]] && filename="${name}"
39    
40     # use some defaults for icon, dest, {x,y}res
41     [[ -z ${xres} ]] && xres=50
42     [[ -z ${yres} ]] && xres=50
43     if [[ -z ${icon} ]]
44     then
45     # if no default icon is given use default.png
46     [[ -z ${deficon} ]] && deficon="default.png"
47     icon="${deficon}"
48     fi
49    
50     CONFIG="${ICON_INFO_PATH}/${filename}.${ICON_INFO_SUFFIX}"
51     clearconfig
52    
53     addconfig "name=\"${name}\""
54     addconfig "command=\"${command}\""
55     addconfig "icon=\"${icon}\""
56     addconfig "deficon=\"${deficon}\""
57     addconfig "xres=\"${xres}\""
58     addconfig "yres=\"${yres}\""
59     if [[ -z ${iwidth} ]]
60     then
61     addconfig "iwidth=0"
62     else
63     addconfig "iwidth=\"${iwidth}\""
64     fi
65    
66 niro 2359 if [[ -z ${iheight} ]]
67 niro 2358 then
68     addconfig="iheight=0"
69     else
70     addconfig "iheight=\"${iheight}\""
71     fi