]> ### 5.6.0 - Front panel: optional clean shutdown when the power button is held for 1 to 3 seconds (off by default, only on models where users confirmed the buttons), idea from [Chiconydu69](https://github.com/Chiconydu69). - Sensors: the ACPI thermal zone, a fixed BIOS value of about 28 °C on UGREEN boards, is no longer shown as the mainboard temperature; the Sensors page lists it as "ACPI zone, not a measurement" and diag marks it unreliable. Diag also points to the Feedback page for "Confirm my device" and no longer lists the SPI flash controller as an I2C controller without driver. Reported by [ivolution](https://github.com/ivolution). - Diagnosis on the DXP480T Plus: no false LED controller mismatch (diag now checks the power LED chip), no LED or fan chip hints for hardware the model does not have, "power LED only" instead of an LED count, and an unknown M.2 slot order is no longer reported as a mismatch. Thanks to [datarepos76](https://github.com/datarepos76) for the report. - Spanish: clearer wording on the fan history, fan input, front panel, power, schedule and tools pages. Thanks to [ivolution](https://github.com/ivolution). - Fans: the "Show as table" view under History is readable again when the plugin colour scheme and the Unraid theme differ (thanks to [ivolution](https://github.com/ivolution)). - Network LED: the gateway check looks up the router in the system's address table instead of pinging it, so a router that ignores pings no longer turns the LED red. Thanks to [Chiconydu69](https://github.com/Chiconydu69). - About and Front panel: a capability users confirmed only in part now shows as "Partly confirmed" instead of "Confirmed by users". - DXP4800 Plus: LEDs, fan control and case view confirmed, and the front-panel beeper works; the buttons are still open. Thanks to [ivolution](https://github.com/ivolution). - DXP480T Plus: sensors confirmed, case view and front panel partly confirmed on 5.5.0; the LEDs are still open. Thanks to [datarepos76](https://github.com/datarepos76). ### 5.5.0 - DXP2800 SUB2 boards: LED control through the Intel I2C controller is on by default, no `lpss_leds="1"` needed; the LEDs also came back by themselves after a cold reboot. `lpss_leds="0"` in `leds.cfg` turns it off. Thanks to [DanielRuppen](https://github.com/DanielRuppen). - Front panel is a checked capability per model: the Front panel page, the About "Your device" card, the Feedback page and `panel buttons` say whether users confirmed buttons and beeper on your model. The DXP8800 Plus is the first. Thanks to [Chiconydu69](https://github.com/Chiconydu69). - LEDs on DXP2800 SUB2: the LPSS path also works when Unraid's intel-lpss driver holds the controller without an I2C driver; the plugin keeps the controller awake while it talks to it. Reported by DanielRuppen. - Diagnostics: boxes with an IT8613E fan chip list the raw values of registers 0x1e and 0x7f, so header 4's mode can be checked (read only). Reported by Chiconydu69. - Fans: the fan on IT8613E header 4 (second case fan of the DXP6800 and DXP8800 family) is switched to manual through UGREEN's register 0x1e, so it follows the curve instead of staying in automatic mode. Reported by Chiconydu69. - Feedback: the bug form asks for the device data, and "Download diag.md" stays next to the issue buttons once the data is collected. - Feedback: the model form needs the device data and no longer comes with a text in that field, the page says before the click where to paste it, the check summary is no longer cut mid-word and counts the LEDs the model has. - DXP2800 SUB2: a chip id of 0x0000 after the controller wakes is retried once after a fresh bring-up, the setup is checked before every transfer, and `ugreen-led-i2c --debug` prints a trace of the path. - Network LED: a single lost gateway ping no longer turns it red. The probe pings twice, and the LED turns red only after three failed probes in a row (about 90 s); a lost link or carrier is still red at once. Reported by [Chiconydu69](https://github.com/Chiconydu69). - DXP2800: fan control, case view and sensors confirmed by a user on a SUB2 board. Thanks to [DanielRuppen](https://github.com/DanielRuppen). - DXP2800 SUB2 boards: LED control through the Intel I2C controller confirmed on hardware, bay order verified. Thanks to [DanielRuppen](https://github.com/DanielRuppen). - DXP8800 Plus: the beeper test is confirmed by a user. Thanks to [Chiconydu69](https://github.com/Chiconydu69). - DXP8800 Plus: front-panel buttons and fan header 4 (register 0x1e) confirmed on hardware. Reported by [Chiconydu69](https://github.com/Chiconydu69). ### 5.4.0 - About now shows a "Your device" card instead of the full models table: your model, each capability with its status (confirmed, confirmed by users, untested, not supported) and a "Confirm my device" button that opens the Feedback page. The list of all models is one link away on the project website. - About: switch between the stable and the next channel (test builds) with one button, through Unraid's install dialog. - Diagnostics add the network LED state, the raw front panel pad words, installed files against the flash plugin version, the cron files, 24 hours of plugin start and stop lines and the PCI chain of each NVMe drive, and no longer print the user name of a fork's plugin URL. - Diagnostics list the I2C controllers, the HT32 LED controller device and the DesignWare modules, and say when the LED controller probably sits behind a controller without a driver. - The diagnosis can run from the web page: `diag --json` returns a scrubbed, structured result, and a box named "Unraid" no longer turns the `unraid:` line of the report into `<host>:`. - New Feedback page: say per capability what works on your model, collect the scrubbed device data in one step, and open a pre-filled GitHub issue (or bug report) with one click. About keeps the supported models table, always shown. The issue forms are generated from the model registry. "Back to stable" now shows the command that returns to next. - DXP2800 SUB2 boards: LED control through the Intel LPSS I2C controller, off until you set `lpss_leds="1"` in `leds.cfg`; `ugreen-led-i2c lpss-probe` checks the board first without writing (`--write` adds the chip id read) (not yet confirmed on hardware). - Falling fan curves round to the nearest percent. - diag and report also remove shortened IPv6 addresses and MAC addresses written with dashes. - Diagnostics no longer wait 30 s on graphics I2C buses: the scan skips them, lists each as skipped, keeps the SMBus result when it still times out, and `diag --full-scan` scans them too. - Diagnostics: `diag` runs its tool calls side by side and finishes in about 60 % of the time. - On the DXP4800 GT and iDX6011 Pro, stopping fan control while another fan tool is active now also stops the hardware watchdog the plugin was feeding, so the box no longer resets about 5 minutes later. - On the DXP2800 GT, quiet hours and per-fan minimums respect the 25 % hardware floor, so the recorded speed matches what runs. - If handing one fan back to the BIOS fails, the other fans are still handed back. - Switching the LEDs on now reports an error when the setting can't be saved on the flash drive. - MQTT: the plugin closes the connection and reconnects when the broker sends a packet the protocol forbids, and answers a QoS 2 message with PUBREC and PUBCOMP. - MQTT: a refused connection says why in the log (protocol version, client identifier, server unavailable, user name or password, not authorized). - MQTT: a user name, client ID or will topic that is not valid UTF-8, or a string over 65535 bytes, is refused with a clear message instead of sending a corrupt CONNECT. - The MQTT publisher no longer stops when a parity check runs very slowly. - MQTT: the log says when the broker refuses the command subscription (SUBACK failure), for example because of its access rules. - Fan detection run over ssh puts the fans back when the connection drops. - Exported fan profiles keep the 'fan may stop' setting. - A bay LED switched off (or dark at night) no longer glows faintly when its disk spins down. ### 5.3.1 - DXP8800 Plus: each NVMe shows in its real slot (M.2-1, M.2-2, the internal system slot); the factory SSD no longer appears in the PCIe slot. Reported by Chiconydu69. - Front panel: when the button registers can't be read (the BIOS hides them, as on a DXP8800 Plus), the plugin says so instead of showing the buttons as released. Reported by Chiconydu69. ### 5.3.0 - Case view: the two M.2 slots of the DXP4800 Plus and Pro are named M.2-1 and M.2-3 as printed on the board (M2-KEYM1, M2-KEYM3). Reported by ivolution. - DXP8800 Plus: a third NVMe SSD shows in the PCIe slot of the inside view instead of vanishing, and "Confirm my device" no longer flags unknown M.2 slots as a mismatch. Reported by Chiconydu69. - Diag no longer flags a stopped watchdog timer ("not counting", normal with the BIOS watchdog off) as a mismatch. Reported by Chiconydu69. - Spanish LED texts read more naturally: verbs for the effects, singular and plural forms, link speed. Translation by ivolution. - Spanish texts on the NAS pages read more naturally. Translation by ivolution. - DXP8800 Plus: fan control with custom curves confirmed. Reported by Chiconydu69. - Demo: the DXP4800 GT shows its 8 CPU threads; the DX4600 Pro's CPU is named Pentium Silver N6005. - The live demo, the site and the screenshots show each model's own CPU and memory type instead of one shared default. - The live demo, the site and the screenshots show each model's own CPU thread count instead of 12 for every model. ### 5.2.0 - Case view: inside view for the DXP2800 (M.2 slots and RAM, drawn after the GT) and the DXP480T Plus (four M.2 slots and two RAM sockets). - Case view for the DX4600 Pro, DX4700+ and DH2600: front, rear and inside drawn after UGREEN's renders (the DX4700+ after the DX4600 Pro), with the bays, LAN ports and memory the system reports. - Case view for the DXP4800S, DXP2800S and DXP6800S, drawn after their sister models. - Case view for the DXP6800 Ultra and DXP8800 Ultra: front and rear after UGREEN's renders, the inside drawn after the DXP6800 Pro and DXP8800 Plus (slot positions assumed). - Site: the DH2600 has its own model page with the live case view. ### 5.1.2 - About: the supported models table comes from the model list and shows the new case views. - About and README name both maintainers and thank the testers with their GitHub profiles. ### 5.1.1 - Sensors: an unconnected temperature input (for example "Motherboard -21 °C" on the DXP8800 Plus) is shown as not connected and no longer used. ### 5.1.0 - `/usr/local/emhttp/plugins/ugreen-nas-control/backend/ugreen-nas-ctl diag` prints one anonymised, read-only diagnostics block to paste into a bug report or the forum. - Case view for the DXP480T Plus: front with the power LED, rear ports and the four M.2 slots as drives. - Inside view for the DXP2800 GT: M.2 slots, RAM and what is installed. - Inside view for the DXP4800, DXP4800 Plus and Pro: M.2 slots, RAM and what is installed. - Inside view for the DXP8800 Plus and DXP8800 / Pro: M.2 slots, RAM, PCIe slot and what is installed. - Inside view for the iDX6011 / iDX6012 / Pro: M.2 slots, RAM and what is installed. - German interface texts reworded to read naturally. - Fans: an input that is missing from the first tick (script, GPU, HBA, drive) now follows the default input also with "hold", and a missing input is logged and sent as an Unraid notification. - Spanish, French, Italian, Dutch and Chinese texts use Unraid's own terms and read more naturally. - LEDs: DXP2800 boards that reject all LED commands are reported once and no longer retried in a loop, the DXP2800 picks its LED frame by the BIOS system version, and the network LED stops blinking when the LED daemon stops. - The model box on the LED page shows what the plugin does on your model from the model list (DXP480T Plus: power LED only). ### 5.0.0 - DXP2800 GT: fan control, confirmed on hardware by a community tester; it stays off until you run `/usr/local/emhttp/plugins/ugreen-nas-control/backend/ugreen-nas-fan cs201x confirm`, runs at 25 % minimum and puts the fans back to their start speed when the plugin stops. Probe by Alexander Schubert (issue 95). - DXP2800 GT: LED support for power, network and both disks, off until you set `cs201x_leds="1"` in `leds.cfg`; the LEDs go back as found when the daemon stops (not yet confirmed on hardware). DXP6800 and DXP6800S use the same LED frames. - Fans: new History page with the speed, rpm and temperatures of every fan over the last hour or 24 hours, and which input drove the speed at each moment (CPU, hottest drive, quiet hours cap, mover or parity check, emergency). Kept in the fan daemon's memory only, nothing is written to the flash drive. - Fans: a SAS or RAID controller (HBA) can be the temperature source of a fan group, read from the mpt3sas sensor or from storcli, and a FanCtrl Plus 2 storcli sensor is imported as such. - Fans: choose where each fan group reads its temperature (CPU, drives, NVMe, GPU, network chip or your own script), and export, import or take over the fan settings of FanCtrl Plus, FanCtrl Plus 2, Dynamix Auto Fan Control and IT-Kuny. - The fan daemon can shape its output (dead zone, kick-start, minimum running speed, up and down ramps) and follow a schedule: quiet hours cap the speed (never below the minimum, never during an emergency), and a running mover or parity check/rebuild can raise the case fans. Both are off by default; the defaults decide exactly as before. - About: a link to help the project with test hardware or a test on your model. - The interface is also available in French, Italian, Dutch and Simplified Chinese (machine-assisted, native review welcome). - MQTT: a display or Home Assistant can update Docker containers, one or all at once, with progress reported back, once you set `mqtt_control_containers="1"` (off by default, separate from `mqtt_control_updates`). - MQTT: an optional publisher sends temperatures, fans, drives (including each array disk), free space of the array and pools, parity check, rebuild and clear progress, network rates and IP addresses, alarms, notifications and available updates (plugins, containers, Unraid OS) to a broker for displays and Home Assistant; restart, shutdown and plugin updates by command are off unless switched on. - Front panel: `/usr/local/emhttp/plugins/ugreen-nas-control/backend/ugreen-nas panel buttons [--watch]` reads the power and reset button (read only) and `panel beep` sounds the beeper, from UGREEN's open-source drivers (not yet confirmed on hardware). - Other fan and LED tools (FanCtrl Plus, Dynamix Auto Fan Control, UGREEN LED drivers, ...) are detected; while one controls the fans, UGREEN NAS Control only reads them and shows a banner with a choice. - IT8613E models: the fan daemon feeds the watchdog the BIOS armed once it has seen it count (never arms it, yields to `it87_wdt`); new `/usr/local/emhttp/plugins/ugreen-nas-control/backend/ugreen-nas-fan power-on-ac` reads and sets power-on after AC loss. - Case view (front and rear) for the DXP2800 GT; the DXP4800 GT rear is closer to the real device (ribbed bezel, dotted lettering, light grille in the light theme); fan speed is written under the rear fans; LAN sockets flicker with traffic; the dashboard tile has a background of its own for the colour schemes Dark and Light. - Web UI for the new features: a Front panel page (button state, test beep), a DXP2800 GT fan card (diagnostics, confirm fans, forget), read-only fan readings for the plain iDX6011/iDX6012, a power-on-after-AC-loss card, the new watchdog states, a backlight value of "default", and the second LAN LED (`netdev2`) of the iDX6011 Pro on the LED pages. - DXP480T Plus: the power LED lights steady white again instead of flashing. - LEDs: the DXP2800 falls back to the frame UGREEN's own driver uses when the controller does not acknowledge the usual one (boards from December 2025); breath times stay at UGREEN's minimums (on 1000 ms, off 500 ms). - Script inputs work on Unraid: `/boot` is vfat and files there can never be executable, so the script now runs through the interpreter named in its shebang (`bash`, `sh`, `php`, also via `env`). A missing shebang or another interpreter is reported in the input test. - Sensors: on a model without fan control the fan controller shows "No fan control for this model" in a neutral style instead of a red "Not found". Reported with the DXP2800 GT (issue 95). - Fans: stopping or restoring now waits for a busy tool instead of giving up, and a slow controller, a hung helper or a broker restart no longer leaves fans, LEDs, MQTT status or state files in a bad state. - IT8613E: the watchdog survives a restart of the fan service; `power-on-ac set` from an unrecognised value needs `--force`. - Fan control for more models: a fan probe finds which output drives which fan on the DXP2800, DXP4800 (base, Plus, Pro) and DXP8800 Plus, checked against UGREEN's own drivers (the DXP4800 has no CPU fan output, the DXP8800 Plus a second case fan; fan control waits for your confirmation); the iDX6011 Pro gets its four fans, a 25 % floor and the LCD backlight setting (unconfirmed on a device); the plugin feeds the BIOS watchdog while the BIOS has it armed and never arms it. - iDX6011 Pro and DXP4800 GT: fan, watchdog and backlight now follow UGREEN's published drivers; on the Pro the fourth fan shows the third fan's speed while it reads 0, the backlight accepts 0 (default), the bays follow the Pro wiring, the power LED lights when the status daemon starts, and iDX6012 is recognised; the plain iDX6011/6012 shows fan and watchdog readings only (community reports, not yet checked on a device). - New models from UGREEN's product list: DXP6800 and Plus, DXP6800S, DXP8800 and Pro, DXP2800S and DH2600 (nobody has tested them yet). - Questions, ideas and showcases now go to GitHub Discussions (forms, links in README, website and the plugin's About page); issues stay for bugs and model reports. - Fan settings: new options (inputs, per-fan tuning, quiet hours, job rules) work with your existing settings; the first save of a new option keeps a backup of the old settings file as `fan.cfg.bak`. - Next channel: every push to `next` publishes a rolling test build `X.(Y+1).0-next.NNNNNN` (install URL `https://ugreen-nas-control.github.io/ugreen-nas-control/next/ugreen-nas-control.plg`), replacing the beta channel; it installs over stable in place, going back to a lower version needs `plugin install <url> forced`. - The plugin is one program now, with fewer helper scripts and sturdier start and stop: stale pid files no longer stop foreign processes and settings are checked before they reach the LED chip; `/usr/local/emhttp/plugins/ugreen-nas-control/backend/ugreen-nas-ctl report` prints an anonymised JSON for model reports. - Plugin versions always have three parts, `X.Y.Z`; this release is `5.0.0`. ### 4.2 - Sensors: on a model without fan control (every one but the DXP6800 Pro and the DXP4800 GT) the fan controller now says "No fan control for this model" instead of a red "Not found", which looked like a defect. Nothing changes in what the plugin does with the fan chip: it still does not touch it on these models. ### 4.1 - DXP2800 GT: a read-only test command, `ugreen-nas-fan cs201x`, for the Chipsea CS201x chip of this model (it is not an ITE chip). It reads the chip ID, the base address of the embedded controller, the rpm and duty of the two fans and two temperatures, and prints them. It writes no fan setting and does not switch anything on. Fan control for this model is not part of it yet; the plugin itself still does not touch the fan chip on this NAS. ### 4.0 - DXP2800 GT: front and rear view after the product photos (two bays with the LEDs below them, USB-C and USB-A at the front; the back with the grille of the DXP4800 GT (ribbed bezel, dot mesh, dotted lettering, the fan behind it when the NAS reports one), HDMI, USB 3.2, two USB 2.0, 10G LAN, reset and the power inlet). Fan control stays off for this model ### 3.9 - Rear views with fan control (DXP6800 Pro): the fan labels ("Case fan 1 · 900 rpm") are in front of the mesh and readable in both themes ### 3.8 - Rear view of the DXP4800 GT redrawn after the product photo (ribbed bezel around a dot mesh, dot-matrix lettering, ports at the photo positions); the rear fan turns with its rpm (thanks j3n57h0m45) - Light theme: the fan grille of the rear views is grey instead of a black slab - The LAN sockets drawn in the rear view flicker with the traffic (since the last poll); no frame around linked ports any more - The small 18 px icon: LEDs and fan stay inside the drawing ### 3.7 - Dashboard tile: with the colour scheme "Dark" or "Light" the tile has a background of its own again, in that scheme, whatever theme Unraid uses; "Same as Unraid" draws none and follows the dashboard (issue #91) ### 3.6 - Dashboard tile: it always takes its colours from the dashboard behind it (light or dark Unraid theme), whatever the colour scheme of the plugin says. Before, a fixed "dark" scheme gave light text on a light tile (issue #87) ### 3.5 - Fans: "Measure fans" runs every fan through 10 to 100 % (about 6 minutes, started on the Fans page, the daemon pauses meanwhile) and stores the rpm per speed. The curves then show a real rpm axis and the point table the rpm of each point. A short CPU burst no longer stops the measurement (4 checks in a row above 80 °C; 95 °C and above stops at once; the hottest reading goes to the syslog) - Fans: the Custom curve is set up in three steps (measure, lowest fan speed, curves), starting from Quiet, Standard or Performance; a floating save bar with Discard; "Case fans help the CPU" (the case fans never run slower than the CPU curve asks for; off by default); the minimum speed moved here from Safety - Quiet mode: the CPU curve starts at 15 % and is up to 5 points lower between about 55 and 85 °C (at the default minimum speed of 25 % the difference is smaller); the other modes are unchanged - Safety: all fans run at 100 % when the hottest NVMe SSD minus the NVMe offset reaches the disk limit (70 °C with the defaults), with the usual alert; the page shows the headroom to each limit - New Sensors page: the detected controllers and every reading by part with its source, the Safety limit and the fan it drives (sleeping disks are not woken up) - Overview regrouped (case and drives, cooling, processor and memory, network); the dashboard tile has a compact summary with fan mode, rpm, hottest temperature and alerts - Models without fan control show no fan controller chip in the title row - Scripts: install-dev.sh installs into a staging folder first, plg-hashes.py reports what it could not hash and exits 0 after a normal refresh, the test harness listens on localhost only ### 3.4 - Models without fan control (all but DXP6800 Pro and DXP4800 GT): no fan card, no "fan mode" tile and no "fan controller not usable" warning on the overview any more; Settings explains that there is no fan control for the model and no switch is needed - DXP8800 Plus: the rear view drawn after a photo of the device: one wide mesh with the UGREEN lettering and the two fans behind it, the PCIe slot, HDMI, USB 3.2, two USB 2.0, the two LAN ports, reset and the power inlet - DXP4800 GT: the rear view is the chassis of the DXP4800 Plus (mesh with the fan behind it, the ports in one row, two 10G LAN ports) - Case view of the DXP4800 family, DXP4800 GT, DXP2800 and DXP8800 Plus: the LEDs sit below the bays as on the DXP6800 Pro (no separate LED strip next to the LAN LED any more) ### 3.3 - Overview: a "Night mode" badge next to "Online" while the night mode has the LEDs dimmed or off (the badge is back); the night-mode hint in the LEDs card now follows changes of the schedule without a reload &releaseURL;/ugreen-nas-control-5.6.0.tar.xz aeb335a5eacfecbc32b2ebb3d490abe4650194bb0cdd3d3da6c0bbef17fecca7 c47c97c66adfecb513e96db3f43f68f4 NAME="&name;" VERSION="&version;" BOOT_DIR="&bootDIR;" ARCHIVE="&srcDIR;/ugreen-nas-control-5.6.0.tar.xz" EXEC_FILES="backend/ugreen-nas event/stopping" DATA_FILES="api.php UGREENNASControl.page UGREENNASDashboard.page images/ugreen-nas-control.png icons/ugreen-nas-control.png README.md LICENSE third-party.md include/diag.php include/lang.php include/fan_v2.php include/fan_schedule.php include/fan_history.php include/fan_inputs.php include/fan_profile.php include/fan_probe.php include/fan_backlight.php include/panel.php include/power_ac.php css/app.css css/fan-inputs.css css/fan-schedule.css css/fan-history.css css/fan-tools.css js/i18n.js js/app.js js/ledfx.js js/dash.js led/api.php led/css/app.css led/js/app.js led/js/i18n.js led/include/views.php css/led-embed.css led/images/ugreen-led-control.png" # Symbolic links, "path=target": the tool names are links to the one binary backend/ugreen-nas. LINKS="backend/ugreen-nas-ctl=ugreen-nas backend/ugreen-nas-fan=ugreen-nas led/backend/ugreen-led-ctl=../../backend/ugreen-nas led/backend/ugreen-led-i2c=../../backend/ugreen-nas" /dev/null 2>&1 "${PLUGIN_DIR}/backend/ugreen-nas-ctl" led-stop >/dev/null 2>&1 fi } # Fan control: the IT8613E (DXP6800 Pro) or the IT5571 EC (DXP4800 GT) is reached through /dev/port, no kernel module. # LEDs only if they were switched on. Both also run at boot. Neither is an install failure. start_daemons() { if "${PLUGIN_DIR}/backend/ugreen-nas-fan" probe >/dev/null 2>&1; then "${PLUGIN_DIR}/backend/ugreen-nas-ctl" start 2>&1 | sed 's/^/[UGREEN NAS Control] /' else log "WARNING: No supported fan controller found; only system info and temperatures are available." fi # The shutdown on a held power button (off unless switched on in the settings) needs no fan controller. "${PLUGIN_DIR}/backend/ugreen-nas-ctl" power-start 2>&1 | sed 's/^/[UGREEN NAS Control] /' if [ -f "${BOOT_DIR}/led.enabled" ]; then "${PLUGIN_DIR}/backend/ugreen-nas-ctl" led-boot 2>&1 | sed 's/^/[UGREEN NAS Control] /' fi } # A non-zero exit makes the plugin manager report the install as failed. die() { echo "[UGREEN NAS Control] ERROR: $1" >&2 rm -rf "${STAGE_DIR}" exit 1 } log "Installing ${VERSION} on kernel $(uname -r)" [ -f "${ARCHIVE}" ] || die "${ARCHIVE} is missing; the download did not finish." # # Stage: unpack and check everything next to the live folder. The running install is not touched yet. # tar -m: the files get the time of the install, not the archive's fixed time (browsers cache by Last-Modified). # rm -rf "${STAGE_DIR}" "${OLD_DIR}" mkdir -p "${STAGE_DIR}" || die "cannot create ${STAGE_DIR}" command -v xz >/dev/null || die "xz is missing; the archive cannot be unpacked" # Only files, folders and links, none outside the install folder. tar -tvJf "${ARCHIVE}" | awk 'substr($1, 1, 1) !~ /[-dl]/ { bad = 1 } END { exit bad }' || die "${ARCHIVE} holds entries that are not files, folders or links" tar -tJf "${ARCHIVE}" | grep -Eq '^/|(^|/)\.\.(/|$)' && die "${ARCHIVE} holds paths outside the install folder" tar -xJmf "${ARCHIVE}" -C "${STAGE_DIR}" --no-same-owner --no-same-permissions || die "unpacking ${ARCHIVE} failed" for f in ${EXEC_FILES} ${DATA_FILES}; do [ -f "${STAGE_DIR}/${f}" ] || die "${f} is missing from ${ARCHIVE}" done for l in ${LINKS}; do [ "$(readlink "${STAGE_DIR}/${l%%=*}")" = "${l#*=}" ] || die "link ${l%%=*} is missing from ${ARCHIVE}" done set -- ${EXEC_FILES} ${DATA_FILES} [ "$(find "${STAGE_DIR}" -type f | wc -l)" -eq "$#" ] || die "${ARCHIVE} holds files that are not on the install list" set -- ${LINKS} [ "$(find "${STAGE_DIR}" -type l | wc -l)" -eq "$#" ] || die "${ARCHIVE} holds links that are not on the install list" for f in ${EXEC_FILES}; do chmod 755 "${STAGE_DIR}/${f}" || die "chmod ${f} failed" done for f in ${DATA_FILES}; do chmod 644 "${STAGE_DIR}/${f}" || die "chmod ${f} failed" done for l in ${LINKS}; do [ -x "${STAGE_DIR}/${l%%=*}" ] || die "link ${l%%=*} does not lead to the binary" done # # Swap: stop the old daemons, move the old tree away, move the new one in (same folder, so each mv is atomic). # stop_daemons if [ -d "${PLUGIN_DIR}" ]; then mv "${PLUGIN_DIR}" "${OLD_DIR}" || { start_daemons; die "cannot move the old install away"; } fi if ! mv "${STAGE_DIR}" "${PLUGIN_DIR}"; then [ -d "${OLD_DIR}" ] && mv "${OLD_DIR}" "${PLUGIN_DIR}" start_daemons die "cannot move the new install in; the old one is back" fi rm -rf "${OLD_DIR}" # A favorite (the heart on the Settings page) is a label in the Menu line of the # .page file, which the swap has just replaced. Unraid puts it back at # boot only, so do that now as well. if [ -x /usr/local/emhttp/webGui/scripts/restore_favorites ]; then /usr/local/emhttp/webGui/scripts/restore_favorites fi start_daemons # # Drop cached files of older versions: only folders named like a version (3.6, 5.0.0, 5.1.0-next.000123). # Settings (fan.cfg, leds.cfg, fan_rpm.json, led.enabled) and anything else in there stay. # for dir in "${BOOT_DIR}"/*/; do [ -d "${dir}" ] || continue base="$(basename "${dir}")" [ "${base}" = "${VERSION}" ] && continue if [[ "${base}" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-next\.[0-9]+)?$ ]]; then rm -rf "${dir}" fi done log "Installation complete." ]]> NAME="&name;" BOOT_DIR="&bootDIR;" /dev/null 2>&1 "${PLUGIN_DIR}/backend/ugreen-nas-ctl" led-stop >/dev/null 2>&1 fi rm -rf "${PLUGIN_DIR}" "/usr/local/emhttp/plugins/.${NAME}.new" "/usr/local/emhttp/plugins/.${NAME}.old" # Cached versions and the cron file go; the settings stay. for dir in "${BOOT_DIR}"/*/; do [ -d "${dir}" ] || continue if [[ "$(basename "${dir}")" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-next\.[0-9]+)?$ ]]; then rm -rf "${dir}" fi done rm -f "${BOOT_DIR}/ugreen-nas-control.cron" rmdir "${BOOT_DIR}" 2>/dev/null # The BIOS snapshot and the CS201x write marker stay: if stop could not restore, a reinstall restores from them # instead of saving our own duty as the BIOS value. /var/run is RAM, a reboot clears them. for f in /var/run/ugreen-nas-control.*; do case "${f}" in */ugreen-nas-control.bios | */ugreen-nas-control.cs201x-wrote) ;; *) rm -f "${f}" ;; esac done /usr/local/sbin/update_cron log "Removed, the fans run at the BIOS values again. Settings stay in ${BOOT_DIR} (delete the folder to wipe them)." ]]>