Skip to content

Commit 28b6c96

Browse files
authored
Merge pull request #195 from linuxserver/sedescape
further sanitize sed replace
2 parents 99e2bec + e0f1e7c commit 28b6c96

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ app_setup_block: |
113113
114114
# changelog
115115
changelogs:
116+
- { date: "31.10.23:", desc: "Further sanitize sed replace." }
116117
- { date: "07.06.23:", desc: "Add mariadb-client for bookstack-system-cli support." }
117118
- { date: "25.05.23:", desc: "Rebase to Alpine 3.18, deprecate armhf." }
118119
- { date: "13.04.23:", desc: "Move ssl.conf include to default.conf." }

root/etc/s6-overlay/s6-rc.d/init-bookstack-config/run

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ if [[ -n "${DB_HOST}" ]]; then
8686

8787
sed -i -E "s/^[#]?DB_HOST=.*/DB_HOST='${DB_HOST}'/g" /config/www/.env
8888
sed -i -E "s/^[#]?DB_PORT=.*/DB_PORT='${DB_PORT}'/g" /config/www/.env
89-
sed -i -E "s/^[#]?DB_DATABASE=.*/DB_DATABASE='${DB_DATABASE}'/g" /config/www/.env
90-
sed -i -E "s/^[#]?DB_USERNAME=.*/DB_USERNAME='${DB_USER}'/g" /config/www/.env
91-
sed -i -E "s/^[#]?DB_PASSWORD=.*/DB_PASSWORD='${DB_PASS//&/\\&}'/g" /config/www/.env
89+
SED_DB_DATABASE=$(sed -e 's|[&\\/]|\\&|g; s|$|\\|; $s|\\$||' <<<"${DB_DATABASE}")
90+
sed -i -E "s/^[#]?DB_DATABASE=.*/DB_DATABASE='${SED_DB_DATABASE}'/g" /config/www/.env
91+
SED_DB_USER=$(sed -e 's|[&\\/]|\\&|g; s|$|\\|; $s|\\$||' <<<"${DB_USER}")
92+
sed -i -E "s/^[#]?DB_USERNAME=.*/DB_USERNAME='${SED_DB_USER}'/g" /config/www/.env
93+
SED_DB_PASS=$(sed -e 's|[&\\/]|\\&|g; s|$|\\|; $s|\\$||' <<<"${DB_PASS}")
94+
sed -i -E "s/^[#]?DB_PASSWORD=.*/DB_PASSWORD='${SED_DB_PASS}'/g" /config/www/.env
9295
fi
9396

9497
# set appurl

0 commit comments

Comments
 (0)