Sa 16. Aug 21:04:32 CEST 2025

This commit is contained in:
alf
2025-08-16 21:04:32 +02:00
parent e03c823db3
commit f678fc3f8f

View File

@ -1,9 +1,12 @@
source /root/logger.sh source $HOME/Gitea/logger/logger.sh
log_init "/home/alf/log.txt"
log_start log_start
log_info "Starte Lock/Unlock Bashrc" log_info "Starte Lock/Unlock Bashrc"
ende=nein ende=nein
BASHRC=$HOME/.bashrc
ISTSUDO="nein" # nur für root, sonst "nein"
while [ $ende = "nein" ]; do while [ $ende = "nein" ]; do
echo echo
@ -21,35 +24,60 @@ read -p "Deine Wahl: 1/2/3/0 " wwahl
if [ $wwahl = 1 ] if [ $wwahl = 1 ]
then then
sudo chattr +i .bashrc if [ $ISTSUDO = "ja" ]
log_info "Gesichert! $?" then
sudo chattr +i $BASHRC
log_info "Gesichert! (sudo) $?"
else
setfacl -m u::r--,g::r--,o::r-- $BASHRC
log_info "Gesichert! (ACL) $?"
fi
fi fi
if [ $wwahl = 2 ] if [ $wwahl = 2 ]
then then
sudo chattr -i .bashrc if [ $ISTSUDO = "ja" ]
log_info "Geöffnet! $?" then
log_info "öffne Datei..." sudo chattr -i $BASHRC
nano .bashrc log_info "Geöffnet! (sudo) $?"
log_info "Datei geschlossen $?" log_info "öffne Datei..."
sudo chattr +i .bashrc nano $BASHRC
log_info "Gesichert $?" log_info "Datei geschlossen $?"
source /home/oberkoetter/.bashrc sudo chattr +i $BASHRC
log_info "Gesichert (sudo) $?"
else
setfacl -m u::rwx,g::r--,o::r-- $BASHRC
log_info "Geöffnet! (ACL) $?"
log_info "öffne Datei..."
nano $BASHRC
log_info "Datei geschlossen $?"
setfacl -m u::r--,g::r--,o::r-- $BASHRC
log_info "Gesichert (ACL) $?"
fi
source $BASHRC
echo "Änderungen sind nach dem Neustart der" echo "Änderungen sind nach dem Neustart der"
echo "Konsole wirksam" echo "Konsole wirksam"
fi fi
if [ $wwahl = 22 ] if [ $wwahl = 22 ]
then then
sudo chattr -i .bashrc if [ $ISTSUDO = "ja" ]
log_info "Geöffnet! $?" then
exit 0 sudo chattr -i $BASHRC
log_info "Geöffnet! (sudo) $?"
exit 0
else
setfacl -m u::rwx,g::r--,o::r-- $BASHRC
log_info "Geöffnet! (ACL) $?"
exit 0
fi
fi fi
if [ $wwahl = "3" ] if [ $wwahl = "3" ]
then then
log_info "Lese neu…" log_info "Lese neu…"
. .bashrc . $BASHRC
log_info "Err: $?" log_info "Err: $?"
fi fi