PDA

View Full Version : Get Caffeine working in F18 (XFCE)



Hat Fedoration
17th February 2013, 06:50 PM
Hi there,

I'm new to using Fedora (XFCE) and Caffeine was one of the first programs I wanted to install. After a bit of tweaking I got it installed, and hopefully I can speed up others installation process. Apologies if this is in anyway trivial.

You will require the following dependencies for Caffeine, and wget and patch are used in the script.


dconf
gtk2
hicolor-icon-theme
kaa-metadata
python-xlib
python2-dbus
python2-gobject
python2-notify
pyxdg




#!/bin/sh
sudo yum install wget patch

wget http://launchpad.net/caffeine/2.4/2.4.1/+download/caffeine_2.4.1+419~oneiric1.tar.gz
mkdir caffeine
tar xvf caffeine_2.4.1+419~oneiric1.tar.gz --strip-components 1 -C caffeine

wget https://aur.archlinux.org/packages/ca/caffeine-bzr/caffeine-bzr.tar.gz
tar xvf caffeine-bzr.tar.gz --strip-components 1 -C caffeine

cd caffeine

# Thanks to André Ericson for the patch!
# https://bugs.launchpad.net/caffeine/+bug/892663
patch -Np1 -i ./caffeine.patch

python setup.py build
sudo python setup.py install --user

sudo gtk-update-icon-cache /usr/share/icons/hicolor/
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/

sudo chmod 744 /usr/share/caffeine/images/*
sudo chmod 744 /usr/share/caffeine/glade/*

Finally, go to Applications Menu > System > Session and Startup and select the Autostart tab and if the Caffeine entry exists make sure it reads "~/.local/bin/caffeine"

New posts are restricted so I am unable to credit the exact sources that were used, however thanks go to:
ArchLinux
Alen Siljak's IT Blog
Lucid Electric Dreams

Let me know how it works for you

Ihatewindows
18th February 2013, 10:05 PM
On all my scripts, I always put this at the beginning.


# Need root permissions
if [[ $EUID -ne 0 ]] ; then
echo "You need to have root permissions to run this script!"
exit 1
fiThat way you don't have to call sudo each time.

This would be how I would do it.

#!/bin/sh

# Need root permissions
if [[ $EUID -ne 0 ]] ; then
echo "You need to have root permissions to run this script!"
exit 1
fi

#ask user if they have all the deps
echo "Just to be sure, do you have the following dependencies?"

#yes/no
while true; do
read -p "Do you have the following installed?
dconf
gtk2
hicolor-icon-theme
kaa-metadata
python-xlib
python2-dbus
python2-gobject
python2-notify
pyxdg (Y/N)" yn
case $yn in
[Yy]* ) COMMAND; break;;
[Nn]* ) exit;;
* ) echo "Please answer Y/N, or press <CTRL>+<C> to quit.";;
esac
done


#installing wget and patch
yum install wget patch

#downloading and extracting archive(s)
wget http://launchpad.net/caffeine/2.4/2.4.1/+download/caffeine_2.4.1+419~oneiric1.tar.gz
mkdir caffeine
tar xvf caffeine_2.4.1+419~oneiric1.tar.gz --strip-components 1 -C caffeine

wget https://aur.archlinux.org/packages/ca/caffeine-bzr/caffeine-bzr.tar.gz
tar xvf caffeine-bzr.tar.gz --strip-components 1 -C caffeine

#changing to caffine dir
cd caffeine

# Thanks to André Ericson for the patch!
# https://bugs.launchpad.net/caffeine/+bug/892663
patch -Np1 -i ./caffeine.patch

#building and installing python scripts
python setup.py build
python setup.py install --user

#updating icons
gtk-update-icon-cache /usr/share/icons/hicolor/
glib-compile-schemas /usr/share/glib-2.0/schemas/

#changing permissions
chmod 744 /usr/share/caffeine/images/*
chmod 744 /usr/share/caffeine/glade/*

Hat Fedoration
19th February 2013, 05:42 PM
Thanks for the pointers, that's a much more elegant solution.