File: zekr.sh

package info (click to toggle)
zekr 1.1.0+repack-2.1
  • links: PTS, VCS
  • area: non-free
  • in suites: stretch
  • size: 8,544 kB
  • ctags: 4,170
  • sloc: java: 24,442; xml: 12,606; sh: 205; makefile: 13
file content (109 lines) | stat: -rw-r--r-- 3,613 bytes parent folder | download | duplicates (2)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh

args=$*

ZEKR_WORKSPACE=~/.zekr

# Parse arguments:
while [ ! -z $1 ]; do
  case "$1" in
    -workspace)
      ZEKR_WORKSPACE=$2
      shift
      ;;
    -index)
      ZEKR_WARNINGS="disable"
      [ ! "$2" = "all" ] || NO_WORKSPACE=1
      shift
      ;;
    -clean)
      ZEKR_WARNINGS="disable"
      [ ! "$2" = "index-all" ] || NO_WORKSPACE=1
      shift
      ;;
  esac
  shift
done

# If workspace dir. does not exist, create it:
[ -d "${ZEKR_WORKSPACE}" ] || [ $NO_WORKSPACE ] || mkdir -p ${ZEKR_WORKSPACE}

ZEKR_CONF_FILE=${ZEKR_WORKSPACE}/zekrrc-debian

# Source system wide configuration file first,
[ ! -f /etc/zekr/zekrrc ] || . /etc/zekr/zekrrc
# then user configuration file
[ ! -f ${ZEKR_CONF_FILE} ] || . ${ZEKR_CONF_FILE}

# Check if suitable Qur'an font is available:
if [ ! "${ZEKR_WARNINGS}" = "disable" ]; then
  MEQRN=1
  if [ -z $(fc-list me_quran) ]; then
    MEQRN=0
    zenity --warning \
      --title="ttf-me-quran is not installed." \
      --text="Uthman-Taha experimental theme cannot be used.\nInstall ttf-me-quran to enable Uthman-Taha theme."
  fi
  if [ "$MEQRN" -eq 0 ]; then
    zenity --question \
      --title="Show Warning messages Next Time" \
      --text="Do you want to leave warning message enabled?"

    if [ $? -eq 1 ]; then
      if grep ZEKR_WARNINGS "${ZEKR_CONF_FILE}" > /dev/null 2>&1 ; then
        sed 's/ *ZEKR_WARNINGS.*=.*/ZEKR_WARNINGS=disable/' -i "${ZEKR_CONF_FILE}"
      else
        echo 'ZEKR_WARNINGS=disable' >> "${ZEKR_CONF_FILE}"
      fi

    fi
  fi
fi


# using eclipse's method for setting ZEKR_JAVA_HOME
# If the user has not set ZEKR_JAVA_HOME, cycle through our list of compatible VM's
# and pick the first one that exists.
if [ -z "${ZEKR_JAVA_HOME}" -a ! -n "${ZEKR_JAVA_CMD}" ]; then
#    echo "searching for compatible vm..."
    javahomelist=`cat /etc/zekr/java_home  | grep -v '^#' | grep -v '^$' | while read line ; do echo -n $line ; echo -n ":" ; done`
    OFS="$IFS"
    IFS=":"
    for ZEKR_JAVA_HOME in $javahomelist ; do
#        echo -n "  testing ${ZEKR_JAVA_HOME}..."
        if [ -x "${ZEKR_JAVA_HOME}/bin/java" ]; then
          break
        fi
    done
    IFS="$OFS"
fi

# If we don't have a ZEKR_JAVA_HOME yet, we're doomed.
if [ -z "${ZEKR_JAVA_HOME}" -a ! -n "${ZEKR_JAVA_CMD}" ]; then
    zenity --error \
        --title="Could not launch Zekr" \
        --text="A suitable Java Virtual Machine for running the Zekr could not be located."
    exit 1
fi

# Set ZEKR_JAVA_CMD from ZEKR_JAVA_HOME
if [ -n "${ZEKR_JAVA_HOME}" -a -z "${ZEKR_JAVA_CMD}" ]; then
    ZEKR_JAVA_CMD="$ZEKR_JAVA_HOME/bin/java"
fi

run () {
MAIN_CLASS=net.sf.zekr.ZekrMain
JRE_OPT=-Djava.library.path=/usr/lib/jni/
CLASS_PATH=/usr/share/java/log4j-1.2.jar:/usr/share/java/swt.jar:/usr/share/java/commons-collections3.jar:/usr/share/java/commons-codec.jar:/usr/share/java/commons-configuration.jar:/usr/share/java/commons-lang.jar:/usr/share/java/commons-io.jar:/usr/share/java/commons-logging.jar:/usr/share/java/velocity.jar:/usr/share/java/lucene-highlighter.jar:/usr/share/java/lucene-core.jar:/usr/share/java/lucene-snowball.jar:/usr/share/java/lucene-memory.jar:/usr/share/java/lucene-misc.jar:/usr/share/java/jl.jar:/usr/share/java/basicplayer.jar:/usr/share/java/tritonus_share.jar:/usr/share/java/jorbis.jar:/usr/share/java/jogg.jar:/usr/share/java/jspeex.jar:/usr/share/java/mp3spi.jar:/usr/share/java/vorbisspi.jar:dist/zekr.jar:
VM_ARGS="-Xms10m -Xmx80m ${EXTRA_VM_ARGS}"

"$ZEKR_JAVA_CMD" $VM_ARGS -cp "$CLASS_PATH" $JRE_OPT $MAIN_CLASS $*
}

DIR_NAME=`dirname $0`
cd $DIR_NAME
cd ../share/zekr/

run $args
exit 0