Skip to content

Commit 8239447

Browse files
committed
fix: shellscript errors
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 673bb92 commit 8239447

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

docker/entrypoint.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
set -eu
33

44
chown www-data:root /var/www/deploy
@@ -31,8 +31,10 @@ file_env() {
3131
local var="$1"
3232
local fileVar="${var}_FILE"
3333
local def="${2:-}"
34-
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
35-
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
34+
local varValue
35+
local fileVarValue
36+
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
37+
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
3638
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
3739
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
3840
exit 1
@@ -99,14 +101,14 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
99101
else
100102
rsync_options="-rlD"
101103
fi
102-
rsync $rsync_options --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
104+
rsync "$rsync_options" --delete --exclude-from=/upgrade.exclude /usr/src/nextcloud/ /var/www/html/
103105

104106
for dir in config data custom_apps themes; do
105107
if [ ! -d "/var/www/html/$dir" ] || directory_empty "/var/www/html/$dir"; then
106-
rsync $rsync_options --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
108+
rsync "$rsync_options" --include "/$dir/" --exclude '/*' /usr/src/nextcloud/ /var/www/html/
107109
fi
108110
done
109-
rsync $rsync_options --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
111+
rsync "$rsync_options" --include '/version.php' --exclude '/*' /usr/src/nextcloud/ /var/www/html/
110112
echo "Initializing finished"
111113

112114
#install

docker/nextcloud/sign-app.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ rm -rf ${APP_DEST} &&
1515
echo "📂 Deployment directory prepared." &&
1616
rsync -a --exclude .git* --exclude .gitlab-ci* --exclude .github --exclude screenshot* \
1717
--exclude docs --exclude tests --exclude vendor --exclude package.* --exclude composer.json --exclude composer.lock \
18-
--exclude Makefile --exclude *.db* --exclude docker --exclude *.phar \
19-
--exclude *.gz --exclude .idea --exclude .renovaterc.json --exclude .php-cs* \
18+
--exclude Makefile --exclude '*.db*' --exclude docker --exclude '*.phar' \
19+
--exclude '*.gz' --exclude .idea --exclude .renovaterc.json --exclude '.php-cs*' \
2020
--exclude phpstan.* --exclude phpunit.* --exclude psalm.xml --exclude shell.nix \
2121
--exclude .envrc --exclude .direnv --exclude term.kdl --exclude .phpunit.result.cache \
2222
--exclude justfile --exclude treefmt.toml --exclude .devenv --exclude flake.* \
@@ -37,12 +37,12 @@ rm -rf ${APP_DEST} &&
3737
--certificate=${CERT_PATH}/${APP_NAME}.crt --path=${APP_DEST}" www-data &&
3838
echo "🔐 App signed successfully." &&
3939
cp ${APP_DEST}/appinfo/signature.json ${APP_SOURCE}/appinfo &&
40-
echo "\n🔍 Reviewing files to be included in the archive:\n" &&
40+
printf "\n🔍 Reviewing files to be included in the archive:\n\n" &&
4141
find ${APP_DEST} -type f | sort &&
42-
echo "\n⏸️ Press Enter to continue with archiving.\n" &&
43-
read line &&
42+
printf "\n⏸️ Press Enter to continue with archiving.\n\n" &&
43+
read -r _ &&
4444
tar czf ${DEPLOYMENT_FILE} -C ${APP_DEST}/.. ${APP_NAME} &&
4545
echo "📦 Archive created." &&
46-
echo "\n🔐 Signature for your app archive:\n" &&
46+
printf "\n🔐 Signature for your app archive:\n\n" &&
4747
openssl dgst -sha512 -sign ${CERT_PATH}/${APP_NAME}.key ${DEPLOYMENT_FILE} | openssl base64 &&
4848
echo

docker/owncloud/sign-app.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ DEPLOYMENT_FILE=${APP_SOURCE}/${APP_NAME}-oc.tar.gz
1111

1212
rm -rf ${APP_DEST} &&
1313
mkdir ${APP_DEST} &&
14-
rsync -a --exclude .git* --exclude .gitlab-ci* --exclude .github --exclude screenshot* --exclude docs --exclude tests --exclude vendor --exclude package.* --exclude Makefile --exclude *.db* --exclude docker --exclude *.phar --exclude *.gz --exclude .idea ${APP_SOURCE}/ ${APP_DEST} &&
14+
rsync -a --exclude .git* --exclude .gitlab-ci* --exclude .github --exclude screenshot* --exclude docs --exclude tests --exclude vendor --exclude package.* --exclude Makefile --exclude '*.db*' --exclude docker --exclude '*.phar' --exclude '*.gz' --exclude .idea ${APP_SOURCE}/ ${APP_DEST} &&
1515
su -m -c "./occ integrity:sign-app \
1616
--privateKey=${CERT_PATH}/${APP_NAME}.key \
1717
--certificate=${CERT_PATH}/${APP_NAME}.crt --path=${APP_DEST}" www-data &&
1818
cp ${APP_DEST}/appinfo/signature.json ${APP_SOURCE}/appinfo &&
1919
tar cz ${APP_DEST}/../qownnotesapi/ >${DEPLOYMENT_FILE} &&
20-
echo "\nSignature for your app archive:\n" &&
20+
printf "\nSignature for your app archive:\n\n" &&
2121
openssl dgst -sha512 -sign ${CERT_PATH}/${APP_NAME}.key ${DEPLOYMENT_FILE} | openssl base64 &&
2222
echo

0 commit comments

Comments
 (0)