diff --git a/acpid/all/addons/acpid-7.1.tgz b/acpid/all/addons/acpid-7.1.tgz index 514999f..c4eca22 100644 Binary files a/acpid/all/addons/acpid-7.1.tgz and b/acpid/all/addons/acpid-7.1.tgz differ diff --git a/acpid/install.sh b/acpid/install.sh index d85ea6d..e44cee3 100755 --- a/acpid/install.sh +++ b/acpid/install.sh @@ -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 diff --git a/eudev/all/addons/eudev-7.1.tgz b/eudev/all/addons/eudev-7.1.tgz index f609169..08218e1 100644 Binary files a/eudev/all/addons/eudev-7.1.tgz and b/eudev/all/addons/eudev-7.1.tgz differ diff --git a/notify/all/usr/bin/notify.sh b/notify/all/usr/bin/notify.sh index 6b88dfb..a10effd 100755 --- a/notify/all/usr/bin/notify.sh +++ b/notify/all/usr/bin/notify.sh @@ -32,6 +32,6 @@ else # NOTIFICATION="Arc Notify" # synodsmnotify -e false -b false "@administrators" "arc_notify" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\"}" # NOTIFICATION="Arc Notify" - # SUBJECT="Welcome to AuxXxilium!" + # SUBJECT="Welcome to AuxXxilium!" # synodsmnotify -e false -b false "@administrators" "arc_notify_subject" "{\"%NOTIFICATION%\": \"${NOTIFICATION}\", \"%SUBJECT%\": \"${SUBJECT}\"}" fi \ No newline at end of file diff --git a/sensors/all/addons/sensors-7.1.tgz b/sensors/all/addons/sensors-7.1.tgz index 0cacb9f..9216dae 100644 Binary files a/sensors/all/addons/sensors-7.1.tgz and b/sensors/all/addons/sensors-7.1.tgz differ diff --git a/updatenotify/all/usr/bin/arc-updatenotify.sh b/updatenotify/all/usr/bin/arc-updatenotify.sh new file mode 100644 index 0000000..b0e8788 --- /dev/null +++ b/updatenotify/all/usr/bin/arc-updatenotify.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash +# +# Copyright (C) 2023 AuxXxilium and Ing +# +# 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 ${TAG} 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 diff --git a/updatenotify/all/usr/bin/updatenotify.sh b/updatenotify/all/usr/bin/updatenotify.sh deleted file mode 100755 index 8920a7d..0000000 --- a/updatenotify/all/usr/bin/updatenotify.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright (C) 2023 AuxXxilium and Ing -# -# 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 \ No newline at end of file diff --git a/updatenotify/install.sh b/updatenotify/install.sh index 82255d9..328d037 100755 --- a/updatenotify/install.sh +++ b/updatenotify/install.sh @@ -10,73 +10,33 @@ if [ "${1}" = "late" ]; then echo "Installing addon updatenotify - ${1}" mkdir -p "/tmpRoot/usr/arc/addons/" 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 - - 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 <"${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 + cp -vf /usr/bin/arc-updatenotify.sh /tmpRoot/usr/bin/arc-updatenotify.sh + + 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 \ No newline at end of file