Install to disk was more broken than I thought. Hopefully fixed this time.
This commit is contained in:
@@ -184,47 +184,6 @@ regenerate_partition_identifiers() {
|
||||
done
|
||||
}
|
||||
|
||||
# Function to update fstab with new UUIDs
|
||||
update_fstab_uuids() {
|
||||
local mount_point="$1"
|
||||
shift
|
||||
local uuid_mappings=("$@")
|
||||
|
||||
local fstab_file="$mount_point/etc/fstab"
|
||||
|
||||
if [[ ! -f "$fstab_file" ]]; then
|
||||
echo "Warning: /etc/fstab not found in mounted system"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Updating /etc/fstab with new UUIDs..."
|
||||
|
||||
# Create backup of original fstab
|
||||
sudo cp "$fstab_file" "$fstab_file.backup" || {
|
||||
echo "Warning: Could not create fstab backup"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Apply UUID mappings to fstab
|
||||
local temp_fstab
|
||||
temp_fstab=$(mktemp)
|
||||
|
||||
for mapping in "${uuid_mappings[@]}"; do
|
||||
if [[ "$mapping" =~ ^UUID_MAPPING:([^:]+):([^:]+)$ ]]; then
|
||||
local old_uuid="${BASH_REMATCH[1]}"
|
||||
local new_uuid="${BASH_REMATCH[2]}"
|
||||
|
||||
# Replace old UUID with new UUID in fstab
|
||||
sudo sed "s/UUID=$old_uuid/UUID=$new_uuid/g" "$fstab_file" | sudo tee "$temp_fstab" > /dev/null
|
||||
sudo cp "$temp_fstab" "$fstab_file"
|
||||
|
||||
echo "Updated fstab: $old_uuid -> $new_uuid"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f "$temp_fstab"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Welcome message
|
||||
clear
|
||||
@@ -345,8 +304,7 @@ done
|
||||
|
||||
# Regenerate partition UUIDs and labels to prevent boot conflicts with USB
|
||||
echo "Regenerating partition identifiers..."
|
||||
mapfile -t uuid_mappings < <(regenerate_partition_identifiers "$TARGET_DEVICE")
|
||||
echo "Found ${#uuid_mappings[@]} UUID mappings to update"
|
||||
regenerate_partition_identifiers "$TARGET_DEVICE" > /dev/null
|
||||
|
||||
# Mount and make final adjustments
|
||||
TEMP_MOUNT="/mnt/stormux_target"
|
||||
@@ -365,16 +323,21 @@ if sudo mount "$TARGET_ROOT_PART" "$TEMP_MOUNT" 2>/dev/null; then
|
||||
# Set immutable attribute to prevent accidental deletion
|
||||
sudo chattr +i "$TEMP_MOUNT/home/stormux/.baremetal" 2>/dev/null || echo "Warning: Could not set immutable attribute on .baremetal"
|
||||
|
||||
# Update /etc/fstab with new UUIDs
|
||||
if [[ ${#uuid_mappings[@]} -gt 0 ]]; then
|
||||
echo "Updating fstab with new UUIDs..."
|
||||
if update_fstab_uuids "$TEMP_MOUNT" "${uuid_mappings[@]}"; then
|
||||
echo "fstab updated successfully"
|
||||
# Generate new fstab using genfstab
|
||||
echo "Generating new fstab with current UUIDs..."
|
||||
if command -v genfstab >/dev/null 2>&1; then
|
||||
# Backup original fstab
|
||||
sudo cp "$TEMP_MOUNT/etc/fstab" "$TEMP_MOUNT/etc/fstab.backup" || echo "Warning: Could not backup fstab"
|
||||
|
||||
# Generate new fstab based on current mount points
|
||||
if genfstab -U "$TEMP_MOUNT" | sudo tee "$TEMP_MOUNT/etc/fstab" > /dev/null; then
|
||||
echo "fstab generated successfully with genfstab"
|
||||
else
|
||||
echo "Warning: fstab update failed"
|
||||
echo "Warning: genfstab failed, restoring backup"
|
||||
sudo cp "$TEMP_MOUNT/etc/fstab.backup" "$TEMP_MOUNT/etc/fstab" 2>/dev/null || true
|
||||
fi
|
||||
else
|
||||
echo "No UUID mappings found - fstab will not be updated"
|
||||
echo "Warning: genfstab not available - fstab may have incorrect UUIDs"
|
||||
fi
|
||||
|
||||
echo "Unmounting target partition..."
|
||||
@@ -386,12 +349,7 @@ else
|
||||
fi
|
||||
sudo rmdir "$TEMP_MOUNT"
|
||||
|
||||
# Re-enable speech before success message
|
||||
echo "Restoring speech output..."
|
||||
echo "command toggletempdisablespeech" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock 2>/dev/null || true
|
||||
sleep 1
|
||||
|
||||
# Success message
|
||||
# Success message (using Fenrir auto-restore pattern)
|
||||
echo
|
||||
echo "========================================="
|
||||
echo "Installation completed successfully!"
|
||||
@@ -400,5 +358,5 @@ echo "You can now reboot and remove the USB drive."
|
||||
echo "The system will boot from the internal disk."
|
||||
echo "========================================="
|
||||
echo
|
||||
echo "Press Enter to continue..."
|
||||
echo "Press any key to continue..."
|
||||
read -r
|
||||
|
||||
Reference in New Issue
Block a user