File: upgrade

package info (click to toggle)
puppetdb 8.8.1-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 19,692 kB
  • sloc: javascript: 23,285; ruby: 5,620; sh: 3,457; python: 389; xml: 114; makefile: 38
file content (33 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

set -e

# Note: the variables here may look generic, but are currently
# exported by the puppet packaging scripts.  For example, even though
# they may look like it, JAVA_BIN and JAVA_ARGS are not upstream java
# variables (like JAVA_OPTS), but are set and exported by puppet.  And
# the USER variable here is not the bash variable of the same name,
# but is shadowing/clobbering it.  Most/all of these should be renamed
# to something less generic like PDB_CONFIG_FILE, or better yet (for
# that particular one), perhaps puppetdb should just support the
# variable itself.

cli_defaults=${INSTALL_DIR}/cli/cli-defaults.sh
CLASSPATH=${INSTALL_DIR}/puppetdb.jar

if [ -e "$cli_defaults" ]; then
  . "$cli_defaults"
  if [ $? -ne 0 ]; then
    echo "Unable to initialize cli defaults, failing start." 1>&2
    exit 1
  fi
fi

cmd=($(printf "%q %s -Dlogappender=STDOUT -cp %q clojure.main -m puppetlabs.puppetdb.core upgrade -c %q" \
     "$JAVA_BIN" "$JAVA_ARGS" "$CLASSPATH" "$CONFIG"))

if test "$(id -un)" = "$USER"; then
    exec "${cmd[@]}" "$@"
else
    exec su "$USER" -s /bin/sh -c "${cmd[*]} ${*}"
fi