87 lines
No EOL
2.4 KiB
Bash
87 lines
No EOL
2.4 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
echo "=========================================="
|
|
echo " ParticleOS bootc Installation"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "This will install ParticleOS using bootc to your system."
|
|
echo "WARNING: This is a destructive operation that will erase the target device."
|
|
echo ""
|
|
|
|
# Check if running from live environment
|
|
if [ ! -f /etc/casper/hostname ]; then
|
|
echo "Error: This script must be run from the ParticleOS live environment."
|
|
exit 1
|
|
fi
|
|
|
|
# Check for target disk
|
|
if [ $# -eq 0 ]; then
|
|
echo "Usage: $0 <target-device>"
|
|
echo "Example: $0 /dev/sda"
|
|
echo ""
|
|
echo "Available disks:"
|
|
echo "=================="
|
|
lsblk -d -o NAME,SIZE,MODEL,TYPE
|
|
echo ""
|
|
echo "Available partitions:"
|
|
echo "====================="
|
|
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
|
|
echo ""
|
|
echo "Please specify the target device (e.g., /dev/sda for entire disk)"
|
|
exit 1
|
|
fi
|
|
|
|
TARGET_DEVICE="$1"
|
|
|
|
# Validate target device
|
|
if [ ! -b "$TARGET_DEVICE" ]; then
|
|
echo "Error: $TARGET_DEVICE is not a valid block device."
|
|
exit 1
|
|
fi
|
|
|
|
# Show device information
|
|
echo "Target device: $TARGET_DEVICE"
|
|
echo "Device information:"
|
|
lsblk "$TARGET_DEVICE" -o NAME,SIZE,TYPE,MOUNTPOINT
|
|
echo ""
|
|
|
|
# Final confirmation
|
|
echo "=========================================="
|
|
echo "FINAL WARNING: This will completely erase $TARGET_DEVICE"
|
|
echo "All data on this device will be lost permanently!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Type 'YES' (in uppercase) to confirm installation:"
|
|
read -r confirmation
|
|
|
|
if [ "$confirmation" != "YES" ]; then
|
|
echo "Installation cancelled."
|
|
exit 1
|
|
fi
|
|
|
|
echo ""
|
|
echo "Installing ParticleOS using bootc..."
|
|
echo "This may take several minutes..."
|
|
|
|
# Install ParticleOS using bootc
|
|
if bootc install --target "$TARGET_DEVICE" particleos-system:latest; then
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Installation completed successfully!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Reboot your system"
|
|
echo "2. Boot from $TARGET_DEVICE"
|
|
echo "3. Enjoy ParticleOS!"
|
|
echo ""
|
|
else
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Installation failed!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Please check the error messages above and try again."
|
|
exit 1
|
|
fi |