Compare commits
22
Commits
1.3
..
e265d95dd9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e265d95dd9 | ||
|
|
0939c771f3 | ||
|
|
815a66d808 | ||
|
|
f7336ae3e6 | ||
|
|
e2346fa32f | ||
|
|
ff7035cd22 | ||
|
|
4bd2566b04 | ||
|
|
0d67903acf | ||
|
|
96f5040dfe | ||
|
|
a48e6bc452 | ||
|
|
e64461d64c | ||
|
|
dde357c695 | ||
|
|
c750cb4c69 | ||
|
|
1af089d106 | ||
|
|
dcaafa8604 | ||
|
|
c3f9740332 | ||
|
|
81a7c96f7f | ||
|
|
89557b8e36 | ||
|
|
5d830cbae4 | ||
|
|
fb7c410e8a | ||
|
|
e4190bae83 | ||
|
|
6545189eb0 |
@@ -20,4 +20,12 @@ Dateien des bash Tutorioals auf raspithek.de
|
|||||||
| 14 |exit Codes |
|
| 14 |exit Codes |
|
||||||
| 15 |von der Idee zum Script |
|
| 15 |von der Idee zum Script |
|
||||||
| 16 |Funktionen |
|
| 16 |Funktionen |
|
||||||
|
| 17 |Piping und Redirection |
|
||||||
|
| 18 |tee |
|
||||||
|
| 19 |alias |
|
||||||
|
| 20 |Shebang |
|
||||||
|
| 21 |sed |
|
||||||
|
| 22 |cd |
|
||||||
|
| 23 |case |
|
||||||
|
| 24 |Arrays |
|
||||||
|
|
||||||
|
|||||||
Executable
+66
@@ -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
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
read -n1 -p "Weitermachen? (j/n)" auswahl
|
||||||
|
|
||||||
|
echo "auswahl = ${auswahl}"
|
||||||
|
if [ "${auswahl}" == 'j' ];then
|
||||||
|
echo "Es geht weiter"
|
||||||
|
else
|
||||||
|
echo "Dann eben nicht"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user