File: inserticonWithoutTarget.sh

package info (click to toggle)
whitedune 0.30.10-2.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 42,004 kB
  • sloc: cpp: 116,017; ansic: 79,688; java: 20,101; sh: 3,248; yacc: 2,902; makefile: 1,717; lex: 848; awk: 363; perl: 270; objc: 143; lisp: 112; python: 22
file content (52 lines) | stat: -rwxr-xr-x 1,391 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash

# This file is free software; the Free Software Foundation    
# gives unlimited permission to copy, distribute and modify it.

HERE=`dirname $0`

GIMP12=$HOME/.gimp-1.2/scripts
GIMP22=$HOME/.gimp-2.2/scripts
GIMP24=$HOME/.gimp-2.4/scripts

if `test -d $GIMP12`; then
  VERSION=-gimp1_2
  GIMP=$GIMP12
else 
  if `test -d $GIMP22`; then
    VERSION=-gimp2_2
    GIMP=$GIMP22
  else 
    if `test -d $GIMP24`; then
      VERSION=-gimp2_4
      GIMP=$GIMP24
    else
      echo $HOME/.gimp/scripts not found 1>&2
      exit 1 
    fi
  fi
fi

if `test ! -d $GIMP`; then
  echo did not found gimp script directory 1>&2
  exit 1 
fi

cp $HERE/inserticon$VERSION.scm $GIMP/inserticon.scm

POSITION=`awk -v what=$1 '$1 ~ /VRML_/ {if (startcount) count++} /X3D_/ {if (startcount) count++} /DUNE_/ {if (startcount) count++} /COVER_/ {if (startcount) count++} /KAMBI_/ {if (startcount) count++} /enum NodeEnum/ {startcount = 1} { if ($1 == what ",") {print count;exit(0)}}' $HERE/../src/Node.h`

if test "$POSITION" = "" ; then
   echo $1 not found in Node.h
   exit 1
fi

export ICON=\"/tmp/node_icons.bmp\"
cp $HERE/../src/res/node_icons$TARGET.bmp /tmp/node_icons.bmp &&
gimp --no-data --verbose -b "(script-fu-new-duneInsertIcon-batch $ICON $POSITION)" 
if test $? = 0 ;then
   mv /tmp/node_icons.bmp $HERE/../src/res/node_icons$TARGET.bmp
else
   echo gimp failed 1>&2
   exit 1
fi