# fss-0002
# FAIL: looks like this has too many static paths and other expectations that will cause this to not work
# for the time being hal is marked as failed attempt and will not be attempted again any time soon

main:
  if [[ $(grep -m 1 -o '^t_hal:[^:]*:' /etc/passwd) == "" ]] ; then adduser -l /bin/false -t target -g t_hal -n hal ; fi
  ./configure $CONF $DOCDIR --with-pci-ids=/etc/pci.ids --with-usb-ids=/etc/usb.ids  --disable-policy-kit --with-eject=/bin/eject --enable-parted --with-hal-user=hald --with-hal-group=hald --with-pid-file=/var/run/hald.pid --with-socket-dir=/home/targets/hald/sockets/ --with-dbus-sys=/home/targets/dbus/system/
  find -name Makefile -exec sed -i -e "s|/usr/include|${TC}include|g" {} ';'
  make pkgconfigdir=${TC}lib/pkgconfig/
  make pkgconfigdir=${TC}lib/pkgconfig/ install
  cp -v ${PR}no-fixed-drives.fdi /etc/hal/fdi/policy/
  cp -v ${PR}hal.conf /home/services/dbus/system/
  cp -v /lib/pkgconfig/hal{,-storage}.pc ${TC}lib/pkgconfig/
  mv -v /lib/{hald-addon-acpi,hald-addon-cpufreq,hald-addon-hid-ups,hald-addon-imac-backlight,hald-addon-input,hald-addon-macbook-backlight,hald-addon-macbookpro-backlight,hald-addon-pmu,hald-addon-storage,hald-addon-usb-csr,hald-generate-fdi-cache,hald-probe-hiddev,hald-probe-ieee1394-unit,hald-probe-input,hald-probe-net-bluetooth,hald-probe-pc-floppy,hald-probe-printer,hald-probe-serial,hald-probe-smbios,hald-probe-storage,hald-probe-video4linux,hald-probe-volume,hald-runner} /sbin/
  mv -v /lib/{hal-ipw-killswitch-linux,hal-storage-cleanup-all-mountpoints,hal-storage-cleanup-mountpoint,hal-storage-closetray,hal-storage-eject,hal-storage-mount,hal-storage-unmount,hal-system-power-pm-is-supported,hal-system-power-pmu,hal-system-setserial,hal-system-sonypic} /bin/
  chgrp e_dbus /home/services/dbus/system/hal.conf
  chmod o-rx /home/services/dbus/system/hal.conf
  chmod ugo-x /lib/libhal{,-storage}.la
  mv -v /lib/libhal{,-storage}.la ${TC}lib/
  chgrp e_hal -R /bin/lshal /bin/hal-{device,disable-polling,find-by-capability,find-by-property,get-property,is-caller-locked-out,lock,set-property,setup-keymap} /etc/hal /lib/libhal{,-storage}.so* /lib/hal
  chgrp t_hal /sbin/hald /sbin/{hald-addon-acpi,hald-addon-cpufreq,hald-addon-hid-ups,hald-addon-imac-backlight,hald-addon-input,hald-addon-macbook-backlight,hald-addon-macbookpro-backlight,hald-addon-pmu,hald-addon-storage,hald-addon-usb-csr,hald-generate-fdi-cache,hald-probe-hiddev,hald-probe-ieee1394-unit,hald-probe-input,hald-probe-net-bluetooth,hald-probe-pc-floppy,hald-probe-printer,hald-probe-serial,hald-probe-smbios,hald-probe-storage,hald-probe-video4linux,hald-probe-volume,hald-runner}
  chgrp e_hal /bin/{hal-ipw-killswitch-linux,hal-storage-cleanup-all-mountpoints,hal-storage-cleanup-mountpoint,hal-storage-closetray,hal-storage-eject,hal-storage-mount,hal-storage-unmount,hal-system-power-pm-is-supported,hal-system-power-pmu,hal-system-setserial,hal-system-sonypic}
  chmod o-rx -R /bin/lshal /bin/hal-{device,disable-polling,find-by-capability,find-by-property,get-property,is-caller-locked-out,lock,set-property,setup-keymap} /etc/hal /lib/libhal{,-storage}.so* /lib/hal
  chmod o-rx /sbin/hald /sbin/{hald-addon-acpi,hald-addon-cpufreq,hald-addon-hid-ups,hald-addon-imac-backlight,hald-addon-input,hald-addon-macbook-backlight,hald-addon-macbookpro-backlight,hald-addon-pmu,hald-addon-storage,hald-addon-usb-csr,hald-generate-fdi-cache,hald-probe-hiddev,hald-probe-ieee1394-unit,hald-probe-input,hald-probe-net-bluetooth,hald-probe-pc-floppy,hald-probe-printer,hald-probe-serial,hald-probe-smbios,hald-probe-storage,hald-probe-video4linux,hald-probe-volume,hald-runner}
  chmod o-rx /bin/{hal-ipw-killswitch-linux,hal-storage-cleanup-all-mountpoints,hal-storage-cleanup-mountpoint,hal-storage-closetray,hal-storage-eject,hal-storage-mount,hal-storage-unmount,hal-system-power-pm-is-supported,hal-system-power-pmu,hal-system-setserial,hal-system-sonypic}
  find /etc/hal /lib/hal -type d -exec chmod g+s '{}' ';'
  rm -Rf /share/locale
  tkis_handle_documentation doc standard /share/gtk-doc
  tkis_handle_documentation man standard /share/man
  rm -Rf /var/cache/hal
