mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
surveillancepatchn: add new patch for SS 9.2.0
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
8303c5fc78
commit
ae14e3ed31
@ -7,6 +7,9 @@ if [ -d /var/packages/SurveillanceStation ]; then
|
||||
PATHSCRIPTS="${PATHROOT}/scripts"
|
||||
SPATCH="/usr/lib"
|
||||
|
||||
/usr/syno/bin/synopkg stop SurveillanceStation
|
||||
sleep 5
|
||||
|
||||
rm -f "${PATHLIB}/libssutils.so"
|
||||
cp -f "${SPATCH}/libssutils.so" "${PATHLIB}/libssutils.so"
|
||||
chown SurveillanceStation:SurveillanceStation "${PATHLIB}/libssutils.so"
|
||||
@ -23,6 +26,9 @@ if [ -d /var/packages/SurveillanceStation ]; then
|
||||
chmod 0777 "${PATHSCRIPTS}/license.sh"
|
||||
|
||||
echo -e "Surveillance Patch: Successfull!"
|
||||
|
||||
sleep 5
|
||||
/usr/syno/bin/synopkg start SurveillanceStation
|
||||
fi
|
||||
|
||||
exit 0
|
@ -1,6 +1,6 @@
|
||||
version: 1
|
||||
name: surveillancepatch
|
||||
description: "Patch License for SS 9.1.2-10854! (Not for DVA)"
|
||||
description: "Patch License for SS 9.1.2-10854! (Not for DVA) <- select only ONE"
|
||||
system: false
|
||||
beta: true
|
||||
all:
|
||||
|
59
surveillancepatchn/all/usr/bin/surveillancepatch.sh
Executable file
59
surveillancepatchn/all/usr/bin/surveillancepatch.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Define the entries to be added
|
||||
ENTRIES=("127.0.0.1 synosurveillance.synology.com")
|
||||
|
||||
# Loop over each entry
|
||||
for ENTRY in "${ENTRIES[@]}"
|
||||
do
|
||||
if [ -f /etc/hosts ]; then
|
||||
# Check if the entry is already in the file
|
||||
if grep -Fxq "$ENTRY" /etc/hosts; then
|
||||
echo "Entry $ENTRY already exists"
|
||||
else
|
||||
echo "Entry $ENTRY does not exist, adding now"
|
||||
echo "$ENTRY" >> /etc/hosts
|
||||
fi
|
||||
fi
|
||||
if [ -f /etc.defaults/hosts ]; then
|
||||
if grep -Fxq "$ENTRY" /etc.defaults/hosts; then
|
||||
echo "Entry $ENTRY already exists"
|
||||
else
|
||||
echo "Entry $ENTRY does not exist, adding now"
|
||||
echo "$ENTRY" >> /etc.defaults/hosts
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -d /var/packages/SurveillanceStation ]; then
|
||||
SSPATH="/var/packages/SurveillanceStation"
|
||||
PATHROOT="${SSPATH}/target"
|
||||
PATHLIB="${PATHROOT}/lib"
|
||||
PATHSCRIPTS="${PATHROOT}/scripts"
|
||||
SPATCH="/usr/lib"
|
||||
|
||||
/usr/syno/bin/synopkg stop SurveillanceStation
|
||||
sleep 5
|
||||
|
||||
rm -f "${PATHLIB}/libssutils.so"
|
||||
cp -f "${SPATCH}/libssutils.so" "${PATHLIB}/libssutils.so"
|
||||
chown SurveillanceStation:SurveillanceStation "${PATHLIB}/libssutils.so"
|
||||
chmod 0644 "${PATHLIB}/libssutils.so"
|
||||
|
||||
rm -f "${PATHSCRIPTS}/S82surveillance.sh"
|
||||
cp -f "${SPATCH}/S82surveillance.sh" "${PATHSCRIPTS}/S82surveillance.sh"
|
||||
chown SurveillanceStation:SurveillanceStation "${PATHSCRIPTS}/S82surveillance.sh"
|
||||
chmod 0755 "${PATHSCRIPTS}/S82surveillance.sh"
|
||||
|
||||
rm -f "${PATHSCRIPTS}/license.sh"
|
||||
cp -f "${SPATCH}/license.sh" "${PATHSCRIPTS}/license.sh"
|
||||
chown SurveillanceStation:SurveillanceStation "${PATHSCRIPTS}/license.sh"
|
||||
chmod 0777 "${PATHSCRIPTS}/license.sh"
|
||||
|
||||
echo -e "Surveillance Patch: Successfull!"
|
||||
|
||||
sleep 5
|
||||
/usr/syno/bin/synopkg start SurveillanceStation
|
||||
fi
|
||||
|
||||
exit 0
|
143
surveillancepatchn/all/usr/lib/S82surveillance.sh
Executable file
143
surveillancepatchn/all/usr/lib/S82surveillance.sh
Executable file
@ -0,0 +1,143 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2014 Synology Inc. All rights reserved.
|
||||
|
||||
SURVEILLANCE_INC_SCRP=/var/packages/SurveillanceStation/scripts/SurveillanceStationCommon
|
||||
. ${SURVEILLANCE_INC_SCRP}
|
||||
|
||||
SS_BIN_DIR="${SS_TARGET_DIR}/bin"
|
||||
SSCTL="${SS_BIN_DIR}/ssctl"
|
||||
SS_DBG_LOG_ROTATE_CONF="/usr/local/etc/logrotate.d/SurveillanceStation"
|
||||
|
||||
UpdateSSDbgLogRotateConf()
|
||||
{
|
||||
cat > $SS_DBG_LOG_ROTATE_CONF <<EOF
|
||||
/var/log/surveillance/surveillance.log /var/log/surveillance/ssnotification.log
|
||||
/var/log/surveillance/localdisplay.log /var/log/surveillance/ssrotate.log
|
||||
/var/log/surveillance/ssdevice.log {
|
||||
size 10M
|
||||
rotate 4
|
||||
missingok
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
CheckPgsqlService()
|
||||
{
|
||||
if [ true == $(IsDSM7) ]; then
|
||||
echo $(IsSystemdUnitActivated "pqsql")
|
||||
else
|
||||
${SYNO_SERVICE_TOOL} --is-enabled pgsql > /dev/null 2>&1
|
||||
if [ $? -ne ${RET_SYNO_SERVICE_ENABLED} ]; then
|
||||
echo false
|
||||
else
|
||||
echo true
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Start()
|
||||
{
|
||||
SSDebugLog "Start Surveillance [$SURVEILLANCE_PKG_VERSION] begin."
|
||||
|
||||
local Ret
|
||||
|
||||
UpdateSSDbgLogRotateConf
|
||||
|
||||
if [ true == $(IsNonRecordingMode) -a true == $(IsServiceDataLinkAlive) ]; then
|
||||
rm -f ${SS_NON_RECORDING_FILE}
|
||||
fi
|
||||
|
||||
if [ false == $(IsNonRecordingMode) ]; then
|
||||
CheckToCreateRecDB
|
||||
Ret=$?
|
||||
if [ 0 -ne ${Ret} ]; then
|
||||
SSDebugLog "Failed to prepare share folder."
|
||||
UpdateNonRecordingMode
|
||||
fi
|
||||
|
||||
if [ ! -f ${SS_REC_DB} ]; then
|
||||
SSDebugLog "Recording db not found."
|
||||
UpdateNonRecordingMode
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${USE_SQLITE} == false ]; then
|
||||
if [ false == $(CheckPgsqlService) ]; then
|
||||
SSDebugLog "PGSQL is not enabled"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ false == $(HasSSPgsqlData) ]; then
|
||||
SSDebugLog "PGSQL db have not been created yet."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [ ! -f ${SS_SYSTEM_DB} ]; then
|
||||
SSDebugLog "System db not found."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
${SSCTL} start
|
||||
sh /var/packages/SurveillanceStation/target/scripts/license.sh > /dev/null 2>&1 & echo $!
|
||||
|
||||
SSDebugLog "Start Surveillance [$SURVEILLANCE_PKG_VERSION] end."
|
||||
}
|
||||
|
||||
Stop()
|
||||
{
|
||||
SSDebugLog "Stop Surveillance [$SURVEILLANCE_PKG_VERSION] begin."
|
||||
|
||||
if [ ${USE_SQLITE} == false ]; then
|
||||
if [ false == $(HasSSPgsqlData) ]; then
|
||||
echo "Surveillance: DB is stopped before Surveillance stops"
|
||||
fi
|
||||
else
|
||||
if [ ! -f ${SS_SYSTEM_DB} ]; then
|
||||
echo "Surveillance System DB not found."
|
||||
fi
|
||||
fi
|
||||
|
||||
${SSCTL} stop
|
||||
sudo pkill -9 -f /var/packages/SurveillanceStation/target/scripts/license.sh
|
||||
|
||||
SSDebugLog "Stop Surveillance [$SURVEILLANCE_PKG_VERSION] end"
|
||||
}
|
||||
|
||||
Restart()
|
||||
{
|
||||
Stop
|
||||
sleep 1
|
||||
Start
|
||||
}
|
||||
|
||||
TriggerSctrl()
|
||||
{
|
||||
${SSCTL} "$1" "$2" "$3"
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
PackageInfoGet
|
||||
|
||||
case $1 in
|
||||
"start")
|
||||
Start
|
||||
;;
|
||||
"stop")
|
||||
Stop
|
||||
;;
|
||||
"restart")
|
||||
Restart
|
||||
;;
|
||||
"trigger-ssctl")
|
||||
TriggerSctrl "$2" "$3" "$4"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start|stop|restart|share_folder"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
BIN
surveillancepatchn/all/usr/lib/libssutils.so
Normal file
BIN
surveillancepatchn/all/usr/lib/libssutils.so
Normal file
Binary file not shown.
7
surveillancepatchn/all/usr/lib/license.sh
Executable file
7
surveillancepatchn/all/usr/lib/license.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
while true
|
||||
do
|
||||
sleep 3600
|
||||
/var/packages/SurveillanceStation/target/bin/ssctl start
|
||||
|
||||
done
|
32
surveillancepatchn/install.sh
Executable file
32
surveillancepatchn/install.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env ash
|
||||
|
||||
if [ "${1}" = "late" ]; then
|
||||
echo "Installing addon surveillancepatchn - ${1}"
|
||||
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||
|
||||
cp -vf /usr/bin/surveillancepatch.sh /tmpRoot/usr/bin/surveillancepatch.sh
|
||||
cp -vf /usr/lib/libssutils.so /tmpRoot/usr/lib/libssutils.so
|
||||
cp -vf /usr/lib/license.sh /tmpRoot/usr/lib/license.sh
|
||||
cp -vf /usr/lib/S82surveillance.sh /tmpRoot/usr/lib/S82surveillance.sh
|
||||
|
||||
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||
DEST="/tmpRoot/usr/lib/systemd/system/surveillancepatch.service"
|
||||
echo "[Unit]" >${DEST}
|
||||
echo "Description=addon surveillancepatchn" >>${DEST}
|
||||
echo "After=multi-user.target" >>${DEST}
|
||||
echo >>${DEST}
|
||||
echo "[Service]" >>${DEST}
|
||||
echo "Type=oneshot" >>${DEST}
|
||||
echo "RemainAfterExit=yes" >>${DEST}
|
||||
echo "ExecStart=/usr/bin/surveillancepatch.sh" >>${DEST}
|
||||
echo >>${DEST}
|
||||
echo "[Install]" >>${DEST}
|
||||
echo "WantedBy=multi-user.target" >>${DEST}
|
||||
|
||||
mkdir -vp /tmpRoot/usr/lib/systemd/system/multi-user.target.wants
|
||||
ln -vsf /usr/lib/systemd/system/surveillancepatch.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/surveillancepatch.service
|
||||
elif [ "${1}" = "uninstall" ]; then
|
||||
echo "Installing addon surveillancepatchn - ${1}"
|
||||
# To-Do
|
||||
fi
|
19
surveillancepatchn/manifest.yml
Normal file
19
surveillancepatchn/manifest.yml
Normal file
@ -0,0 +1,19 @@
|
||||
version: 1
|
||||
name: surveillancepatchn
|
||||
description: "Patch License for SS 9.2.0-11289! (Not for DVA) <- select only ONE"
|
||||
system: false
|
||||
beta: true
|
||||
all:
|
||||
install-script: "install.sh"
|
||||
copy: "all"
|
||||
apollolake: true
|
||||
broadwell: true
|
||||
broadwellnk: true
|
||||
broadwellnkv2: true
|
||||
broadwellntbap: true
|
||||
denverton: true
|
||||
geminilake: true
|
||||
purley: true
|
||||
v1000: true
|
||||
r1000: true
|
||||
epyc7002: true
|
Loading…
Reference in New Issue
Block a user