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
|
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
|
# Welcome message
|
||||||
clear
|
clear
|
||||||
@@ -345,8 +304,7 @@ done
|
|||||||
|
|
||||||
# Regenerate partition UUIDs and labels to prevent boot conflicts with USB
|
# Regenerate partition UUIDs and labels to prevent boot conflicts with USB
|
||||||
echo "Regenerating partition identifiers..."
|
echo "Regenerating partition identifiers..."
|
||||||
mapfile -t uuid_mappings < <(regenerate_partition_identifiers "$TARGET_DEVICE")
|
regenerate_partition_identifiers "$TARGET_DEVICE" > /dev/null
|
||||||
echo "Found ${#uuid_mappings[@]} UUID mappings to update"
|
|
||||||
|
|
||||||
# Mount and make final adjustments
|
# Mount and make final adjustments
|
||||||
TEMP_MOUNT="/mnt/stormux_target"
|
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
|
# 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"
|
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
|
# Generate new fstab using genfstab
|
||||||
if [[ ${#uuid_mappings[@]} -gt 0 ]]; then
|
echo "Generating new fstab with current UUIDs..."
|
||||||
echo "Updating fstab with new UUIDs..."
|
if command -v genfstab >/dev/null 2>&1; then
|
||||||
if update_fstab_uuids "$TEMP_MOUNT" "${uuid_mappings[@]}"; then
|
# Backup original fstab
|
||||||
echo "fstab updated successfully"
|
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
|
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
|
fi
|
||||||
else
|
else
|
||||||
echo "No UUID mappings found - fstab will not be updated"
|
echo "Warning: genfstab not available - fstab may have incorrect UUIDs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Unmounting target partition..."
|
echo "Unmounting target partition..."
|
||||||
@@ -386,12 +349,7 @@ else
|
|||||||
fi
|
fi
|
||||||
sudo rmdir "$TEMP_MOUNT"
|
sudo rmdir "$TEMP_MOUNT"
|
||||||
|
|
||||||
# Re-enable speech before success message
|
# Success message (using Fenrir auto-restore pattern)
|
||||||
echo "Restoring speech output..."
|
|
||||||
echo "command toggletempdisablespeech" | socat - UNIX-CLIENT:/tmp/fenrirscreenreader-deamon.sock 2>/dev/null || true
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# Success message
|
|
||||||
echo
|
echo
|
||||||
echo "========================================="
|
echo "========================================="
|
||||||
echo "Installation completed successfully!"
|
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 "The system will boot from the internal disk."
|
||||||
echo "========================================="
|
echo "========================================="
|
||||||
echo
|
echo
|
||||||
echo "Press Enter to continue..."
|
echo "Press any key to continue..."
|
||||||
read -r
|
read -r
|
||||||
|
|||||||
Reference in New Issue
Block a user