Move config templates to their own directory

This commit is contained in:
Máximo Castañeda
2018-11-24 21:17:25 +01:00
parent 6578706321
commit 038a4c1547
19 changed files with 25 additions and 27 deletions

11
.gitignore vendored
View File

@@ -81,14 +81,3 @@ tests/screenshot*.png
.freeciv_index
.idea
*.iml
# Configuration files the user is expected to create using the *.dist as base
freeciv-proxy/settings.ini
freeciv-web/flyway.properties
freeciv-web/src/main/webapp/META-INF/context.xml
freeciv-web/src/main/webapp/WEB-INF/config.properties
publite2/settings.ini
scripts/configuration.sh
scripts/config
scripts/dependency-services-start.sh
scripts/dependency-services-stop.sh

View File

@@ -67,9 +67,8 @@ running this command:
You may also want to change some parameters before installing, although
it's not needed in most cases. If you have special requirements, have a look
at [config.dist](scripts/config.dist),
at [config.dist](config/config.dist),
copy it without the `.dist` extension and edit to your liking.
Don't change the `.dist` files, they are the ones from the repo.
#### :warning: Notice for Windows users

1
config/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config

View File

@@ -18,7 +18,7 @@
# Substitutes variables from the configuration file in the templates.
# gen-from-templates [configfile [source_dir]]
# When source_dir is not given, configfile's parent is used.
# When configfile is not given, script_src_dir/../config is used.
# When configfile is not given, script_src_dir/config is used.
set -e
unset CDPATH
@@ -32,7 +32,7 @@ if [ -z "${CONFIG}" ]; then
echo >&2 "Configuration file not found."
exit 2
fi
CONFIG="${CONFIG}"/../config
CONFIG="${CONFIG}"/config
fi
if [ "${CONFIG:0:1}" = - ]; then
@@ -62,8 +62,9 @@ while IFS= read -r line; do
fi
done < "${CONFIG}" > "${TMPFILE}"
for f in "${SRCDIR}"/{freeciv-proxy,pbem}/settings.ini "${SRCDIR}"/freeciv-web/flyway.properties "${SRCDIR}"/freeciv-web/src/main/webapp/META-INF/context.xml "${SRCDIR}"/freeciv-web/src/main/webapp/WEB-INF/config.properties "${SRCDIR}"/scripts/configuration.sh; do
sed -f "${TMPFILE}" < "$f".dist > "$f"
for f in "${SRCDIR}"/config/*.tmpl; do
DEST="${SRCDIR}"/$(sed -n 's/.* LOCATION:\(.*\)/\1/p' < "$f" | head -n 1)
sed -f "${TMPFILE}" < "$f" > "${DEST}"
done
rm "${TMPFILE}"

1
freeciv-proxy/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
settings.ini

1
freeciv-web/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
flyway.properties

View File

@@ -40,11 +40,11 @@ Flyway migrations of the database is supported. Remember to set the mysql passwo
To migrate the database to the latest version, run this Maven command:
mvn flyway:migrate
The following files contains MySQL username and password, and must be set manually
if you are not using vagrant:
The following files contain DB, mail and other configuration, and must be set manually
if you are not using vagrant or the install script:
* freeciv-web/src/main/webapp/META-INF/context.xml.dist (rename to context.xml)
* freeciv-web/src/main/webapp/WEB-INF/config.properties.dist (rename to config.properties, contains capcha secret for pbem)
* freeciv-web/src/main/webapp/META-INF/context.xml (you can use config/web.context.tmpl as a template)
* freeciv-web/src/main/webapp/WEB-INF/config.properties (you can use config/web.properties.tmpl as a template)
Copyright (C) 2007-2016 Andreas Røsdal.

View File

@@ -0,0 +1 @@
context.xml

View File

@@ -0,0 +1 @@
config.properties

1
publite2/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
settings.ini

3
scripts/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
configuration.sh
dependency-services-start.sh
dependency-services-stop.sh

View File

@@ -185,19 +185,19 @@ if [ $(id -u) = 0 ]; then
exit 3
fi
if [ ! -f "${basedir}"/scripts/config ]; then
if [ ! -f "${basedir}"/config/config ]; then
if [ "${FCW_INSTALL_MODE}" = TEST ]; then
cp "${basedir}"/scripts/config{.dist,}
cp "${basedir}"/config/config{.dist,}
echo "Default config parameters used"
else
echo >&2 "Please copy scripts/config.dist to scripts/config and"
echo >&2 "Please copy config/config.dist to config/config and"
echo >&2 "edit its content to suit your needs."
exit 4
fi
fi
# Remove \r, just in case the file comes from a Windows editor that doesn't
# respect line endings, or from a transformed .dist. See issue #168
sed -i 's/\r$//' "${basedir}"/scripts/config
sed -i 's/\r$//' "${basedir}"/config/config
FCW_INSTALL_SCRIPT=
while IFS=$'\t\r' read -r v r s; do
@@ -215,7 +215,7 @@ if [ -z "${FCW_INSTALL_SCRIPT}" ]; then
exit 5
fi
. "${basedir}/scripts/config"
. "${basedir}/config/config"
. "${basedir}/scripts/install/ext-install.sh"
. "${basedir}/scripts/install/${FCW_INSTALL_SCRIPT}"
echo "System specific install complete (${basedir}/scripts/install/${FCW_INSTALL_SCRIPT})"
@@ -250,7 +250,7 @@ for action in start stop; do
done
echo "==== Filling configuration templates ===="
"${basedir}/scripts/install/gen-from-templates.sh"
"${basedir}/config/gen-from-templates.sh"
echo "==== Setting up DB ===="
pidof mysqld > /dev/null || start_svc mysql