mirror of
https://github.com/AuxXxilium/arc-addons.git
synced 2024-11-23 13:40:51 +07:00
tree: update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
parent
d82a567517
commit
a9de2c22b5
Binary file not shown.
@ -11,8 +11,8 @@ if [ "${1}" = "late" ]; then
|
||||
mkdir -p "/tmpRoot/usr/arc/addons/"
|
||||
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||
|
||||
tar -zxf /addons/acpid-7.1.tgz -C /tmpRoot/usr/ ./bin ./sbin
|
||||
tar -zxf /addons/acpid-7.1.tgz -C /tmpRoot/ ./etc ./usr
|
||||
tar -zxf /addons/acpid-7.1.tgz -C /tmpRoot/usr/ ./bin ./sbin ./lib
|
||||
tar -zxf /addons/acpid-7.1.tgz -C /tmpRoot/ ./etc
|
||||
sed -i 's|=/|=-/|g' /tmpRoot/usr/lib/systemd/system/acpid.service
|
||||
if [ -f /usr/lib/modules/button.ko ]; then
|
||||
cp -vf /usr/lib/modules/button.ko /tmpRoot/usr/lib/modules/button.ko
|
||||
|
Binary file not shown.
@ -32,6 +32,6 @@ else
|
||||
# NOTIFICATION="Arc Notify"
|
||||
# synodsmnotify -e false -b false "@administrators" "arc_notify" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\"}"
|
||||
# NOTIFICATION="Arc Notify"
|
||||
# SUBJECT="Welcome to <a href=\\\"https://github.com/AuxXxilium\\\" target=blank>AuxXxilium</a>!"
|
||||
# SUBJECT="Welcome to <a href=\\\"https://github.com/AuxXxilium\\" target=blank>AuxXxilium</a>!"
|
||||
# synodsmnotify -e false -b false "@administrators" "arc_notify_subject" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\", \"%SUBJECT%\": \"${SUBJECT}\"}"
|
||||
fi
|
Binary file not shown.
87
updatenotify/all/usr/bin/arc-updatenotify.sh
Normal file
87
updatenotify/all/usr/bin/arc-updatenotify.sh
Normal file
@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
function Create() {
|
||||
if echo "$(cat /usr/syno/etc/synoschedule.d/root/*.task 2>/dev/null | grep '^name=' | cut -d'=' -f2)" | grep -q "Arc-UpdateNotify"; then
|
||||
echo "Existence tasks"
|
||||
else
|
||||
echo "Create tasks"
|
||||
schedule='{"date_type":0,"week_day":"0,1,2,3,4,5,6","repeat_date":1001,"monthly_week":[],"hour":0,"minute":0,"repeat_hour":2,"repeat_min":0,"last_work_hour":0,"repeat_min_store_config":[1,5,10,15,20,30],"repeat_hour_store_config":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]}'
|
||||
extra='{"notify_enable":false,"script":"/usr/bin/arc-updatenotify.sh","notify_mail":"","notify_if_error":false}'
|
||||
synowebapi --exec api=SYNO.Core.TaskScheduler.Root method=create version=4 name='"Arc-UpdateNotify"' owner='"root"' enable=true schedule="${schedule}" extra="${extra}" type='"script"'
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Delete() {
|
||||
for I in $(ls /usr/syno/etc/synoschedule.d/root/*.task); do
|
||||
if [ "$(cat "${I}" 2>/dev/null | grep '^name=' | cut -d'=' -f2)" = "Arc-UpdateNotify" ]; then
|
||||
id=$(cat "${I}" | grep '^id=' | cut -d'=' -f2)
|
||||
[ -n "${id}" ] && synoschedtask --del id=${id}
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Check() {
|
||||
|
||||
LOCALTAG="$(cat /usr/arc/VERSION 2>/dev/null | grep LOADERVERSION | cut -d'=' -f2 | sed 's/\"//g')"
|
||||
if [ -z "${LOCALTAG}" ]; then
|
||||
echo "Unknown bootloader version!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
URL="https://github.com/AuxXxilium/arc"
|
||||
TAG=""
|
||||
if echo "$@" | grep -qw "\-p"; then
|
||||
TAG="$(curl -skL --connect-timeout 10 "${URL}/tags" | grep /refs/tags/.*\.zip | head -1 | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/')"
|
||||
else
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${URL}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
fi
|
||||
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||
if [ -z "${TAG}" -o "${TAG}" = "latest" ]; then
|
||||
echo "Error checking new version. TAG is ${TAG}"
|
||||
exit 0
|
||||
fi
|
||||
if [ "${TAG}" = "${LOCALTAG}" ]; then
|
||||
echo "Actual version is ${TAG}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# NOTIFICATION="Arc Notify"
|
||||
# synodsmnotify -e false -b false "@administrators" "arc_notify" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\"}"
|
||||
# NOTIFICATION="ARc Update"
|
||||
# SUBJECT="Arc <a href=\\\"${URL}/releases/tag/${TAG}\\\" target=blank>${TAG}</a> version has been released!"
|
||||
# synodsmnotify -e false -b false "@administrators" "arc_notify_subject" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\", \"%SUBJECT%\": \"${SUBJECT}\"}"
|
||||
|
||||
NOTIFICATION="Arc Relase ${TAG}"
|
||||
SUBJECT="$(curl -skL --connect-timeout 10 "${URL}/releases/tag/${TAG}" | pup 'div[data-test-selector="body-content"]')"
|
||||
SUBJECT="${SUBJECT//\"/\\\\\\\"}"
|
||||
synodsmnotify -e false -b false "@administrators" "arc_notify_subject" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\", \"%SUBJECT%\": \"${SUBJECT}\"}"
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
ACTION="${1}"
|
||||
[ -z "${ACTION}" ] && ACTION="check"
|
||||
|
||||
case "${ACTION,,}" in
|
||||
"create")
|
||||
Create
|
||||
;;
|
||||
"delete")
|
||||
Delete
|
||||
;;
|
||||
"check")
|
||||
Check
|
||||
;;
|
||||
*)
|
||||
echo "Unknown command!"
|
||||
;;
|
||||
esac
|
@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
LOCALTAG="$(cat /usr/arc/VERSION 2>/dev/null | grep LOADERVERSION | cut -d'=' -f2 | sed 's/\"//g')"
|
||||
if [ -z "${LOCALTAG}" ]; then
|
||||
echo "Unknown bootloader version!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
URL="https://github.com/AuxXxilium/arc"
|
||||
TAG=""
|
||||
if echo "$@" | grep -qw "\-p"; then
|
||||
TAG="$(curl -skL --connect-timeout 10 "${URL}/tags" | grep /refs/tags/.*\.zip | head -1 | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/')"
|
||||
else
|
||||
LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${URL}/releases/latest")"
|
||||
TAG="${LATESTURL##*/}"
|
||||
fi
|
||||
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
|
||||
if [ -z "${TAG}" -o "${TAG}" = "latest" ]; then
|
||||
echo "Error checking new version. TAG is ${TAG}"
|
||||
exit 0
|
||||
fi
|
||||
if [ "${TAG}" = "${LOCALTAG}" ]; then
|
||||
echo "Actual version is ${TAG}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NOTIFICATION="Arc Relase ${TAG}"
|
||||
SUBJECT="$(curl -skL --connect-timeout 10 "${URL}/releases/tag/${TAG}" | pup 'div[data-test-selector="body-content"]')"
|
||||
SUBJECT="${SUBJECT//\"/\\\\\\\"}"
|
||||
synodsmnotify -e false -b false "@administrators" "arc_notify_subject" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\", \"%SUBJECT%\": \"${SUBJECT}\"}"
|
||||
|
||||
exit 0
|
@ -12,71 +12,31 @@ if [ "${1}" = "late" ]; then
|
||||
cp -vf "${0}" "/tmpRoot/usr/arc/addons/"
|
||||
|
||||
cp -vf /usr/bin/pup /tmpRoot/usr/bin/pup
|
||||
cp -vf /usr/bin/updatenotify.sh /tmpRoot/usr/bin/updatenotify.sh
|
||||
cp -vf /usr/bin/arc-updatenotify.sh /tmpRoot/usr/bin/arc-updatenotify.sh
|
||||
|
||||
FILE_PATH="/tmpRoot/usr/syno/etc/synoschedule.d/root"
|
||||
mkdir -p "${FILE_PATH}"
|
||||
if [ -f "${FILE_PATH}/999.task" ]; then
|
||||
NAME="$(cat "${FILE_PATH}/999.task" | grep '^name=' | cut -d'=' -f2)"
|
||||
if [ "${NAME}" = "UpdateNotify" ]; then
|
||||
echo "Existence tasks"
|
||||
exit
|
||||
else
|
||||
IDX=999
|
||||
while [ -f "${FILE_PATH}/${IDX}.task" ]; do IDX=$((${IDX} + 1)); done
|
||||
mv -f "${FILE_PATH}/999.task" "${FILE_PATH}/${IDX}.task"
|
||||
sed -i "s/id=.*$/id=${IDX}/" "${FILE_PATH}/${IDX}.task"
|
||||
fi
|
||||
fi
|
||||
|
||||
cat <<EOF >"${FILE_PATH}/999.task"
|
||||
id=999
|
||||
last work hour=16
|
||||
can edit owner=1
|
||||
can delete from ui=1
|
||||
edit dialog=SYNO.SDS.TaskScheduler.EditDialog
|
||||
type=daily
|
||||
action=#common:run#: /usr/bin/updatenotify.sh
|
||||
systemd slice=
|
||||
monthly week=0
|
||||
can edit from ui=1
|
||||
week=1111111
|
||||
app name=#common:command_line#
|
||||
name=UpdateNotify
|
||||
can run app same time=1
|
||||
owner=0
|
||||
repeat min store config=[1]
|
||||
repeat hour store config=[8,9,10,11,12,13,14,15,16,17,18,19,20]
|
||||
simple edit form=1
|
||||
repeat hour=8
|
||||
listable=1
|
||||
app args={"notify_enable":false,"notify_if_error":false,"notify_mail":"","script":"/usr/bin/updatenotify.sh"}
|
||||
state=enabled
|
||||
can run task same time=0
|
||||
start day=0
|
||||
cmd=MQ==
|
||||
run hour=0
|
||||
edit form=SYNO.SDS.TaskScheduler.Script.FormPanel
|
||||
app=SYNO.SDS.TaskScheduler.Script
|
||||
run min=0
|
||||
start month=0
|
||||
can edit name=1
|
||||
start year=0
|
||||
can run from ui=1
|
||||
repeat min=0
|
||||
cmdArgv=
|
||||
EOF
|
||||
mkdir -p "/tmpRoot/usr/lib/systemd/system"
|
||||
DEST="/tmpRoot/usr/lib/systemd/system/arc-updatenotify.service"
|
||||
echo "[Unit]" >${DEST}
|
||||
echo "Description=addon arc-updatenotify" >>${DEST}
|
||||
echo "After=multi-user.target" >>${DEST}
|
||||
echo >>${DEST}
|
||||
echo "[Service]" >>${DEST}
|
||||
echo "Type=oneshot" >>${DEST}
|
||||
echo "RemainAfterExit=yes" >>${DEST}
|
||||
echo "ExecStart=-/usr/bin/arc-updatenotify.sh create">>${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/arc-updatenotify.service /tmpRoot/usr/lib/systemd/system/multi-user.target.wants/arc-updatenotify.service
|
||||
elif [ "${1}" = "uninstall" ]; then
|
||||
echo "Installing addon updatenotify - ${1}"
|
||||
echo "Installing addon arc-updatenotify - ${1}"
|
||||
|
||||
rm -f "/tmpRoot/usr/bin/updatenotify.sh"
|
||||
rm -f "/tmpRoot/usr/lib/systemd/system/multi-user.target.wants/arc-updatenotify.service"
|
||||
rm -f "/tmpRoot/usr/lib/systemd/system/arc-updatenotify.service"
|
||||
|
||||
FILE_PATH="/tmpRoot/usr/syno/etc/synoschedule.d/root"
|
||||
if [ -f "${FILE_PATH}/999.task" ]; then
|
||||
NAME="$(cat "${FILE_PATH}/999.task" | grep '^name=' | cut -d'=' -f2)"
|
||||
if [ "${NAME}" = "UpdateNotify" ]; then
|
||||
rm -f "${FILE_PATH}/999.task"
|
||||
fi
|
||||
fi
|
||||
[ ! -f "/tmpRoot/usr/arc/revert.sh" ] && echo '#!/usr/bin/env bash' >/tmpRoot/usr/arc/revert.sh && chmod +x /tmpRoot/usr/arc/revert.sh
|
||||
echo "/usr/bin/arc-updatenotify.sh delete" >>/tmpRoot/usr/arc/revert.sh
|
||||
echo "rm -f /usr/bin/pup /usr/bin/arc-updatenotify.sh" >>/tmpRoot/usr/arc/revert.sh
|
||||
fi
|
Loading…
Reference in New Issue
Block a user