diff --git a/Makefile b/Makefile index 6810579..8b3039a 100644 --- a/Makefile +++ b/Makefile @@ -17,16 +17,17 @@ backlight: backlight.c Makefile gcc -DVERSION=\"$(VERSION)\" -Wall backlight.c -o backlight -lpci -static install: backlight applesmc - install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(INITDIR) \ - $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) $(DESTDIR)/lib/modprobe.d \ - $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) \ - $(DESTDIR)$(SYSCONFDIR)/sysconfig + install -d $(DESTDIR)$(BINDIR) $(DESTDIR)$(INITDIR) + install -d $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) $(DESTDIR)/lib/modprobe.d + install -d $(DESTDIR)$(SBIN) $(DESTDIR)$(SBINDIR) + install -d $(DESTDIR)$(SYSCONFDIR)/sysconfig + install -d $(DESTDIR)/lib/systemd/system install -s -m 4755 applesmc $(DESTDIR)$(BINDIR) install -s -m 4755 backlight $(DESTDIR)$(BINDIR) install -m 0755 macbook-set-input $(DESTDIR)$(BINDIR)/ - install -m 0755 macbook-tools-init $(DESTDIR)$(INITDIR)/macbook-tools - install -m 644 macbook-tools-sysconfig $(DESTDIR)$(SYSCONFDIR)/sysconfig/macbook-tools - install -m 0755 macbook-lightd $(DESTDIR)$(SBINDIR)/ + install -m 0644 applesmcd.service $(DESTDIR)/lib/systemd/system/applesmcd.service + install -m 0644 appleir.service $(DESTDIR)/lib/systemd/system/appleir.service + install -m 0755 applesmcd $(DESTDIR)$(SBINDIR)/ install -m 0644 macbook-modprobe $(DESTDIR)/lib/modprobe.d/macbook.conf clean: diff --git a/appleir.service b/appleir.service new file mode 100644 index 0000000..be97896 --- /dev/null +++ b/appleir.service @@ -0,0 +1,6 @@ +[Unit] +Description=lircd Apple IR remote daemon +ConditionPathExists=/dev/appleir + +[Service] +ExecStart=lircd -H macmini /etc/lirc/apple/lircd.conf.macmini diff --git a/macbook-lightd b/applesmcd similarity index 100% rename from macbook-lightd rename to applesmcd diff --git a/applesmcd.service b/applesmcd.service new file mode 100644 index 0000000..e739061 --- /dev/null +++ b/applesmcd.service @@ -0,0 +1,6 @@ +[Unit] +Description=MacBook keyboard backlight daemon +ConditionPathExists=/sys/devices/platform/applesmc.768 + +[Service] +ExecStart=/usr/sbin/applesmcd diff --git a/macbook-tools-init b/macbook-tools-init deleted file mode 100755 index c78cbe5..0000000 --- a/macbook-tools-init +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# -# Macbook tools initscript -# Copyright (c) 2006-2009 by Silvan Calarco -# Released under the GPL v.2 license -# -# /etc/rc.d/init.d/macbook-tools -# -# chkconfig: 345 42 58 -# description: set screen backlight level and load iSight firmware on Apple MacBooks -# processname: macbook-tools - -# Source function library. -. /etc/rc.d/init.d/functions - -[ -e /etc/sysconfig/machine ] && . /etc/sysconfig/machine - -# Check for Apple manufacturer or exit -[ "${SYSTEM_MANUFACTURER:0:5}" = "Apple" ] || { - sed -i "s|KEYMAP=it-macbook|KEYMAP=it|" /etc/vconsole.conf - exit 0 -} - -[ -f /etc/sysconfig/macbook-tools ] && . /etc/sysconfig/macbook-tools - -sed -i "s|KEYMAP=it$|KEYMAP=it-macbook|" /etc/vconsole.conf - -[ "$BACKLIGHT_LEVEL" ] || BACKLIGHT_LEVEL=190 - -RETVAL=0 - -# -# See how we were called. -# - -start() { - [ -e /sys/devices/platform/applesmc.768 ] || modprobe applesmc - - if [ "$IR_EVENT_DEVICE" ]; then - echo -n "Starting lircd for Apple IR remote: " - lircd -H macmini /etc/lirc/apple/lircd.conf.macmini - evaluate_retval - echo - fi - - #echo -n "Setting middle and right click mouse emulation: " - #echo 1 > /proc/sys/dev/mac_hid/mouse_button_emulation - #echo 125 > /proc/sys/dev/mac_hid/mouse_button2_keycode - #echo 96 > /proc/sys/dev/mac_hid/mouse_button3_keycode - #evaluate_retval - #echo - - echo -n "Loading MacBook light sensor control daemon: " - macbook-lightd &>/dev/null & - evaluate_retval - echo -} - -stop() { - echo -n "Stopping MacBook light sensor control daemon: " - killall -9 macbook-lightd - evaluate_retval - echo -} - -restart() { - stop - start -} - -case "$1" in -start) - start - ;; -restart) - restart - ;; -*) - INITNAME=`basename $0` - echo "Usage: $INITNAME {start|restart}" - exit 1 -esac - -exit $RETVAL diff --git a/macbook-tools-sysconfig b/macbook-tools-sysconfig deleted file mode 100644 index ae58dd7..0000000 --- a/macbook-tools-sysconfig +++ /dev/null @@ -1,2 +0,0 @@ -ISIGHT_FIRMWARE_FILE=/mnt/osx/System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport -IR_EVENT_DEVICE=/dev/appleir