Friday, May 28, 2010

Made your own GDM theme

#cd ~/.gnome2/nautilus-scripts/
#wget http://ubuntusoftware.info/scripts/MakeGDM
#sudo chmod +x MakeGDM

#!/bin/sh
# GDM Login Maker Via TheeMahn
# Copyright (c) 2007 Ubuntusoftware Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
SCRIPT_VERSION=1.01
##Check for zenity
if [ ! -e "/usr/bin/zenity" ]; then
gksudo apt-get install -y --force-yes zenity
fi
FNAME="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"
file=$@
# everything after last '/'
basename=${file%.*}
ext=".so"
OUTFILE=${basename}${ext}
input=$(zenity --text "What you like to call the GDM Login screen?" --entry)
retval=$?
case $retval in
0)
GDMNAME=$input;;
1)
exit 0;;
esac
input=$(zenity --text "Author name?" --entry)
retval=$?
case $retval in
0)
AUTHOR=$input;;
1)
exit 0;;
esac
input=$(zenity --text "Description?" --entry)
retval=$?
case $retval in
0)
DESCRIPTION=$input;;
1)
exit 0;;
esac
`zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text="This will complie a GDM Login in current folder called $GDMNAME.tar.gz you can then load this file into login manager. Enjoy, TheeMahn" --title="GDM Login Maker"`;

update() {
wget -O /tmp/MakeGDM http://ubuntusoftware.info/scripts/MakeGDM >/dev/null 2>&1

#Verify it did download it
RESULTS_SIZE=`stat -c %s /tmp/MakeGDM`
if [ "$RESULTS_SIZE" = 0 ]
then
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='It is suggested to re-run the script, the server may be under a heavy load. If the message persists, please verify you have an internet connection, the server is online & try again. Please refer to UbuntuSoftware Forum for further info.' --title="UbuntuSoftware USplashMaker";
exit 0
fi
#Version check script
REMOTE_VERSION=`grep SCRIPT_VERSION /tmp/MakeGDM |head -n1 |sed 's/.*=//'`
if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then
if [[ -n $DIALOG ]]
then
dialog --yesno "Newer version of GDM Login Maker script has been found\n\nDo you wish to install it?" 0 0
DIALOG_EXIT_CODE=$?
if [[ $DIALOG_EXIT_CODE = 0 ]]
then
cp /tmp/MakeGDM ~/.gnome2/nautilus-scripts
echo "GDM Login Maker script has been updated to v $REMOTE_VERSION"
echo "Please re-run the script"
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'. It has been upgraded please re-run script.' --title="GDM Login Maker script";
exit
fi
else
cp /tmp/MakeGDM /.gnome2/nautilus-scripts
echo "Newer version detected: $REMOTE_VERSION"
zenity --window-icon=/usr/share/ultimate/ubuntu_ico.png --info --text='Newer version of script detected '$REMOTE_VERSION'. It has been upgraded please re-run script.' --title="GDM Login Maker script";
exit
fi
fi
rm /tmp/MakeGDM 2>/dev/null
}
update
PROGRESS=0
#FNAME=$@

#Resolution Subroutines
Res5(){
#cd $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
convert $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS -resize "1280X1024!" -quality 100 -strip $GDMNAME/background.jpg | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Processing @ 1280 X 1024..."
}

#Header Subroutines
Header(){
#Grab Extras
cd $GDMNAME
wget http://ubuntusoftware.info/scripts/GDM.tar.gz
tar xfv GDM.tar.gz
echo "[GdmGreeterTheme]
Greeter=GDM.xml
Name=$GDMNAME
Description=$DESCRIPTION
Author=$AUTHOR
Copyright=(c) 2007 UbuntuSoftware
Screenshot=screenshot.png">GdmGreeterTheme.desktop
convert $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS -resize "1280X1024!" -quality 100 screenshot.png | zenity --width=600 --height=100 --progress --pulsate --auto-close --title "Generating screenshot..."
cp screenshot.png selection-active.png
rm GDM.tar.gz
cd ..
}

mkdir -p $GDMNAME
Header
Res5
#Create GDM Archive
tar czf $GDMNAME.tar.gz $GDMNAME/
#Clean up
rm -R $GDMNAME
exit 0