Skip to content

Commit

Permalink
Fix for homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
mreid-tt committed Sep 18, 2024
1 parent 0287669 commit 38ccb02
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion spk/wallabag/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ STARTABLE = no
SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh

ADMIN_URL = /wallabag/web/
ADMIN_URL = /wallabag

WIZARDS_DIR = src/wizard/
SYSTEM_GROUP = http
Expand All @@ -46,6 +46,7 @@ include ../../mk/spksrc.spk.mk
.PHONY: wallabag_extra_install
wallabag_extra_install:
install -m 755 -d $(STAGING_DIR)/web
install -m 644 src/web/index.php $(STAGING_DIR)/web/index.php
install -m 644 src/web/parameters.yml $(STAGING_DIR)/web/parameters.yml
install -m 644 src/web/wallabag.conf $(STAGING_DIR)/web/wallabag.conf
install -m 644 src/web/wallabag.json $(STAGING_DIR)/web/wallabag.json
2 changes: 1 addition & 1 deletion spk/wallabag/src/app/config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "url",
"protocol": "http",
"port": "80",
"url": "/wallabag/web",
"url": "/wallabag",
"allUsers": true,
"grantPrivilege": "local"
}
Expand Down
29 changes: 28 additions & 1 deletion spk/wallabag/src/service-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fi
WEB_ROOT="${WEB_DIR}/${SYNOPKG_PKGNAME}"
SYNOSVC="/usr/syno/sbin/synoservice"
CFG_FILE="${WEB_ROOT}/app/config/parameters.yml"
IDX_FILE="${WEB_ROOT}/index.php"

exec_php ()
{
Expand Down Expand Up @@ -178,6 +179,16 @@ service_postinst ()
# Restore configuration and data
echo "Restoring configuration and data to ${WEB_DIR}"
rsync -aX -I "${TEMPDIR}/config/parameters.yml" "${CFG_FILE}" 2>&1
if [ -f ${TEMPDIR}/config/index.php ]; then
rsync -aX -I "${TEMPDIR}/config/index.php" "${IDX_FILE}" 2>&1
else
# rebuild missing index file
echo "Rebuilding index redirect file"
rsync -aX -I "${SYNOPKG_PKGDEST}/web/index.php" "${IDX_FILE}" 2>&1
DOMAIN_NAME=$(grep 'domain_name:' "${CFG_FILE}" | awk '{ print $2 }' | sed "s/'//g")
sed -i -e "s|@protocol_and_domain_name@|${DOMAIN_NAME}|g" \
${IDX_FILE}
fi
if [ -d ${TEMPDIR}/images ]; then
rsync -aX -I "${TEMPDIR}/images" "${WEB_ROOT}/web/assets/" 2>&1
fi
Expand All @@ -198,15 +209,18 @@ service_postinst ()
# Clean-up temporary files
${RM} "${TEMPDIR}"
else
# install config file
# install config files
rsync -aX -I "${SYNOPKG_PKGDEST}/web/parameters.yml" "${CFG_FILE}" 2>&1
rsync -aX -I "${SYNOPKG_PKGDEST}/web/index.php" "${IDX_FILE}" 2>&1

# render properties
sed -i -e "s|@database_password@|${wizard_mysql_database_password}|g" \
-e "s|@database_name@|${MYSQL_DATABASE}|g" \
-e "s|@protocol_and_domain_name@|${wizard_protocol_and_domain_name}/wallabag/web|g" \
-e "s|@wallabag_secret@|$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 30 | head -n 1)|g" \
${CFG_FILE}
sed -i -e "s|@protocol_and_domain_name@|${wizard_protocol_and_domain_name}/wallabag/web|g" \
${IDX_FILE}

# install wallabag
if ! exec_php ${WEB_ROOT}/bin/console wallabag:install --env=prod --reset -n -vvv > ${WEB_ROOT}/install.log 2>&1; then
Expand Down Expand Up @@ -329,6 +343,9 @@ service_save ()
[ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME} ] && ${RM} ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}
${MKDIR} "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}"
rsync -aX "${CFG_FILE}" "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/" 2>&1
if [ -f ${IDX_FILE} ]; then
rsync -aX "${IDX_FILE}" "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/" 2>&1
fi
if [ -d ${WEB_ROOT}/web/assets/images ]; then
rsync -aX "${WEB_ROOT}/web/assets/images" "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/" 2>&1
fi
Expand All @@ -338,6 +355,16 @@ service_restore ()
{
# Restore configuration
rsync -aX -I "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/parameters.yml" "${CFG_FILE}" 2>&1
if [ -f ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/index.php ]; then
rsync -aX -I "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/index.php" "${IDX_FILE}" 2>&1
else
# rebuild missing index file
echo "Rebuilding index redirect file"
rsync -aX -I "${SYNOPKG_PKGDEST}/web/index.php" "${IDX_FILE}" 2>&1
DOMAIN_NAME=$(grep 'domain_name:' "${CFG_FILE}" | awk '{ print $2 }' | sed "s/'//g")
sed -i -e "s|@protocol_and_domain_name@|${DOMAIN_NAME}|g" \
${IDX_FILE}
fi
if [ -d ${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/images ]; then
rsync -aX -I "${SYNOPKG_TEMP_UPGRADE_FOLDER}/${SYNOPKG_PKGNAME}/images" "${WEB_ROOT}/web/assets/" 2>&1
fi
Expand Down
1 change: 1 addition & 0 deletions spk/wallabag/src/web/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php header("Location: @protocol_and_domain_name@"); ?>

0 comments on commit 38ccb02

Please sign in to comment.