Skip to content

Commit a3048b4

Browse files
committed
use gzip compression for speed
1 parent 0cddb2e commit a3048b4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

plugin/plugins/dynamix.unraid.net.plg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ exit 0
163163
# It will be rebuilt if the plugin install succeeds.
164164
if [ -d /usr/local/unraid-api/node_modules ]; then
165165
echo "Removing stale node_modules archive from the boot drive"
166-
rm -f /boot/config/plugins/dynamix.unraid.net/node-modules/node_modules.tar.xz
166+
rm -f /boot/config/plugins/dynamix.my.servers/node_modules.tar.gz
167167
fi
168168
169169
echo "Node.js installation successful"

plugin/source/dynamix.unraid.net/etc/rc.d/rc.unraid-api

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ uninstall() {
2020

2121
# Creates a backup of the global pnpm store directory
2222
# Args:
23-
# $1 - Path to the backup file (tar.xz format)
23+
# $1 - Path to the backup file (tar.gz format)
2424
# Returns:
2525
# 0 on success, 1 on failure
2626
backup_pnpm_store() {
@@ -130,14 +130,14 @@ pnpm_install_unraid_api() {
130130
return 1
131131
fi
132132

133-
local archive_file="/boot/config/plugins/dynamix.unraid.net/node-modules/node_modules.tar.xz"
133+
local archive_file="/boot/config/plugins/dynamix.my.servers/node_modules.tar.gz"
134134
local node_modules_dir="${unraid_api_dir}/node_modules"
135135

136136
# Check if archive exists and restore it
137137
if [ -f "$archive_file" ]; then
138138
echo "Found node_modules archive at '$archive_file'. Attempting to restore..."
139139
rm -rf "$node_modules_dir"
140-
if tar -xJf "$archive_file" -C "$(dirname "$node_modules_dir")" --preserve-permissions; then
140+
if tar -xzf "$archive_file" -C "$(dirname "$node_modules_dir")" --preserve-permissions; then
141141
echo "Successfully restored node_modules from archive."
142142
return 0
143143
else
@@ -149,6 +149,7 @@ pnpm_install_unraid_api() {
149149
rm -rf "$node_modules_dir"
150150
# Run pnpm install in a subshell to prevent changing the current working directory of the script
151151
(cd "$unraid_api_dir" && run_pnpm_install)
152+
echo "⚠️ Do not close this window yet"
152153
archive_node_modules
153154
}
154155

@@ -158,8 +159,8 @@ pnpm_install_unraid_api() {
158159
# 0 on success, 1 on failure
159160
archive_node_modules() {
160161
local source_dir="/usr/local/unraid-api/node_modules"
161-
local dest_dir="/boot/config/plugins/dynamix.unraid.net/node-modules"
162-
local archive_file="${dest_dir}/node_modules.tar.xz"
162+
local dest_dir="/boot/config/plugins/dynamix.my.servers"
163+
local archive_file="${dest_dir}/node_modules.tar.gz"
163164

164165
# Check if source directory exists
165166
if [ ! -d "$source_dir" ]; then
@@ -172,8 +173,8 @@ archive_node_modules() {
172173

173174
echo "Archiving node_modules from '$source_dir' to '$archive_file'"
174175

175-
# Create archive with xz compression, preserving symlinks
176-
if tar -cJf "$archive_file" -C "$(dirname "$source_dir")" "$(basename "$source_dir")"; then
176+
# Create archive with gzip compression level 1 (fastest), preserving symlinks
177+
if tar -cf "$archive_file" -I "gzip -1" -C "$(dirname "$source_dir")" "$(basename "$source_dir")"; then
177178
echo "node_modules archive created successfully."
178179
else
179180
echo "Error: Failed to create node_modules archive."

0 commit comments

Comments
 (0)