smirnoff76
October 27th, 2008, 02:52 PM
I wonder if anyone can help?
I am working on a shell script and have the first part of my script done however as part of the scrip I need it to create a file called Default to /etc/gdm/PostLogin and add the following text in:
#!/bin/sh
#
# Note that output goes into the .xsession-errors file for easy debugging
#
# Extract the wallpaper filename
WALLPAPER="`cat ~/.gconf/desktop/gnome/background/%gconf.xml | sed -n -e 'N
s/^[ \t]*<entry name="picture_filename".*\n[ \t]*<stringvalue>\(.*\)<\/stringvalue>.*$/\1/ip'`"
# Check if the wallpaper file exists. If yes - draw it, if no - use primary background color
if [ -e "$WALLPAPER" ] && [ -f "$WALLPAPER" ] ; then
xsetbg -onroot "$WALLPAPER"
else
PRIMARY_COLOR="`cat ~/.gconf/desktop/gnome/background/%gconf.xml | sed -n -e 'N
s/^[ \t]*<entry name="primary_color".*\n[ \t]*<stringvalue>\(.*\)<\/stringvalue>.*$/\1/ip'`"
xsetroot -cursor_name left_ptr -solid "$PRIMARY_COLOR"
fi
exit 0
The problem is I have no idea how to script this part of the file can anyone give any help / pointers?
The purpose of the scrip is actually based on this link http://ubuntuforums.org/showthread.php?t=753261 which is a mjor pet peeve of mine.
I am fairly new to ubuntu and the only script I have written so far is an install script for a new install of all the packages I require so I am now trying my hand at other scripting tasks (which I plan to post in the tips n tricks section once done and tested) so any help would be really appreciated!
Thanks in advance.
I am working on a shell script and have the first part of my script done however as part of the scrip I need it to create a file called Default to /etc/gdm/PostLogin and add the following text in:
#!/bin/sh
#
# Note that output goes into the .xsession-errors file for easy debugging
#
# Extract the wallpaper filename
WALLPAPER="`cat ~/.gconf/desktop/gnome/background/%gconf.xml | sed -n -e 'N
s/^[ \t]*<entry name="picture_filename".*\n[ \t]*<stringvalue>\(.*\)<\/stringvalue>.*$/\1/ip'`"
# Check if the wallpaper file exists. If yes - draw it, if no - use primary background color
if [ -e "$WALLPAPER" ] && [ -f "$WALLPAPER" ] ; then
xsetbg -onroot "$WALLPAPER"
else
PRIMARY_COLOR="`cat ~/.gconf/desktop/gnome/background/%gconf.xml | sed -n -e 'N
s/^[ \t]*<entry name="primary_color".*\n[ \t]*<stringvalue>\(.*\)<\/stringvalue>.*$/\1/ip'`"
xsetroot -cursor_name left_ptr -solid "$PRIMARY_COLOR"
fi
exit 0
The problem is I have no idea how to script this part of the file can anyone give any help / pointers?
The purpose of the scrip is actually based on this link http://ubuntuforums.org/showthread.php?t=753261 which is a mjor pet peeve of mine.
I am fairly new to ubuntu and the only script I have written so far is an install script for a new install of all the packages I require so I am now trying my hand at other scripting tasks (which I plan to post in the tips n tricks section once done and tested) so any help would be really appreciated!
Thanks in advance.