]> ### 2025.09.26 - Initial release of the Encrypted Drive Manager plugin. &txz_url; &plugin_md5; /dev/null || true echo " Cleaned up old packages, kept version: $CURRENT_VERSION" else echo " Warning: Could not determine installed version for cleanup" fi # Create plugin config file with default settings CONFIG_FILE="$PERSISTENT_DIR/config" if [[ ! -f "$CONFIG_FILE" ]]; then echo "AUTO_UNLOCK_ENABLED=false" > "$CONFIG_FILE" echo " Created plugin config file with auto-unlock disabled by default" fi # Set executable permissions on plugin scripts if [[ -d "$PLUGIN_SCRIPTS_DIR" ]]; then chmod +x "$PLUGIN_SCRIPTS_DIR"/*.sh 2>/dev/null || true chmod +x "$PLUGIN_SCRIPTS_DIR"/*.php 2>/dev/null || true echo " Set permissions for plugin script files" else echo " Warning: Scripts directory not found at $PLUGIN_SCRIPTS_DIR" fi # Copy scripts to persistent location for event system use if [[ -f "$PLUGIN_SCRIPTS_DIR/fetch_key.sh" ]]; then cp "$PLUGIN_SCRIPTS_DIR/fetch_key.sh" "$PERSISTENT_DIR/fetch_key" chmod +x "$PERSISTENT_DIR/fetch_key" echo " Copied fetch_key script to persistent location" else echo " Warning: fetch_key.sh not found in $PLUGIN_SCRIPTS_DIR" fi if [[ -f "$PLUGIN_SCRIPTS_DIR/delete_key.sh" ]]; then cp "$PLUGIN_SCRIPTS_DIR/delete_key.sh" "$PERSISTENT_DIR/delete_key" chmod +x "$PERSISTENT_DIR/delete_key" echo " Copied delete_key script to persistent location" else echo " Warning: delete_key.sh not found in $PLUGIN_SCRIPTS_DIR" fi # Check if auto-unlock is enabled and recreate event files if needed CONFIG_FILE="$PERSISTENT_DIR/config" if [[ -f "$CONFIG_FILE" ]]; then source "$CONFIG_FILE" if [[ "$AUTO_UNLOCK_ENABLED" == "true" ]]; then echo " Auto-unlock is enabled - creating event files for boot..." # Create event directories mkdir -p "$EVENT_STARTING_DIR" mkdir -p "$EVENT_STARTED_DIR" # Copy scripts to event directories (same as old working plugin) if [[ -f "$PERSISTENT_DIR/fetch_key" ]] && [[ -f "$PERSISTENT_DIR/delete_key" ]]; then install -D "$PERSISTENT_DIR/fetch_key" "$EVENT_STARTING_DIR/fetch_key" install -D "$PERSISTENT_DIR/delete_key" "$EVENT_STARTED_DIR/delete_key" chmod +x "$EVENT_STARTING_DIR/fetch_key" "$EVENT_STARTED_DIR/delete_key" echo " Event files created - auto-unlock ready" else echo "Source scripts not found - auto-unlock may not work" fi else echo " Auto-unlock is disabled - no event files created" fi else echo " No config file found - auto-unlock disabled by default" # Ensure any existing event files are removed rm -f "$EVENT_STARTING_DIR/fetch_key" rm -f "$EVENT_STARTED_DIR/delete_key" fi echo "" echo "----------------------------------------------------" echo " Encrypted Drive Manager version &plugin_version; has been installed." echo " Event infrastructure ready - auto-unlock managed automatically" echo " Scripts are available at: $PERSISTENT_DIR" echo "----------------------------------------------------" echo "" ]]> /dev/null); do removepkg "$pkg" 2>/dev/null || true done # Clean up plugin directory PLUGIN_DIR="/usr/local/emhttp/plugins/encrypted-drive-manager" if [[ -d "$PLUGIN_DIR" ]]; then echo " Removing plugin files from $PLUGIN_DIR" rm -rf "$PLUGIN_DIR" 2>/dev/null || true fi # Clean up persistent config directory (includes our copied scripts) CONFIG_DIR="/boot/config/plugins/encrypted-drive-manager" if [[ -d "$CONFIG_DIR" ]]; then echo " Removing persistent files from $CONFIG_DIR" rm -rf "$CONFIG_DIR" 2>/dev/null || true fi # Note about LUKS header backups (intentionally preserved for security) LUKS_BACKUP_DIR="/boot/config/luksheaders" if [[ -d "$LUKS_BACKUP_DIR" ]]; then echo " Note: LUKS header backups preserved in $LUKS_BACKUP_DIR for security" fi echo "" echo "----------------------------------------------------" echo " Complete cleanup finished - system restored to pre-install state" echo " Encrypted Drive Manager has been successfully removed." echo "----------------------------------------------------" echo "" ]]>