From a48e6bc452d73ff350027bdc3059733d9375d809 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Wed, 9 Jul 2025 17:54:50 +0200 Subject: [PATCH] =?UTF-8?q?Migrationsscript=20f=C3=BCr=20/boot/firmware=20?= =?UTF-8?q?erster=20Aufschlag.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- boot-mountpoint/migrate-mountpoint.sh | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 boot-mountpoint/migrate-mountpoint.sh diff --git a/boot-mountpoint/migrate-mountpoint.sh b/boot-mountpoint/migrate-mountpoint.sh new file mode 100755 index 0000000..6eba960 --- /dev/null +++ b/boot-mountpoint/migrate-mountpoint.sh @@ -0,0 +1,66 @@ +#!/usr/bin/bash + +# Output colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Logging-Funktion +log() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Check for root privileges +if [ "$EUID" -ne 0 ]; then + echo "This script must be run as root" + exit 1 +fi + +# Create /boot/firmware dir if it doesn't exist +if [ ! -d /boot/firmware ]; then mkdir -p /boot/firmware; fi + +# Enable extended globbing for pattern matching +shopt -s extglob + +# Copy all files from /boot to /boot/firmware and remove the originals +log "Moving files to /boot/firmware..." +rsync -av --remove-source-files /boot/ /boot/firmware/ + +# Update the mount point for /boot in fstab to /boot/firmware +log "Updating fstab..." +cp -a /etc/fstab /etc/fstab.bak # create backup +sed -i 's|^\([^#].*\)[[:space:]]/boot[[:space:]]|\1 /boot/firmware |' /etc/fstab + +# Sync cache and reboot the system to apply changes +sync +# prompt for reboot +echo "" +while true; do + read -p "Möchtest du das System jetzt neustarten, um die Änderungen zu testen? (J/N): " choice + case $choice in + [Jj]* ) + warn "System will be rebooted in 3 seconds" + sleep 2 + reboot + ;; + [Nn]* ) + log "Neustart übersprungen." + log "Bitte starte das System manuell neu, um die Änderungen zu testen." + break + ;; + * ) + warn "Bitte antworte mit J (Ja) oder N (Nein)." + ;; + esac +done + +exit 0