Files
NebulaBrowser/update-appdir.sh
T
andrew 618ea7d12d Prefer usr/user-data for portable data
Rename and consolidate portable user-data to usr/user-data and update tooling and runtime to match. Updated appdir-example/run-nebula.sh to point at usr/user-data; make-appdir.sh and update-appdir.sh now patch/copy the launcher, create the usr/user-data directory and set secure permissions (mkdir -p, chmod 700), and remove sed backups. portable-data.js now defaults to app-local user-data and prefers <AppDir>/usr/user-data on Linux AppDir builds (with safe fs checks). Also minor UI change in renderer/setup.css to make the footer background transparent and disable the backdrop blur.
2026-02-19 17:33:26 +13:00

135 lines
4.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Update nebula-appdir with local source changes
# Run this after making changes to sync them to the AppDir
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
APPDIR_ROOT="$SCRIPT_DIR/nebula-appdir"
# Support both layouts:
# 1) nebula-appdir/resources/app
# 2) nebula-appdir/nebula-appdir/resources/app (example layout)
if [ -d "$APPDIR_ROOT/resources" ] || [ -f "$APPDIR_ROOT/resources/app.asar" ]; then
RESOURCES_DIR="$APPDIR_ROOT/resources"
else
RESOURCES_DIR="$APPDIR_ROOT/nebula-appdir/resources"
fi
APP_DIR="$RESOURCES_DIR/app"
ASAR_FILE="$RESOURCES_DIR/app.asar"
ASAR_ORIG_FILE="$RESOURCES_DIR/app.asar.orig"
echo "🚀 Updating Nebula AppDir..."
echo " Source: $SCRIPT_DIR"
echo " Target: $APP_DIR"
echo ""
# Check if target exists (or extract from app.asar if present)
if [ ! -d "$APP_DIR" ]; then
if [ -f "$ASAR_FILE" ] || [ -f "$ASAR_ORIG_FILE" ]; then
if command -v npx &> /dev/null; then
if [ -f "$ASAR_FILE" ]; then
echo "️ app.asar detected. Extracting to $APP_DIR..."
(cd "$RESOURCES_DIR" && npx asar extract "app.asar" "app")
mv "$ASAR_FILE" "$ASAR_ORIG_FILE" 2>/dev/null || true
else
echo "️ app.asar.orig detected. Extracting to $APP_DIR..."
(cd "$RESOURCES_DIR" && npx asar extract "app.asar.orig" "app")
fi
else
echo "❌ Error: $APP_DIR not found and npx is not available to extract app.asar."
echo " Install Node.js/npm, then run:"
echo " cd $RESOURCES_DIR && npx asar extract app.asar app"
exit 1
fi
else
echo "❌ Error: AppDir not found at $APP_DIR"
exit 1
fi
fi
# Files to sync (main app files)
FILES=(
"main.js"
"preload.js"
"package.json"
"portable-data.js"
"gpu-config.js"
"gpu-fallback.js"
"performance-monitor.js"
"plugin-manager.js"
"theme-manager.js"
"bookmarks.json"
)
# Directories to sync
DIRS=(
"renderer"
"themes"
"assets"
"plugins"
"documentation"
)
# Sync individual files
echo "📄 Syncing files..."
for file in "${FILES[@]}"; do
if [ -f "$SCRIPT_DIR/$file" ]; then
cp "$SCRIPT_DIR/$file" "$APP_DIR/$file"
echo "$file"
else
echo "$file (not found, skipping)"
fi
done
# Update main launcher scripts if present
echo ""
echo "🔄 Syncing launcher scripts..."
if [ -f "$SCRIPT_DIR/appdir-example/run-nebula.sh" ]; then
cp "$SCRIPT_DIR/appdir-example/run-nebula.sh" "$APPDIR_ROOT/run-nebula.sh"
sed -i.bak 's|usr/data|usr/user-data|g' "$APPDIR_ROOT/run-nebula.sh" && rm -f "$APPDIR_ROOT/run-nebula.sh.bak"
chmod +x "$APPDIR_ROOT/run-nebula.sh" || true
echo " ✓ run-nebula.sh"
fi
for launcher in "Nebula-Desktop" "Nebula-Controller"; do
if [ -f "$SCRIPT_DIR/nebula-appdir/$launcher" ]; then
cp "$SCRIPT_DIR/nebula-appdir/$launcher" "$APPDIR_ROOT/$launcher"
chmod +x "$APPDIR_ROOT/$launcher" || true
echo "$launcher"
fi
done
# Sync Nebula symlink if it exists
if [ -L "$SCRIPT_DIR/nebula-appdir/Nebula" ]; then
rm -f "$APPDIR_ROOT/Nebula"
ln -sf "Nebula-Desktop" "$APPDIR_ROOT/Nebula"
echo " ✓ Nebula (symlink)"
fi
# Sync directories
echo ""
echo "📁 Syncing directories..."
for dir in "${DIRS[@]}"; do
if [ -d "$SCRIPT_DIR/$dir" ]; then
# Use rsync if available, otherwise use cp
if command -v rsync &> /dev/null; then
rsync -a --delete "$SCRIPT_DIR/$dir/" "$APP_DIR/$dir/"
else
rm -rf "$APP_DIR/$dir"
cp -r "$SCRIPT_DIR/$dir" "$APP_DIR/$dir"
fi
echo "$dir/"
else
echo "$dir/ (not found, skipping)"
fi
done
# Ensure portable user-data directory exists for Linux AppDir builds
mkdir -p "$APPDIR_ROOT/usr/user-data"
chmod 700 "$APPDIR_ROOT/usr/user-data" || true
echo " ✓ usr/user-data/"
echo ""
echo "✅ AppDir updated successfully!"
echo ""
echo "To run Nebula, use:"
echo " ./nebula-appdir/run-nebula.sh"