mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 21:50:52 +07:00
108e702515
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
53 lines
2.2 KiB
Bash
Executable File
53 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env ash
|
|
#
|
|
# Copyright (C) 2023 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 mountloader - ${1}"
|
|
mkdir -p "/tmpRoot/usr/arc/addons/"
|
|
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
|
|
|
cp -vf /usr/bin/yq /tmpRoot/usr/bin/yq
|
|
cp -vf /usr/bin/cpio /tmpRoot/usr/bin/cpio
|
|
cp -vf /usr/bin/unzip /tmpRoot/usr/bin/unzip
|
|
cp -vf /usr/bin/arc-update.sh /tmpRoot/usr/bin/arc-update.sh
|
|
cp -vf /usr/bin/arc-loaderdisk.sh /tmpRoot/usr/bin/arc-loaderdisk.sh
|
|
|
|
rm -f /tmpRoot/usr/arc/.mountloader
|
|
|
|
if [ ! -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then
|
|
echo "copy esynoscheduler.db"
|
|
mkdir -p /tmpRoot/usr/syno/etc/esynoscheduler
|
|
cp -vf /addons/esynoscheduler.db /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db
|
|
fi
|
|
echo "insert mountloader task to esynoscheduler.db"
|
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
|
/tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
|
|
DELETE FROM task WHERE task_name LIKE 'MountLoaderDisk';
|
|
INSERT INTO task VALUES('MountLoaderDisk', '', 'bootup', '', 0, 0, 0, 0, '', 0, '/usr/bin/arc-loaderdisk.sh mountLoaderDisk', 'script', '{}', '', '', '{}', '{}');
|
|
DELETE FROM task WHERE task_name LIKE 'UnMountLoaderDisk';
|
|
INSERT INTO task VALUES('UnMountLoaderDisk', '', 'shutdown', '', 0, 0, 0, 0, '', 0, '/usr/bin/arc-loaderdisk.sh unmountLoaderDisk', 'script', '{}', '', '', '{}', '{}');
|
|
EOF
|
|
elif [ "${1}" = "uninstall" ]; then
|
|
echo "Installing addon mountloader - ${1}"
|
|
|
|
#rm -f "/tmpRoot/usr/bin/yq"
|
|
#rm -f "/tmpRoot/lib/usr/bin/cpio"
|
|
#rm -f "/tmpRoot/lib/usr/bin/unzip"
|
|
rm -f "/tmpRoot/usr/bin/arc-update.sh"
|
|
rm -f "/tmpRoot/usr/bin/arc-loaderdisk.sh"
|
|
|
|
if [ -f /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db ]; then
|
|
echo "delete mountloader task from esynoscheduler.db"
|
|
export LD_LIBRARY_PATH=/tmpRoot/bin:/tmpRoot/lib
|
|
/tmpRoot/bin/sqlite3 /tmpRoot/usr/syno/etc/esynoscheduler/esynoscheduler.db <<EOF
|
|
DELETE FROM task WHERE task_name LIKE 'MountLoaderDisk';
|
|
DELETE FROM task WHERE task_name LIKE 'UnMountLoaderDisk';
|
|
EOF
|
|
fi
|
|
fi
|