Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert script/configure-web-proxy from POSIX sh to bash #5235

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion container/worker/launch_workers_pool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ eval set -- "$opts"

while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-s | --size ) size=$2; shift ;;
-- ) shift; break ;;
* ) break ;;
Expand Down
8 changes: 4 additions & 4 deletions script/configure-web-proxy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh -e
#!/bin/bash -e

usage() {
cat << EOF
Expand All @@ -18,7 +18,7 @@ eval set -- "$opts"
web_proxy="apache"
while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-p | --proxy ) web_proxy=${2#*=}; shift ;;
-- ) shift; break ;;
* ) break ;;
Expand All @@ -27,11 +27,11 @@ done

sed -i -e 's/^.*httpsonly.*$/httpsonly = 0/g' /etc/openqa/openqa.ini

if [ "$web_proxy" = "nginx" ] ; then
if [[ $web_proxy == "nginx" ]] ; then
echo "Setting up nginx"
sed "s/openqa.example.com/$(hostname)/" /etc/nginx/vhosts.d/openqa.conf.template > /etc/nginx/vhosts.d/openqa.conf
sed -i -e "s/\(^[^#]*server_name localhost;\)/#\1/" /etc/nginx/nginx.conf
elif [ "$web_proxy" = "apache" ] || [ "$web_proxy" = "apache2" ] ; then
elif [[ $web_proxy == "apache" || $web_proxy == "apache2" ]] ; then
echo "Setting up apache"
for i in headers proxy proxy_http proxy_wstunnel rewrite ; do a2enmod $i ; done
sed "s/#ServerName.*$/ServerName $(hostname)/" /etc/apache2/vhosts.d/openqa.conf.template > /etc/apache2/vhosts.d/openqa.conf
Expand Down
14 changes: 7 additions & 7 deletions script/fetchneedles
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
printf "Get %s tests and needles from:\n\t\t%s\n" "${dist_name}" "${giturl}"
if [ 1 = ${needles_separate} ] ; then
if [ "$needles_separate" = 1 ] ; then
printf "\tand\t%s\n" "${needles_giturl}"
fi
printf "\n(environment variables mentioned in '%s' can be set to change these values)\n" "$0"
Expand All @@ -34,7 +34,7 @@ if [ -w / ]; then
chown "$dbuser:$dbgroup" "$dir/$dist"
fi
echo "running as root, re-exec as $dbuser ..."
exec sudo -u $dbuser env \
exec sudo -u "$dbuser" env \
dist="$dist" \
giturl="$giturl" \
branch="$branch" \
Expand Down Expand Up @@ -85,12 +85,12 @@ git_update() {
# For needles repos because of needle saving we might end up in conflict, i.e.
# detached HEAD so we need to repair this
git_update_needles() {
git_update $needles_branch
git_update "$needles_branch"
if [ "$(git rev-parse --abbrev-ref --symbolic-full-name HEAD)" = "HEAD" ]; then
git branch -D $needles_branch
git checkout -b $needles_branch
git branch --set-upstream-to=origin/$needles_branch $needles_branch
git push origin HEAD:$needles_branch
git branch -D "$needles_branch"
git checkout -b "$needles_branch"
git branch "--set-upstream-to=origin/$needles_branch" "$needles_branch"
git push origin "HEAD:$needles_branch"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion script/openqa-auto-update
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ opts=$(getopt -o h --long help -n "$0" -- "$@") || usage 1
eval set -- "$opts"
while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-- ) shift; break ;;
* ) break ;;
esac
Expand Down
4 changes: 2 additions & 2 deletions script/openqa-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if [ -z "$running_systemd" ]; then
else
systemctl enable --now postgresql
fi
su postgres -c "/usr/share/openqa/script/setup-db" $dbuser $dbname
su postgres -c "/usr/share/openqa/script/setup-db" "$dbuser" "$dbname"

# setup webserver and fake-auth
[[ -n "$setup_web_proxy" ]] && proxy_args="--proxy=$setup_web_proxy"
Expand Down Expand Up @@ -92,7 +92,7 @@ if [ -z "$skip_suse_tests" ]; then
echo "cloning $sles_needles_giturl shallow. Call 'git fetch --unshallow' for full history"
git clone --depth 1 "$sles_needles_giturl" "$sles_needles_directory"
fi
chown -R $dbuser: /var/lib/openqa/tests/opensuse/products/sle/needles
chown -R "$dbuser:" /var/lib/openqa/tests/opensuse/products/sle/needles
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion script/openqa-check-devel-repo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ opts=$(getopt -o h --long help -n "$0" -- "$@") || usage 1
eval set -- "$opts"
while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-- ) shift; break ;;
* ) break ;;
esac
Expand Down
2 changes: 1 addition & 1 deletion script/openqa-clone-custom-git-refspec
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ eval set -- "$opts"
while true; do
case "$1" in
-v | --verbose ) set -x; shift ;;
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-n | --dry-run ) dry_run=true; shift ;;
-c | --clone-job-args ) clone_args="$2 $clone_args"; shift 2 ;;
-- ) shift; break ;;
Expand Down
2 changes: 1 addition & 1 deletion script/openqa-continuous-update
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ opts=$(getopt -o h --long help -n "$0" -- "$@") || usage 1
eval set -- "$opts"
while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-- ) shift; break ;;
* ) break ;;
esac
Expand Down
2 changes: 1 addition & 1 deletion script/openqa-rollback
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ opts=$(getopt -o hn --long help,dry-run -n "$0" -- "$@") || usage 1
eval set -- "$opts"
while true; do
case "$1" in
-h | --help ) usage 0; shift ;;
-h | --help ) usage 0 ;;
-n | --dry-run ) dry_run="--dry-run"; shift ;;
-- ) shift; break ;;
* ) break ;;
Expand Down
2 changes: 1 addition & 1 deletion tools/js-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ opts=$(getopt -o h --long help -n "$0" -- "$@") || usage
eval set -- "$opts"
while true; do
case "$1" in
-h | --help ) usage; shift ;;
-h | --help ) usage ;;
* ) break ;;
esac
done
Expand Down
2 changes: 1 addition & 1 deletion tools/tidy
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ opts=$(getopt -o hcfol --long help,check,force,only-changed,list -n "$0" -- "$@"
eval set -- "$opts"
while true; do
case "$1" in
-h | --help ) usage; shift ;;
-h | --help ) usage ;;
-c | --check ) args+=' --check-only'; shift ;;
-f | --force ) force=true; shift ;;
-o | --only-changed ) selection='--git'; shift ;;
Expand Down
Loading