Commit 182bacb7 authored by Matija Čupić's avatar Matija Čupić

Fix shellcheck errors

parent 28745521
#!/bin/sh
if [ "${TEST_IMAGE}" = "" ]; then
if [ -z "${TEST_IMAGE}" ]; then
echo "TEST_IMAGE variable must not be empty and must contain an image name"
exit 1
fi
build_cache_archive=./latest_image.tar
build_cache_archive="./latest_image.tar"
case "$1" in
load)
if [[ -f $build_cache_archive ]]; then
if [ -f "${build_cache_archive}" ]; then
echo "Loading cached layers"
docker load < $build_cache_archive
docker load < "${build_cache_archive}"
# Removing the archive (> 1GB!) so it will not be sent
# to the docker build context
rm $build_cache_archive
rm "${build_cache_archive}"
fi
;;
store)
echo "Caching layers"
docker save $TEST_IMAGE $(docker history -q $TEST_IMAGE | grep -v "<missing>") > $build_cache_archive
docker save "${TEST_IMAGE} $(docker history -q "${TEST_IMAGE}" | grep -v "<missing>") > ${build_cache_archive}"
;;
build)
docker build -t $TEST_IMAGE .
docker build -t "${TEST_IMAGE}" .
;;
publish)
docker login --username gitlab-ci-token --password $CI_BUILD_TOKEN registry.gitlab.com
docker push $TEST_IMAGE
docker login --username gitlab-ci-token --password "${CI_BUILD_TOKEN}" registry.gitlab.com
docker push "${TEST_IMAGE}"
docker logout registry.gitlab.com
;;
*)
echo "Usage: $0 [load|store|build|publish]"
exit 1
;;
esac
\ No newline at end of file
esac
#!/bin/sh
# Try to read the gitlab-workhorse host:port from the environments
if [ x$host = x ]; then
if [ "x${host}" = x ]; then
# Try a host file
host=$(cat host 2>/dev/null)
host="$(cat host 2>/dev/null)"
fi
if [ x$port = x ] ; then
if [ "x${port}" = x ]; then
# Try a port file
port=$(cat port 2>/dev/null)
port="$(cat port 2>/dev/null)"
fi
# Fall back to localhost:3000
host=${host:-localhost}
port=${port:-3000}
host="${host:-localhost}"
port="${port:-3000}"
print_port() {
printf "
......@@ -46,7 +46,7 @@ print_port() {
}
foreman_start() {
exec env port=${port} host=${host} foreman start "$@"
exec env port="${port}" host="${host}" foreman start "$@"
}
db() {
......@@ -67,7 +67,7 @@ grafana() {
}
thin() {
exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket=$(pwd)/gitlab.socket start
exec /usr/bin/env RAILS_ENV=development support/exec-cd gitlab bundle exec thin --socket="$(pwd)"/gitlab.socket start
}
gitaly() {
......
#!/bin/sh
for db in gitlabhq_development gitlabhq_test ; do
for db in gitlabhq_development gitlabhq_test; do
cat <<EOF
\connect ${db}
CREATE EXTENSION pg_trgm;
EOF
done | psql -h $(pwd)/postgresql -d template1
done | psql -h "$(pwd)"/postgresql -d template1
#!/bin/sh
set -e # exit on uncaught failure
remote_name=upstream
remote_name="upstream"
cd ./gitlab
if git remote | grep -q '^upstream$' ; then
echo "Remote '${remote_name}' already exists in $(pwd). Exiting."
if git remote | grep -q '^upstream$'; then
echo "Remote ${remote_name} already exists in $(pwd). Exiting."
exit 0
fi
git remote add ${remote_name} ${gitlab_upstream:-https://gitlab.com/gitlab-org/gitlab-ce.git}
git remote set-url --push ${remote_name} none # make 'upstream' fetch-only
git fetch ${remote_name} master
git remote add "${remote_name} ${gitlab_upstream:-https://gitlab.com/gitlab-org/gitlab-ce.git}"
git remote set-url --push "${remote_name}" none # make 'upstream' fetch-only
git fetch "${remote_name}" master
# check if the 'master' branch already exists
if git show-ref --verify --quiet refs/heads/master ; then
git branch --set-upstream-to=${remote_name}/master master
if git show-ref --verify --quiet refs/heads/master; then
git branch --set-upstream-to="${remote_name}"/master master
else
git branch master ${remote_name}/master
git branch master "${remote_name}"/master
fi
......@@ -11,12 +11,13 @@
/usr/sbin/sshd -o MaxAuthTries=10 -o UseDNS=no
#signal handler, clean termination
trap "kill `cat /var/run/sshd.pid`; exit 0" TERM INT QUIT HUP
trap 'kill "$(cat /var/run/sshd.pid); exit 0' TERM INT QUIT HUP
#wait for termination or crash
cnt=1
while [ $cnt -eq 1 ]; do
cnt=$(ps -ax | grep `cat /var/run/sshd.pid` | grep -v grep | wc -l)
# shellcheck disable=SC2009
cnt="$(ps -ax | grep "$(cat /var/run/sshd.pid)" | grep -v -c grep )"
sleep 2
done
#some crash or similar thing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment