Compare commits
10 Commits
c750cb4c69
...
815a66d808
Author | SHA1 | Date | |
---|---|---|---|
815a66d808 | |||
f7336ae3e6 | |||
e2346fa32f | |||
ff7035cd22 | |||
4bd2566b04 | |||
0d67903acf | |||
96f5040dfe | |||
a48e6bc452 | |||
e64461d64c | |||
dde357c695 |
66
boot-mountpoint/migrate-mountpoint.sh
Executable file
66
boot-mountpoint/migrate-mountpoint.sh
Executable file
@@ -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
|
@@ -1,19 +1,19 @@
|
||||
#! /usr/bin/bash
|
||||
#Datei: family_case.sh
|
||||
#Datei: teil23/family_case.sh
|
||||
|
||||
|
||||
|
||||
case ${1} in
|
||||
'Homer'|'Marge'|'Bart'|'Lisa')
|
||||
'Homer'|'Marge'|'Bart'|'Lisa') # Familie Simpson
|
||||
echo "Familie Simpson"
|
||||
;;
|
||||
'Ned'|'Maude'|'Todd'|'Rod')
|
||||
'Ned'|'Maude'|'Todd'|'Rod') # Familie Flanders
|
||||
echo "Familie Flanders"
|
||||
;;
|
||||
'Clancy'|'Sarah'|'Ralph')
|
||||
'Clancy'|'Sarah'|'Ralph') # Familie Wiggum
|
||||
echo "Familie Wiggum"
|
||||
;;
|
||||
*)
|
||||
*) # default
|
||||
echo "unbekannte Familie"
|
||||
;;
|
||||
esac
|
||||
|
@@ -8,5 +8,5 @@ elif [[ "${1}" == "Ned" || "${1}" == "Maude" || "${1}" == "Todd" || "${1}" == "R
|
||||
elif [[ "${1}" == "Clancy" || "${1}" == "Sarah" || "${1}" == "Ralph" ]]; then
|
||||
echo "Familie Wiggum"
|
||||
else
|
||||
echo "unbekante Familie"
|
||||
echo "unbekannte Familie"
|
||||
fi
|
||||
|
1
teil24/.gitignore
vendored
1
teil24/.gitignore
vendored
@@ -1 +1,2 @@
|
||||
*.bak
|
||||
|
||||
|
@@ -1,70 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
display_help() {
|
||||
echo "Usage: ${0} [options]"
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -v, --verbose Enable verbose mode"
|
||||
echo " -f, --file <file> Specify a file"
|
||||
echo " -n, --number <num> Specify a number (default: 42)"
|
||||
}
|
||||
|
||||
# Universelle Parameterparser-Funktion
|
||||
parse_args() {
|
||||
POSITIONAL=()
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-h|--help)
|
||||
display_help "$@"
|
||||
exit 0
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
-f|--file)
|
||||
if [[ -z "$2" || "$2" == -* ]]; then
|
||||
echo "Error: --file requires a non-empty argument."
|
||||
exit 1
|
||||
fi
|
||||
FILE="$2"
|
||||
shift 2
|
||||
;;
|
||||
-n|--number)
|
||||
if [[ -z "$2" || "$2" == -* ]]; then
|
||||
echo "Error: --number requires a non-empty argument."
|
||||
exit 1
|
||||
fi
|
||||
NUMBER="$2"
|
||||
shift 2
|
||||
;;
|
||||
--) # Explicit end of options
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # Unknown option
|
||||
echo "Error: Unknown option $1"
|
||||
exit 1
|
||||
;;
|
||||
*) # Positional argument
|
||||
POSITIONAL+=("$1")
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
set -- "${POSITIONAL[@]}" # Restore positional parameters
|
||||
|
||||
# Defaults
|
||||
VERBOSE="${VERBOSE:-false}"
|
||||
NUMBER="${NUMBER:-42}"
|
||||
}
|
||||
|
||||
# Aufruf der Funktion mit allen Skriptargumenten
|
||||
parse_args "$@"
|
||||
|
||||
# Beispielnutzung
|
||||
echo "Verbose mode: $VERBOSE"
|
||||
echo "File: ${FILE:-<not set>}"
|
||||
echo "Number: $NUMBER"
|
||||
echo "Positional arguments: $@"
|
||||
|
Reference in New Issue
Block a user