„Pack/scripts/preupgrade“ ändern
This commit is contained in:
parent
a95c516c4a
commit
9177406173
|
@ -1,20 +1,67 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ -d "/tmp/synOTR" ]; then
|
||||
rm -r /tmp/synOTR
|
||||
# Script Environment Variables
|
||||
# -------------------------------------------------------------------------------------
|
||||
# SYNOPKG_PKGNAME = Package identify which is defined in INFO
|
||||
# SYNOPKG_PKGVER = Package version which is defined in INFO
|
||||
# SYNOPKG_PKGDEST = Package destination path
|
||||
# /volume[x]/@appstore/[Package Name]
|
||||
# SYNOPKG_TEMP_UPGRADE_FOLDER = Temporary upgrade folder
|
||||
# /volume1/@tmp/synopkg.tmp/[Package Name]
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Important Paths, soft links and variables
|
||||
# -------------------------------------------------------------------------------------
|
||||
# DSM WebGUI folder
|
||||
# /usr/syno/synoman/webman/3rdparty/[Package Name] -> /var/packages/[Package Name]/target
|
||||
WEBGUI_FOLDER="/usr/syno/synoman/webman/3rdparty/${SYNOPKG_PKGNAME}"
|
||||
|
||||
# Soft link
|
||||
# /var/packages/[Package Name]/target -> /volume1/@appstore/[Package Name]
|
||||
PACKAGE_FOLDER="/var/packages/${SYNOPKG_PKGNAME}/target/ui"
|
||||
|
||||
# Timestamp - Formatting the Timestamp to terminate log entries
|
||||
TIMESTAMP=$(date +%Y-%m-%d%t%H:%M:%S)
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Action...
|
||||
# -------------------------------------------------------------------------------------
|
||||
|
||||
if [ ! -d "${SYNOPKG_TEMP_UPGRADE_FOLDER}/app/etc" ]; then
|
||||
mkdir -p -m 755 ${SYNOPKG_TEMP_UPGRADE_FOLDER}/app/etc
|
||||
fi
|
||||
|
||||
if [ -d "/usr/syno/synoman/webman/3rdparty/synOTR" ]; then
|
||||
mkdir /tmp/synOTR
|
||||
if [ -d "/usr/syno/synoman/webman/3rdparty/synOTR/app/etc" ]; then # Userdateien liegen erst ab V.3.9.2 im Verzeichnis /app/etc
|
||||
# cp -a /usr/syno/synoman/webman/3rdparty/synOTR/app/etc/ /tmp/synOTR
|
||||
cp -rf /usr/syno/synoman/webman/3rdparty/synOTR/app/etc/* /tmp/synOTR
|
||||
echo ''${TIMESTAMP}' - Start package update --> '${SYNOPKG_PKGNAME}' '${SYNOPKG_PKGVER}'' >>/tmp/${SYNOPKG_PKGNAME}.history
|
||||
echo '------------------------------------------------------------------------------------------------------------------------------------------' >>/tmp/${SYNOPKG_PKGNAME}.history
|
||||
|
||||
|
||||
else
|
||||
cp /usr/syno/synoman/webman/3rdparty/synOTR/Konfiguration.txt /tmp/synOTR/Konfiguration.txt
|
||||
cp /usr/syno/synoman/webman/3rdparty/synOTR/app/synOTR.sqlite /tmp/synOTR/synOTR.sqlite
|
||||
fi
|
||||
if [ -d "${WEBGUI_FOLDER}/app/etc" ]; then
|
||||
cp -rf ${WEBGUI_FOLDER}/app/etc/* ${SYNOPKG_TEMP_UPGRADE_FOLDER}/app/etc
|
||||
echo ''${TIMESTAMP}' - Backup the configuration from '${WEBGUI_FOLDER}'/app/etc to '${SYNOPKG_TEMP_UPGRADE_FOLDER}'/app/etc' >>/tmp/${SYNOPKG_PKGNAME}.history
|
||||
elif [ -d "${WEBGUI_FOLDER}" ]; then # Userdateien liegen erst ab V.3.9.2 im Verzeichnis /app/etc
|
||||
cp -f "${WEBGUI_FOLDER}/Konfiguration.txt" "${SYNOPKG_TEMP_UPGRADE_FOLDER}/app/etc/Konfiguration.txt"
|
||||
cp -f "${WEBGUI_FOLDER}/app/synOTR.sqlite" "${SYNOPKG_TEMP_UPGRADE_FOLDER}/app/etc/synOTR.sqlite"
|
||||
echo ''${TIMESTAMP}' - Backup Konfiguration.txt from '${WEBGUI_FOLDER}' to '${SYNOPKG_TEMP_UPGRADE_FOLDER}'/app/etc' >>/tmp/${SYNOPKG_PKGNAME}.history
|
||||
echo ''${TIMESTAMP}' - Backup synOTR.sqlite from '${WEBGUI_FOLDER}'/app/ to '${SYNOPKG_TEMP_UPGRADE_FOLDER}'/app/etc' >>/tmp/${SYNOPKG_PKGNAME}.history
|
||||
else
|
||||
echo ''${TIMESTAMP}' - Backup of the configuration failed' >>/tmp/${SYNOPKG_PKGNAME}.history
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
#if [ -d "/tmp/synOTR" ]; then
|
||||
# rm -r /tmp/synOTR
|
||||
#fi
|
||||
|
||||
#if [ -d "/usr/syno/synoman/webman/3rdparty/synOTR" ]; then
|
||||
# mkdir /tmp/synOTR
|
||||
# if [ -d "/usr/syno/synoman/webman/3rdparty/synOTR/app/etc" ]; then # Userdateien liegen erst ab V.3.9.2 im Verzeichnis /app/etc
|
||||
# cp -rf /usr/syno/synoman/webman/3rdparty/synOTR/app/etc/* /tmp/synOTR
|
||||
# else
|
||||
# cp /usr/syno/synoman/webman/3rdparty/synOTR/Konfiguration.txt /tmp/synOTR/Konfiguration.txt
|
||||
# cp /usr/syno/synoman/webman/3rdparty/synOTR/app/synOTR.sqlite /tmp/synOTR/synOTR.sqlite
|
||||
# fi
|
||||
#fi
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in a new issue