[CentOS-de] Mein erstes Bash-Bginfo-Skript

Wolfgang centos at arcor.de
Mo Mär 28 12:54:39 EDT 2011


Hallo Kai,

vielen Dank für den Hinweis.
Bevor ich falsch verstanden werde:
Jeder darf alles, ohne Genehmigung mit die Skript/Programm
anstellen.
Also: free software

MfG
Wolfgang

Programm-Update:
/usr/local/bin/bginfo.sh
#!/bin/sh
# Program is: free software
# Ver 2
# Verwendung auf eigene Gefahr !
# Anfängerprogrammierung !!!

[ -f /usr/bin/convert ] || exit 0
if [ $UID == "0" ]; then
    [ -f /usr/local/bin/$0 ] || cp $0 /usr/local/bin/
    [ -x /usr/local/bin/$0 ] || chmod 555 /usr/local/bin/$0
if [ ! -f /etc/skel/.config/autostart/bginfo.sh.desktop ]; then
mkdir -p /etc/skel/.config/autostart/
cat> /etc/skel/.config/autostart/bginfo.sh.desktop<<eof_bgi
[Desktop Entry]
Name=Namenlos
Encoding=UTF-8
Version=1.0
Exec=/usr/local/bin/bginfo.sh
X-GNOME-Autostart-enabled=true
eof_bgi
chmod 555 /etc/skel/.config/autostart/bginfo.sh.desktop
chmod 555 /usr/local/bin/bginfo.sh
fi
else
if [ ! -f ~/.config/autostart/bginfo.sh.desktop ]; then
cat> ~/.config/autostart/bginfo.sh.desktop<<eof_bgi
[Desktop Entry]
Name=Namenlos
Encoding=UTF-8
Version=1.0
Exec=/usr/local/bin/bginfo.sh
X-GNOME-Autostart-enabled=true
eof_bgi
chmod 555 ~/.config/autostart/bginfo.sh.desktop
fi
fi
IP=`/sbin/ifconfig eth0 | fgrep inet | cut -d':' -f2 | cut -d' ' -f1`
MAC=`/sbin/ifconfig eth0 | fgrep Hardware | awk '{print $6}'`
dat=`date +%d.%m_%H:%M`

echo -e "Host: $HOSTNAME\nIP:     $IP\nMAC: $MAC\nDate: $dat
\n">/dev/shm/systemdaten

convert -background black -fill yellow
-font /usr/share/fonts/bitstream-vera/Vera.ttf -pointsize 16
label:@/dev/shm/systemdaten /dev/shm/bginfo.gif

BILD=`gconftool-2 --get /desktop/gnome/background/picture_filename`

[ -x "$BILD" ] || BILD=/usr/share/backgrounds/tiles/blue_type.png

convert $BILD -resize 1400x1050 /dev/shm/bild22.png

composite -compose atop -gravity
SouthEast /dev/shm/bginfo.gif /dev/shm/bild22.png /dev/shm/bginfo.png

gconftool-2 --set
--type=string /desktop/gnome/background/picture_options stretched
#gconftool-2 --set
--type=string /desktop/gnome/background/picture_filename helpcall
gconftool-2 --set
--type=string /desktop/gnome/background/picture_filename /dev/shm/bginfo.png