|
9 | 9 | <!ENTITY txz_sha256 ""> |
10 | 10 | <!ENTITY txz_url ""> |
11 | 11 | <!ENTITY txz_name ""> |
| 12 | + <!ENTITY core_source "/boot/config/plugins/dynamix.my.servers/&core_txz_name;"> |
| 13 | + <!ENTITY core_txz_sha256 "1c1dc2dc6b94f44e33ee4208d98f533184fc248e0a29e8693aa01be4abf86bdd"> |
| 14 | + <!ENTITY core_txz_url "https://pub-7247242eea6d482488594f04a3d7d4be.r2.dev/unraid-0.1.0-2026.01.14.1.txz"> |
| 15 | + <!ENTITY core_txz_name "unraid-0.1.0-2026.01.14.1.txz"> |
12 | 16 | <!ENTITY arch "x86_64"> |
13 | 17 | <!ENTITY build "1"> |
14 | 18 | <!ENTITY tag ""> |
@@ -52,6 +56,12 @@ exit 0 |
52 | 56 | <SHA256>&txz_sha256;</SHA256> |
53 | 57 | </FILE> |
54 | 58 |
|
| 59 | + <!-- download unraid core txz --> |
| 60 | + <FILE Name="&core_source;"> |
| 61 | + <URL>&core_txz_url;</URL> |
| 62 | + <SHA256>&core_txz_sha256;</SHA256> |
| 63 | + </FILE> |
| 64 | + |
55 | 65 | <!-- Check for compatible Unraid version --> |
56 | 66 | <FILE Run="/usr/bin/php" Method="install"> |
57 | 67 | <INLINE> |
@@ -320,6 +330,21 @@ exit 0 |
320 | 330 | fi |
321 | 331 | fi |
322 | 332 |
|
| 333 | + # Stop and remove Unraid Core package |
| 334 | + if [ -x "/etc/rc.d/rc.unraid" ]; then |
| 335 | + echo "Stopping Unraid Core..." |
| 336 | + /etc/rc.d/rc.unraid stop || echo "Warning: Failed to stop Unraid Core" |
| 337 | + fi |
| 338 | +
|
| 339 | + core_pkg_installed=$(ls -1 /var/log/packages/unraid-* 2>/dev/null | head -1) |
| 340 | + if [ -n "$core_pkg_installed" ]; then |
| 341 | + core_pkg_basename=$(basename "$core_pkg_installed") |
| 342 | + echo "Removing core package: $core_pkg_basename" |
| 343 | + removepkg --terse "$core_pkg_basename" |
| 344 | + else |
| 345 | + echo "No Unraid Core package found" |
| 346 | + fi |
| 347 | +
|
323 | 348 | # File restoration function |
324 | 349 | echo "Restoring files..." |
325 | 350 | |
@@ -404,6 +429,9 @@ exit 0 |
404 | 429 | PKG_FILE="&source;" # Full path to the package file including .txz extension |
405 | 430 | PKG_URL="&txz_url;" # URL where package was downloaded from |
406 | 431 | PKG_NAME="&txz_name;" # Name of the package file |
| 432 | + CORE_PKG_FILE="&core_source;" |
| 433 | + CORE_PKG_URL="&core_txz_url;" |
| 434 | + CORE_PKG_NAME="&core_txz_name;" |
407 | 435 | CONNECT_API_VERSION="&api_version;" # Version of API included with Connect |
408 | 436 | <![CDATA[ |
409 | 437 | # Function to compare version numbers using PHP's version_compare |
@@ -524,6 +552,37 @@ else |
524 | 552 | echo "Connect plugin remains installed but API was not modified" |
525 | 553 | fi |
526 | 554 |
|
| 555 | +# Install Unraid Core package |
| 556 | +if [ -f "$CORE_PKG_FILE" ]; then |
| 557 | + echo "Installing Unraid Core package..." |
| 558 | + # Clean up any old core package txz files if they don't match our current version |
| 559 | + for txz_file in /boot/config/plugins/dynamix.my.servers/unraid-*.txz; do |
| 560 | + if [ -f "$txz_file" ] && [ "$txz_file" != "${CORE_PKG_FILE}" ]; then |
| 561 | + echo "Removing old core package file: $txz_file" |
| 562 | + rm -f "$txz_file" |
| 563 | + fi |
| 564 | + done |
| 565 | +
|
| 566 | + # Stop the core service before mutating /usr/local/unraid |
| 567 | + if [ -x "/etc/rc.d/rc.unraid" ]; then |
| 568 | + echo "Stopping Unraid Core service before upgrade..." |
| 569 | + /etc/rc.d/rc.unraid stop || echo "Warning: Failed to stop Unraid Core service" |
| 570 | + fi |
| 571 | +
|
| 572 | + upgradepkg --install-new --reinstall "${CORE_PKG_FILE}" |
| 573 | + if [ $? -ne 0 ]; then |
| 574 | + echo "⚠️ Core package installation failed" |
| 575 | + exit 1 |
| 576 | + fi |
| 577 | +
|
| 578 | + if [ -f "/etc/rc.d/rc.unraid" ]; then |
| 579 | + chmod +x /etc/rc.d/rc.unraid |
| 580 | + fi |
| 581 | +else |
| 582 | + echo "⚠️ Core package file not found: $CORE_PKG_FILE" |
| 583 | + exit 1 |
| 584 | +fi |
| 585 | +
|
527 | 586 | exit 0 |
528 | 587 | ]]> |
529 | 588 | </INLINE> |
@@ -599,6 +658,13 @@ echo "If no additional messages appear within 30 seconds, it is safe to refresh |
599 | 658 | /etc/rc.d/rc.unraid-api start |
600 | 659 |
|
601 | 660 | echo "Unraid API service started" |
| 661 | +if [ -x "/etc/rc.d/rc.unraid" ]; then |
| 662 | + echo "Starting Unraid Core service" |
| 663 | + /etc/rc.d/rc.unraid start |
| 664 | + echo "Unraid Core service started" |
| 665 | +else |
| 666 | + echo "Warning: rc.unraid not found; core service not started" |
| 667 | +fi |
602 | 668 | echo "✅ Installation is complete, it is safe to close this window" |
603 | 669 | echo |
604 | 670 | exit 0 |
|
0 commit comments