6 echo "[exec]: FAILED." >&2
16 # ../file parent relative
21 # Remove /./ inside filename:
22 while echo "$FILE" |fgrep
"/./" >/dev
/null
2>&1; do
23 FILE
=`echo "$FILE" | sed "s/\\/\\.\\//\\//"`
25 # Remove /../ inside filename:
26 while echo "$FILE" |
grep "/[^/][^/]*/\\.\\./" >/dev
/null
2>&1; do
27 FILE
=`echo "$FILE" | sed "s/\\/[^/][^/]*\\/\\.\\.\\//\\//"`
42 myopts
="-o dn: -l name:,static:,git:,rootdir:"
43 getopt
-Q $myopts -- "$@" ||
exit 2
44 eval set -- `getopt -q $myopts -- "$@"`
46 DEPLOY_DIR
=/opt
/tomcat
/webapps
47 OPENGROK_WAR
=/opt
/opengrok
/lib
/source.war
49 PROJECT
=`basename \`pwd\
``
50 [ -z "$PROJECT" ] && PROJECT
="project"
56 while [ $# -gt 0 ]; do
68 REPO
="`full_filename \"$2\"`"
85 if [ -z "$VCS" ]; then
86 echo "Source data not set" >&2
90 [ -z "$ROOTDIR" ] && ROOTDIR
="/var/opengrok/$PROJECT"
91 [ -z "$URL" ] && URL
="source-$PROJECT"
93 $EXEC mkdir
-p "$ROOTDIR"
97 ($EXEC cd $ROOTDIR; $EXEC cp -R "$REPO" src
; ) ||
exit "$?"
100 ($EXEC cd $ROOTDIR; $EXEC git clone
"$REPO" src
; ) ||
exit "$?"
103 SRCDIR
="$ROOTDIR/src"
105 $EXEC cp "$OPENGROK_WAR" "${DEPLOY_DIR}/${URL}.war"
107 $EXEC cd "${DEPLOY_DIR}"
108 $EXEC unzip -q -d "$URL" "${URL}.war"
110 $EXEC cd "$URL/WEB-INF"
111 cat >config.tmp
<<EXTRA_CONFIG_EOF
113 <param-name>DATA_ROOT</param-name>
114 <param-value>/var/opengrok/DATA_ROOT</param-value>
115 <description>REQUIRED: Full path of the directory where data files generated by OpenGrok are stored</description>
119 <param-name>SRC_ROOT</param-name>
120 <param-value>/var/opengrok/SRC_ROOT</param-value>
121 <description>REQUIRED: Full path to source tree</description>
126 -e '/<\/listener>/r config.tmp' \
131 -e 's:/var/opengrok/\(etc/configuration.xml\):'"${ROOTDIR}"'/\1:' \
132 -e 's:/var/opengrok/DATA_ROOT:'"${ROOTDIR}"'/data:' \
133 -e 's:/var/opengrok/SRC_ROOT:'"${SRCDIR}"'/:' \
138 $EXEC cd /opt
/opengrok
/bin
139 $EXEC export OPENGROK_VERBOSE
=true
140 $EXEC export OPENGROK_EXTRA_PARAMS
="-w $URL"
141 $EXEC export OPENGROK_INSTANCE_BASE
="${ROOTDIR}"
142 $EXEC .
/OpenGrok index
"$SRCDIR"
147 echo "cd '${ROOTDIR}'"
151 echo "# no way to update"
158 echo "cd /opt/opengrok/bin"
159 echo "export OPENGROK_VERBOSE=true"
160 echo "export OPENGROK_INSTANCE_BASE='${ROOTDIR}'"
161 echo "export OPENGROK_EXTRA_PARAMS='-w $URL'"
162 echo "./OpenGrok index '$SRCDIR'"
164 ) >"$ROOTDIR/update.sh"
167 chmod +x
"$ROOTDIR/update.sh"