Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4051195
D2301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D2301.diff
View Options
diff --git a/entrypoint.sh b/entrypoint.sh
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -3,51 +3,51 @@
rewire_openfire() {
rm -rf /usr/share/openfire/{conf,resources/security,lib/log4j2.xml}
- ln -sf ${OPENFIRE_DATA_DIR}/conf /usr/share/openfire/
- ln -sf ${OPENFIRE_DATA_DIR}/conf/security /usr/share/openfire/resources/
+ ln -sf "${OPENFIRE_DATA_DIR}/conf" /usr/share/openfire/
+ ln -sf "${OPENFIRE_DATA_DIR}/conf/security" /usr/share/openfire/resources/
}
initialize_data_dir() {
echo "Initializing ${OPENFIRE_DATA_DIR}..."
- mkdir -p ${OPENFIRE_DATA_DIR}
- chmod -R 0750 ${OPENFIRE_DATA_DIR}
- chown -R ${OPENFIRE_USER}:${OPENFIRE_USER} ${OPENFIRE_DATA_DIR}
+ mkdir -p "${OPENFIRE_DATA_DIR}"
+ chmod -R 0750 "${OPENFIRE_DATA_DIR}"
+ chown -R "${OPENFIRE_USER}:${OPENFIRE_USER}" "${OPENFIRE_DATA_DIR}"
# migrates data volume directory structure
- if [[ -d ${OPENFIRE_DATA_DIR}/openfire ]]; then
+ if [[ -d "${OPENFIRE_DATA_DIR}/openfire" ]]; then
echo "Migrating existing data..."
- mv ${OPENFIRE_DATA_DIR}/openfire/etc ${OPENFIRE_DATA_DIR}/conf
- mv ${OPENFIRE_DATA_DIR}/openfire/lib/plugins ${OPENFIRE_DATA_DIR}/plugins
- mv ${OPENFIRE_DATA_DIR}/openfire/lib/embedded-db ${OPENFIRE_DATA_DIR}/embedded-db
- rm -rf ${OPENFIRE_DATA_DIR}/openfire
+ mv "${OPENFIRE_DATA_DIR}/openfire/etc" "${OPENFIRE_DATA_DIR}/conf"
+ mv "${OPENFIRE_DATA_DIR}/openfire/lib/plugins" "${OPENFIRE_DATA_DIR}/plugins"
+ mv "${OPENFIRE_DATA_DIR}/openfire/lib/embedded-db" "${OPENFIRE_DATA_DIR}/embedded-db"
+ rm -rf "${OPENFIRE_DATA_DIR}/openfire"
fi
- [[ -d ${OPENFIRE_DATA_DIR}/etc ]] && mv ${OPENFIRE_DATA_DIR}/etc ${OPENFIRE_DATA_DIR}/conf
- [[ -d ${OPENFIRE_DATA_DIR}/lib/plugins ]] && mv ${OPENFIRE_DATA_DIR}/lib/plugins ${OPENFIRE_DATA_DIR}/plugins
- [[ -d ${OPENFIRE_DATA_DIR}/lib/embedded-db ]] && mv ${OPENFIRE_DATA_DIR}/lib/embedded-db ${OPENFIRE_DATA_DIR}/embedded-db
- rm -rf ${OPENFIRE_DATA_DIR}/lib
+ [[ -d "${OPENFIRE_DATA_DIR}/etc" ]] && mv "${OPENFIRE_DATA_DIR}/etc" "${OPENFIRE_DATA_DIR}/conf"
+ [[ -d "${OPENFIRE_DATA_DIR}/lib/plugins" ]] && mv "${OPENFIRE_DATA_DIR}/lib/plugins" "${OPENFIRE_DATA_DIR}/plugins"
+ [[ -d "${OPENFIRE_DATA_DIR}/lib/embedded-db" ]] && mv "${OPENFIRE_DATA_DIR}/lib/embedded-db" "${OPENFIRE_DATA_DIR}/embedded-db"
+ rm -rf "${OPENFIRE_DATA_DIR:?}/lib"
# initialize the data volume
- if [[ ! -d ${OPENFIRE_DATA_DIR}/conf ]]; then
- sudo -HEu ${OPENFIRE_USER} cp -a /etc/openfire ${OPENFIRE_DATA_DIR}/conf
+ if [[ ! -d "${OPENFIRE_DATA_DIR}/conf" ]]; then
+ sudo -HEu "${OPENFIRE_USER}" cp -a /etc/openfire "${OPENFIRE_DATA_DIR}/conf"
fi
- sudo -HEu ${OPENFIRE_USER} mkdir -p ${OPENFIRE_DATA_DIR}/{plugins,embedded-db}
- sudo -HEu ${OPENFIRE_USER} rm -rf ${OPENFIRE_DATA_DIR}/plugins/admin
- sudo -HEu ${OPENFIRE_USER} ln -sf /usr/share/openfire/plugin-admin /var/lib/openfire/plugins/admin
+ sudo -HEu "${OPENFIRE_USER}" mkdir -p "${OPENFIRE_DATA_DIR}/{plugins,embedded-db}"
+ sudo -HEu "${OPENFIRE_USER}" rm -rf "${OPENFIRE_DATA_DIR}/plugins/admin"
+ sudo -HEu "${OPENFIRE_USER}" ln -sf /usr/share/openfire/plugin-admin /var/lib/openfire/plugins/admin
# create version file
CURRENT_VERSION=
- [[ -f ${OPENFIRE_DATA_DIR}/VERSION ]] && CURRENT_VERSION=$(cat ${OPENFIRE_DATA_DIR}/VERSION)
- if [[ ${OPENFIRE_VERSION} != ${CURRENT_VERSION} ]]; then
- echo -n "${OPENFIRE_VERSION}" | sudo -HEu ${OPENFIRE_USER} tee ${OPENFIRE_DATA_DIR}/VERSION >/dev/null
+ [[ -f "${OPENFIRE_DATA_DIR}/VERSION" ]] && CURRENT_VERSION=$(cat "${OPENFIRE_DATA_DIR}/VERSION")
+ if [[ "${OPENFIRE_VERSION}" != "${CURRENT_VERSION}" ]]; then
+ echo -n "${OPENFIRE_VERSION}" | sudo -HEu "${OPENFIRE_USER}" tee "${OPENFIRE_DATA_DIR}/VERSION" >/dev/null
fi
}
initialize_log_dir() {
echo "Initializing ${OPENFIRE_LOG_DIR}..."
- mkdir -p ${OPENFIRE_LOG_DIR}
- chmod -R 0755 ${OPENFIRE_LOG_DIR}
- chown -R ${OPENFIRE_USER}:${OPENFIRE_USER} ${OPENFIRE_LOG_DIR}
+ mkdir -p "${OPENFIRE_LOG_DIR}"
+ chmod -R 0755 "${OPENFIRE_LOG_DIR}"
+ chown -R "${OPENFIRE_USER}:${OPENFIRE_USER}" "${OPENFIRE_LOG_DIR}"
}
# allow arguments to be passed to openfire launch
@@ -62,9 +62,9 @@
# default behaviour is to launch openfire
if [[ -z ${1} ]]; then
- exec start-stop-daemon --start --chuid ${OPENFIRE_USER}:${OPENFIRE_USER} --exec /usr/bin/java -- \
+ exec start-stop-daemon --start --chuid "${OPENFIRE_USER}:${OPENFIRE_USER}" --exec /usr/bin/java -- \
-server \
- -Dlog4j.configurationFile=${OPENFIRE_DATA_DIR}/conf/log4j2.xml \
+ -Dlog4j.configurationFile="${OPENFIRE_DATA_DIR}/conf/log4j2.xml" \
-DopenfireHome=/usr/share/openfire \
-Dopenfire.lib.dir=/usr/share/openfire/lib \
-classpath /usr/share/openfire/lib/startup.jar \
@@ -72,5 +72,3 @@
else
exec "$@"
fi
-
-
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 24, 10:49 (2 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2372630
Default Alt Text
D2301.diff (4 KB)
Attached To
Mode
D2301: Improve entry point correctness
Attached
Detach File
Event Timeline
Log In to Comment