mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 13:40:51 +07:00
0c9b4f1d9b
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
45 lines
1.9 KiB
Bash
Executable File
45 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env ash
|
|
#
|
|
# Copyright (C) 2024 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
|
|
#
|
|
# This is free software, licensed under the MIT License.
|
|
# See /LICENSE for more information.
|
|
#
|
|
|
|
if [ "${1}" = "late" ]; then
|
|
echo "Installing addon beep - ${1}"
|
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
|
cp -pf "${0}" "/tmpRoot/usr/arc/addons/"
|
|
|
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
|
ESYNOSCHEDULER_DB="/tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db"
|
|
if [ ! -f "${ESYNOSCHEDULER_DB}" ] || ! /tmpRoot/bin/sqlite3 "${ESYNOSCHEDULER_DB}" ".tables" | grep -qw "task"; then
|
|
echo "copy esynoscheduler.db"
|
|
mkdir -p "$(dirname "${ESYNOSCHEDULER_DB}")"
|
|
cp -vpf /addons/esynoscheduler.db "${ESYNOSCHEDULER_DB}"
|
|
fi
|
|
if echo "SELECT * FROM task;" | /tmpRoot/bin/sqlite3 "${ESYNOSCHEDULER_DB}" | grep -qE "BeepOnBoot|BeepAtShutdown"; then
|
|
echo "beep task already exists"
|
|
else
|
|
echo "insert beep task to esynoscheduler.db"
|
|
/tmpRoot/bin/sqlite3 "${ESYNOSCHEDULER_DB}" <<EOF
|
|
DELETE FROM task WHERE task_name LIKE 'BeepOnBoot';
|
|
INSERT INTO task VALUES('BeepOnBoot', '', 'bootup', '', 1, 0, 0, 0, '', 0, "beep -f 500 -l 500 -d 500 -r 1", 'script', '{}', '', '', '{}', '{}');
|
|
DELETE FROM task WHERE task_name LIKE 'BeepOnShutdown';
|
|
INSERT INTO task VALUES('BeepOnShutdown', '', 'shutdown', '', 1, 0, 0, 0, '', 0, "beep -f 500 -l 500 -d 500 -r 1", 'script', '{}', '', '', '{}', '{}');
|
|
EOF
|
|
fi
|
|
elif [ "${1}" = "uninstall" ]; then
|
|
echo "Installing addon beep - ${1}"
|
|
|
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
|
ESYNOSCHEDULER_DB="/tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db"
|
|
if [ -f "${ESYNOSCHEDULER_DB}" ]; then
|
|
echo "delete beep task from esynoscheduler.db"
|
|
/tmpRoot/bin/sqlite3 "${ESYNOSCHEDULER_DB}" <<EOF
|
|
DELETE FROM task WHERE task_name LIKE 'BeepOnBoot';
|
|
DELETE FROM task WHERE task_name LIKE 'BeepOnShutdown';
|
|
EOF
|
|
fi
|
|
fi
|