2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
8 PACKAGE_NAME=arvados-api-server
9 API_GEMS_LS="$(mktemp --tmpdir api-gems-XXXXXX.list)"
10 trap 'rm -f "$API_GEMS_LS"' EXIT INT TERM QUIT
12 cd "/var/www/${PACKAGE_NAME%-server}"
15 cat /lib/systemd/system/arvados-railsapi.service.d/*.conf
19 local when="$1"; shift
20 env -C shared/vendor_bundle/ruby ls -1 >"$API_GEMS_LS"
21 local ls_count="$(wc -l <"$API_GEMS_LS")"
22 if [ "$ls_count" = 1 ]; then
25 echo "Package $PACKAGE_NAME FAILED: $ls_count gem directories created after $when:" >&2
26 case "${ARVADOS_DEBUG:-0}" in
27 0) cat "$API_GEMS_LS" >&2 ;;
28 *) env -C shared/vendor_bundle/ruby find -maxdepth 3 -type d -ls >&2 ;;
34 local expect_exit="$1"; shift
36 grep "$@" >/dev/null || actual_exit=$?
37 if [ "$actual_exit" -eq "$expect_exit" ]; then
40 echo "Package $PACKAGE_NAME FAILED: \`grep" "$@" "\` returned exit code $actual_exit" >&2
41 case "$actual_exit" in
43 *) return "$actual_exit" ;;
47 env -C current bundle list >"$ARV_PACKAGES_DIR/$PACKAGE_NAME.gems"
48 check_gem_dirs "initial install"
52 cat_dropins | expect_grep 0 -x SupplementaryGroups=www-data
55 cat_dropins | expect_grep 1 "^SupplementaryGroups="
56 microdnf --assumeyes install nginx
57 microdnf --assumeyes reinstall "$PACKAGE_NAME" || test $? -eq 1
58 check_gem_dirs "package reinstall"
59 cat_dropins | expect_grep 0 -x SupplementaryGroups=nginx
62 echo "$0: WARNING: Unknown target '$TARGET'." >&2