Commit Graph
3 Commits
Author SHA1 Message Date
Claude 4f2435ca35 Fix kiosk detection to handle restricted directory permissions
The scripts were failing to find the kiosk installation at /home/kiosk/kiosk-app
because the /home/kiosk directory has restricted permissions (drwxr-x---),
preventing regular users from reading it.

Changes in both update_electron.sh and install_kiosk_0.9.2-6.sh:

1. Updated find_kiosk_dir() to use sudo for all file checks
   - sudo test -f for checking if main.js exists
   - Prevents "permission denied" errors on restricted directories

2. Added Method 4: Detect from running electron process
   - Parses ps output to find electron executable path
   - Extracts app directory from the path
   - Provides fallback when directory searches fail

3. Updated get_current_electron_version functions
   - Use sudo test -f to check if package.json exists
   - Use sudo grep to read package.json and get version
   - Ensures version detection works with restricted permissions

4. Fixed directory existence checks
   - Use sudo test -d for checking kiosk directory

These changes allow the scripts to:
- Find kiosk installations in directories with restricted permissions
- Detect installations even when run as a regular user
- Work correctly with the standard /home/kiosk setup (drwxr-x---)
- Provide better fallback detection using running processes

The scripts will now prompt for sudo password when needed to check
for files in restricted directories, then continue normally.
2025-11-20 16:24:31 +00:00
Claude 2d05767193 Fix update_electron.sh to run without sudo
Changed the script to run as a regular user instead of requiring sudo.
The script now:
- Checks that it's NOT being run as root (prevents sudo usage)
- Uses sudo for individual commands that need elevated privileges
- Prompts for sudo password only when needed

Changes:
- Removed EUID check that required running with sudo
- Added check to prevent running as root
- Added sudo to backup operations (mkdir, cp, file writes)
- All systemctl and npm install commands already use sudo appropriately

This matches the behavior of install_kiosk scripts which should be run
as a regular user, not with sudo.

Usage: ./update_electron.sh (not sudo ./update_electron.sh)
2025-11-20 15:57:40 +00:00
Claude ecbfd19bb5 Add comprehensive Electron update script with safety checks
This script addresses issues with the manual Electron update process by:

- Detecting kiosk installation across multiple methods (user home, systemd service)
- Checking if Electron is actually running (not just installed)
- Getting current Electron version from both package.json and node_modules
- Fetching latest stable Electron version from npm registry with fallbacks
- Displaying clear version comparison (current vs latest)
- Warning users to check for breaking changes with links to documentation
- Creating automatic backups of package.json, package-lock.json, and version info
- Providing clear restore instructions if something goes wrong
- Requiring user confirmation at multiple steps before making changes
- Automatically attempting rollback if the update fails
- Fixing chrome-sandbox permissions after installation
- Managing kiosk service stop/start around the update

The script handles edge cases like:
- Missing or moved installations
- Network failures when fetching versions
- Failed npm installations with automatic recovery
- Permission issues with proper sudo user handling

Users can now safely update Electron with confidence that they can restore
if needed, and with clear visibility into what versions are being used.
2025-11-20 15:10:29 +00:00