Skip to content

Commit 2f1c94d

Browse files
authored
Merge pull request #6582 from Wabri/feat/openqa-bootstrap/openqa_dir_refactoring
openqa-bootstrap: Replace hardcoded openqa directory path with configurable variable
2 parents 4540875 + d612136 commit 2f1c94d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

script/openqa-bootstrap

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
set -xeuo pipefail
55

6+
OPENQA_DIR=${OPENQA_DIR:=/usr/share/openqa}
7+
68
dbname="${dbname:="openqa"}"
79
dbuser="${dbuser:="geekotest"}"
810
running_systemd=
@@ -26,24 +28,24 @@ start-database() {
2628
start-worker() {
2729
if [[ -z $running_systemd ]]; then
2830
/usr/bin/install -d -m 0755 -o _openqa-worker /var/lib/openqa/pool/1
29-
su _openqa-worker -c '/usr/share/openqa/script/worker --instance 1' &
31+
su _openqa-worker -c "$OPENQA_DIR/script/worker --instance 1" &
3032
else
3133
systemctl enable --now openqa-worker@1
3234
fi
3335
}
3436

3537
start-daemons() {
3638
if [[ -z $running_systemd ]]; then
37-
pgrep -f openqa-scheduler-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-scheduler-daemon &
38-
pgrep -f openqa-websockets-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-websockets-daemon &
39-
pgrep -f openqa-gru > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-gru &
40-
pgrep -f openqa-livehandler-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-livehandler-daemon &
39+
pgrep -f openqa-scheduler-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-scheduler-daemon" &
40+
pgrep -f openqa-websockets-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-websockets-daemon" &
41+
pgrep -f openqa-gru > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-gru" &
42+
pgrep -f openqa-livehandler-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-livehandler-daemon" &
4143
if [[ $setup_web_proxy == "nginx" ]]; then
4244
nginx
4345
else
4446
/usr/sbin/start_apache2 -k start
4547
fi
46-
pgrep -f openqa-webui-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-webui-daemon &
48+
pgrep -f openqa-webui-daemon > /dev/null || su geekotest -c "$OPENQA_DIR/script/openqa-webui-daemon" &
4749
else
4850
if [[ $setup_web_proxy == "nginx" ]]; then
4951
systemctl enable --now nginx
@@ -101,12 +103,12 @@ retry -e -s 30 -r 7 -- sh -c "zypper -n --gpg-auto-import-keys ref && zypper -n
101103
# setup database
102104
chown -R postgres: /var/lib/pgsql/ # fix broken postgres working dir permissions in the nspawn container
103105
start-database
104-
su postgres -c "/usr/share/openqa/script/setup-db" "$dbuser" "$dbname"
106+
su postgres -c "$OPENQA_DIR/script/setup-db" "$dbuser" "$dbname"
105107

106108
# setup webserver and fake-auth
107109
proxy_args=""
108110
[[ -n "$setup_web_proxy" ]] && proxy_args="--proxy=$setup_web_proxy"
109-
setup=/usr/share/openqa/script/configure-web-proxy
111+
setup=$OPENQA_DIR/script/configure-web-proxy
110112
if command -v $setup; then
111113
bash -ex $setup "$proxy_args"
112114
else
@@ -140,7 +142,7 @@ if [[ -z $skip_suse_tests ]]; then
140142
# use faster local mirror if run from within SUSE network
141143
export needles_giturl="https://gitlab.suse.de/openqa/os-autoinst-needles-opensuse-mirror.git"
142144
fi
143-
/usr/share/openqa/script/fetchneedles
145+
"$OPENQA_DIR/script/fetchneedles"
144146
if [[ ! -e /var/lib/openqa/tests/sle ]]; then
145147
ln -s opensuse /var/lib/openqa/tests/sle
146148
fi

0 commit comments

Comments
 (0)