Skip to content

Instantly share code, notes, and snippets.

@PhilHudson
Created December 10, 2013 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PhilHudson/7889123 to your computer and use it in GitHub Desktop.
Save PhilHudson/7889123 to your computer and use it in GitHub Desktop.
Install and configure timekpr on debian-derived GNU/Linux
#!/usr/bin/env bash
# USE AT OWN RISK. Read, understand and adapt.
# Part of my suite of new host configuration scripts
# $1: operating system, either 'linux', 'darwin', *bsd or 'cygwin'
if [ $# != 1 ]; then
echo "Usage: $0 os" 1>&2
exit 1
fi
case "$1" in
[Ll]inux)
mkdir -p "${HOME}/src"
cd "${HOME}/src"
echo 1>&2
echo Downloading, extracting, building and installing timekpr from LaunchPad 1>&2
echo 1>&2
curl -L -O 'https://launchpad.net/timekpr/trunk/0.3.2/+download/timekpr_0.3.2%7Eppa1%7Eubuntu2.tar.gz'
# Creates a dir named 'stable' WTF
tar --extract --gzip --file 'timekpr_0.3.2%7Eppa1%7Eubuntu2.tar.gz'
cd stable
# Invoke timekpr config GUI using sudo not su
sed -i 's/gksu/gksudo/' debian/timekpr.desktop
# Byte-compile timekpr executables
python ./setup.py
# Run the (partial) installer
sudo ./install.sh
# Install the manfile
sudo mkdir -p /usr/local/share/man/man8
sudo cp doc/timekpr.8 /usr/local/share/man/man8/
# Install the init.d script
sudo cp debian/timekpr.init /etc/init.d/timekpr
sudo chmod 755 /etc/init.d/timekpr
# Link runlevels to init.d script
sudo ln -s /etc/init.d/timekpr /etc/rcS.d/S20timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc0.d/K01timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc1.d/K55timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc2.d/S20timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc3.d/S55timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc4.d/S55timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc5.d/S55timekpr
sudo ln -s /etc/init.d/timekpr /etc/rc6.d/K55timekpr
# Set up pam
sudo debian/timekpr.postinst
echo
echo Check that your display manager has been configured for timekpr if
echo it is not among those handled by timekpr.postinst
echo
cd
;;
*)
echo Timekeeper only runs on GNU/Linux 1>&2
# Don't error; this script runs for all OSes
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment