Linux HOWTOs

About | Home | Search


HOWTO: hal
Description: Hardware Abstraction Layer
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# HAL
# ===
# This covers installation of PolicyKit and HAL


# PolicyKit
# =========
# PolicyKit is a prerequisite, but AFAIK, it's only available by grabbing
# it with git.  git is a tool that Linus T. came up with for Linux kernel
# development.  If you don't have git and don't want to get git, you can
# pass --disable-policy-kit to HAL's configure.

# Prerequisites:
# gawk
# grep
# sed
# pkg-config
# Glib
# D-Bus with Glib bindings
# xmlto
# PAM (if you don't have PAM, then skip PolicyKit)

cd
mkdir -p -m 0700 src
cd src
test -d ./PolicyKit && rm -r ./PolicyKit
git clone git://anongit.freedesktop.org/PolicyKit
cd PolicyKit
test $UID = 0 && chown -R root:root .
chmod -R u+w .

# Grab my modified version of the init script
( cd polkitd
  mv -f PolicyKit.in PolicyKit.in.orig
  wget http://englanders.cc/pub/linux/misc/PolicyKit.in )

./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make

# Become root to install it
su

# Create a 'polkit' user and group
getent group | egrep "^polkit:" > /dev/null || groupadd polkit
id polkit > /dev/null 2>&1 || useradd -d / -g polkit polkit

# Remove files from old versions ('make uninstall' in old source directory
# will do this too)
test -d /etc/PolicyKit && rm -r /etc/PolicyKit
( cd /usr/bin ; rm -f polkit-grant-privilege polkit-is-privileged \
 polkit-list-privileges polkit-revoke-privilege )
test -d /usr/include/libpolkit && rm -r /usr/include/libpolkit
( cd /usr/lib ; rm -f libpolkit.* libpolkit-grant.* )
find /usr/share/doc -maxdepth 1 -type d -name "PolicyKit-*" \
 -exec rm -r {} \;
test -d /usr/share/gtk-doc/html/polkit &&
 rm -r /usr/share/gtk-doc/html/polkit
rm -f /etc/dbus-1/system.d/PolicyKit.conf /etc/pam.d/policy-kit \
 /lib/security/pam_polkit_console.* /usr/lib/pkgconfig/polkit.pc \
 /usr/sbin/polkitd
ldconfig

# Install it
make install
ldconfig

# Install the init script
test ! -x /etc/rc.d/init.d/PolicyKit &&
 ( test ! -d /etc/rc.d/init.d && mkdir -p /etc/rc.d/init.d
   cp polkitd/PolicyKit /etc/rc.d/init.d/
   chmod 700 /etc/rc.d/init.d/PolicyKit
   for num in $(seq 0 6); do
     test ! -d /etc/rc.d/rc${num}.d && mkdir -p /etc/rc.d/rc${num}.d
   done
   ln -s /etc/rc.d/init.d/PolicyKit /etc/rc.d/rc3.d/S98PolicyKit
   ln -s /etc/rc.d/init.d/PolicyKit /etc/rc.d/rc4.d/S98PolicyKit
   ln -s /etc/rc.d/init.d/PolicyKit /etc/rc.d/rc5.d/S98PolicyKit
   ln -s /etc/rc.d/init.d/PolicyKit /etc/rc.d/rc0.d/K02PolicyKit
   ln -s /etc/rc.d/init.d/PolicyKit /etc/rc.d/rc6.d/K02PolicyKit )

# Start the polkitd daemon
/etc/rc.d/init.d/PolicyKit start

# Become yourself again
exit

cd
echo "PolicyKit source is in ~/src/PolicyKit" >> \
 ~/installed/PolicyKit.README


# HAL 0.5.8.1
# ===========
# If you ever want to uninstall HAL, or clean up files from an old version
# before installing a new one, skip down to the bottom for instructions

# Prerequisites:
# util-linux >= 2.12r1
# Python
# pkg-config
# expat >= 1.95.8
# libusb >= 0.0.1.10a (optional)
# D-Bus >= 0.60 (with Glib bindings)
# doxygen (if --enable-doxygen-docs is specified)
# Linux 2.6.x kernel headers (replace your kernel-headers package with
#  the ones from 'testing': this, then get a replacement package here, then put the
#  2.4 ones back)
# Linux kernel >= 2.6.17 (Slackware 11.0 includes 2.6.17.13 in extra here)
# udev >= 089
# hotplug
# docbook (Slackware's sgml-tools/linuxdoc-tools packages include this)
# SELinux
# intltool >= 0.22
# Perl
# iconv
# gettext
# Glib >= 2.6.0
# popt >= 1.10.2
# dmidecode >= 2.7
# cryptsetup-luks => 1.0.1 (optional, needs LUKS patches)
# pciutils >= 2.2.3 (optional)
# parted = 1.7.1 (optional)
# PolicyKit (unless you pass --disable-policy-kit)

cd
test -f installed/hal-0.5.8.1.tar.gz && mv installed/hal-0.5.8.1.tar.gz .
test ! -f hal-0.5.8.1.tar.gz &&
 wget http://people.freedesktop.org/~david/dist/hal-0.5.8.1.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "hal-*" -exec rm -r {} \;
tar xzvf ~/hal-0.5.8.1.tar.gz
cd hal-0.5.8.1
test $UID = 0 && chown -R root:root .
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
make

# Become root to install it
su

# Add a haldaemon user and group:
getent group | grep "^haldaemon:" > /dev/null 2>&1 || groupadd haldaemon
id haldaemon > /dev/null 2>&1 || useradd -g haldaemon -m haldaemon

# Create the directory for it to put it's pid file in:
mkdir /var/run/hald
chown haldaemon:haldaemon /var/run/hald

make install
chown -R $USER .

## Add something like this to your /etc/rc.d/rc.local to start hald and
## make sure it starts after dbus (look for rc.messagebus):
# # Start the HAL daemon
# if [ -x /usr/sbin/hald ]; then
#  /usr/sbin/hald --daemon=yes --use-syslog
# fi

# To stop hald:
kill `cat /var/run/hald/pid`

# To start hald:
/usr/sbin/hald --daemon=yes --use-syslog

# Use lshal to list some HAL info:
lshal --help

# Become yourself again
exit

cd
mkdir -p -m 0700 installed
rm -f installed/hal-*.tar.*
mv hal-0.5.8.1.tar.gz installed/


# If you ever want to uninstall HAL, this should do it:
cd
su
test -d src/hal-* && ( cd src/hal-* ; make uninstall )
test -d /etc/hal && rm -r /etc/hal
( cd /usr/bin/ ; rm -f hal-device-manager hal-find-by-capability \
 hal-find-by-property hal-device hal-get-property hal-set-property \
 lshal )
test -d /usr/include/hal && rm -r /usr/include/hal
( cd /usr/lib ; rm -f libhal.* libhal-storage.* )
( cd /usr/lib/pkgconfig ; rm -f hal.pc hal-storage.pc )
( cd /usr/libexec ; rm -f hal.hotplug hald-addon-acpi hald-addon-hid-ups \
 hald-addon-pmu hald-addon-storage hald-addon-usb-csr hald-probe-hiddev \
 hald-probe-input hald-probe-pc-floppy hald-probe-printer \
 hald-probe-serial hald-probe-smbios hald-probe-storage hald-probe-volume )
( cd /usr/sbin ; rm -f hal-luks-remove hal-luks-setup \
 hal-system-lcd-get-brightness hal-system-lcd-set-brightness \
 hal-system-power-hibernate hal-system-power-set-power-save \
 hal-system-power-suspend hald )
test -d /usr/share/hal && rm -r /usr/share/hal
find /usr/share/locale -type f -name "hal.mo" -exec rm {} \;
rm -f /etc/dbus-1/system.d/hal.conf
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "hal-*" -exec rm -r {} \;
rm -f ~/installed/hal-*.tar.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>