# -*- shell-script -*- # # $Id$ # Maintainer: Eric Belanger # Contributor: Christopher "nuopus" Cox # # Modified by: Adrian C. # Laptop mode tools patched to include: # + Custom auto-hibernate script # - battery doesn't report status and has no alarm support # - call it from rc.local as "/usr/sbin/battery_mode" # + Intel HDA power management # - ac97 module patched to include it # + Bluetooth module rfkill support # - default path pointed to my bluetooth device # + Hardcode display for dpms module on my single user laptop # - dpms-standby module broken due to "w" differences # + Verbose output to file logging # - logrotate script included # + LM_VERBOSE fixed, now status messages from lm-tools are logged # + Custom pm-utils hook included # + Informative optdepends added to the PKGBUILD # + Support for USB power management # - files are provided as found on debian bug tracker # - commented by default and not included in the final package pkgname=laptop-mode-tools pkgver=1.45 pkgrel=5 pkgdesc="Laptop mode is a kernel mode that allows you to extend the battery life of your laptop" arch=('i686' 'x86_64') url="http://www.samwel.tk/laptop_mode/" license=('GPL') depends=('bash' 'hdparm') optdepends=('xorg-server-utils: DPMS module needs xset.' 'ethtool: Ethernet module needs ethtool utility.' 'psmisc: configuration-file module needs killall.') backup=(etc/laptop-mode/conf.d/ac97-powersave.conf etc/laptop-mode/conf.d/auto-hibernate.conf etc/laptop-mode/conf.d/bluetooth.conf etc/laptop-mode/conf.d/configuration-file-control.conf etc/laptop-mode/conf.d/cpufreq.conf etc/laptop-mode/conf.d/dpms-standby.conf etc/laptop-mode/conf.d/ethernet.conf etc/laptop-mode/conf.d/hal-polling.conf etc/laptop-mode/conf.d/intel-sata-powermgmt.conf etc/laptop-mode/conf.d/lcd-brightness.conf etc/laptop-mode/conf.d/sched-mc-power-savings.conf etc/laptop-mode/conf.d/start-stop-programs.conf etc/laptop-mode/conf.d/terminal-blanking.conf etc/laptop-mode/conf.d/video-out.conf etc/laptop-mode/conf.d/wireless-ipw-power.conf etc/laptop-mode/conf.d/wireless-iwl-power.conf etc/laptop-mode/laptop-mode.conf etc/laptop-mode/lm-profiler.conf) source=(http://www.samwel.tk/laptop_mode/tools/downloads/${pkgname}_${pkgver}.tar.gz laptop-mode laptop-mode.logrotate 04laptop-mode-tools ac97-intel-hda.patch bluetooth-rfkill.patch usb-autosuspend usb-autosuspend.conf) md5sums=('898908df4ccaaf3615a573121439bd05' '241a0e07fc3b340b3381bcde8a74b71d' '0258cd03ee7913109e5a1b1f4471292f' '29e153c9b088c91df6b69e50d2f88110' '06cc9be9d66493080b4a60c497d012cb' '6e5d0c3086b6775382dab1fbe2d8fbf5' '95f6d2120e3326994855066258bbc821' '369f2a78412a00c9a7b6b46fd904d7b6') sha1sums=('776537b8052086163961c2c831eddf9f3cc682ad' 'e69239683c320ecc4c27060eb2ace768d06696bc' '900864b5069fda71aeba6488541a70bb10e4fc43' '95e150e0d870aff88e09a0a2ff3065c7a9993670' 'bf0ebccc9f6e2deab11f234ef47f34913c8fcba4' '1d598cd0cc8330fc0cd4b004d9a8940ebdf4c4b6' '02242b3662295a7cecf2d1c97a563cfebf433287' '14c407af674f3898d549cc8a1e0d988133eb3cfd') #laptop-mode-tools has one of the worst install scripts ever... manual here build() { cd ${srcdir}/${pkgname}_${pkgver} #state dir install -d ${pkgdir}/var/run/laptop-mode-tools/ #binaries install -d ${pkgdir}/usr/sbin/ install -m700 usr/sbin/* ${pkgdir}/usr/sbin/ || return 1 # Insert custom battery polling/auto-hibernate script # - My battery doesn't generate acpi events and has no alarm support install -m700 $startdir/battery_mode ${pkgdir}/usr/sbin/ || return 1 #config files install -d ${pkgdir}/etc/laptop-mode/conf.d install -m644 etc/laptop-mode/laptop-mode.conf ${pkgdir}/etc/laptop-mode/ || return 1 install -m600 etc/laptop-mode/lm-profiler.conf ${pkgdir}/etc/laptop-mode/ || return 1 install -m600 etc/laptop-mode/conf.d/* ${pkgdir}/etc/laptop-mode/conf.d/ || return 1 #man pages install -d ${pkgdir}/usr/share/man/man8/ install -m644 man/* ${pkgdir}/usr/share/man/man8/ || return 1 #modules # Patch ac97 module to support Intel HDA, this should be supported in future versions patch -Np1 -i ${srcdir}/ac97-intel-hda.patch || return 1 # Patch bluetooth module to support acer-wmi rfkill for Acer TravelMate 5320 patch -Np1 -i ${srcdir}/bluetooth-rfkill.patch || return 1 # Patch dpms module to hardcode the display, current auto detection is broken anyway sed -i 's|-d $DPMS_SCREEN|-d ":0.0"|' "${srcdir}/${pkgname}_${pkgver}/usr/share/laptop-mode-tools/modules/dpms-standby" || return 1 # Install modules install -d ${pkgdir}/usr/share/laptop-mode-tools/modules/ install -m700 usr/share/laptop-mode-tools/modules/* ${pkgdir}/usr/share/laptop-mode-tools/modules/ || return 1 # Add USB power management support # - This should be supported in future versions, wait for now #install -m700 ${srcdir}/usb-autosuspend ${pkgdir}/usr/share/laptop-mode-tools/modules/ || return 1 #install -m600 ${srcdir}/usb-autosuspend.conf ${pkgdir}/etc/laptop-mode/conf.d/ || return 1 #arch init script install -D -m755 ${srcdir}/laptop-mode ${pkgdir}/etc/rc.d/laptop-mode || return 1 # Change default output to a file for VERBOSE_OUTPUT sed -i 's|OUTPUT="/dev/stdout"|OUTPUT="/var/log/laptop-mode.log"|' "${pkgdir}/usr/sbin/laptop_mode" || return 1 # Fix LM_VERBOSE, by mistake values were inverted sed -i '290s|1 = 0|1 = 1|' "${pkgdir}/usr/sbin/laptop_mode" || return 1 sed -i '293s|1 = 1|1 = 0|' "${pkgdir}/usr/sbin/laptop_mode" || return 1 # Insert a custom logrotate script install -d ${pkgdir}/etc/logrotate.d/ install -D -m644 ${srcdir}/laptop-mode.logrotate ${pkgdir}/etc/logrotate.d/laptop-mode || return 1 # Insert a custom pm-utils hook # - included with the original PKGBUILD were pbbuttonsd/pmud files, check below install -d ${pkgdir}/etc/pm/sleep.d/ install -D -m755 ${srcdir}/04laptop-mode-tools ${pkgdir}/etc/pm/sleep.d/04laptop-mode-tools || return 1 #acpi support # I take care of this my self # - acpid's handler.sh AC|ADP events call "/usr/sbin/laptop_mode auto" #install -d ${pkgdir}/etc/acpi/{actions,events} #install -m700 etc/acpi/actions/* ${pkgdir}/etc/acpi/actions || return 1 #install -m600 etc/acpi/events/* ${pkgdir}/etc/acpi/events || return 1 #apm support - TODO still needed? #install -d ${pkgdir}/etc/apm/event.d/ #install -m700 etc/apm/event.d/* ${pkgdir}/etc/apm/event.d || return 1 #pm-utils support # - This is not pm-utils support but pbbuttonsd/pmud support and I don't need it #install -d ${pkgdir}/etc/power/{event.d,scripts.d} #install -m700 etc/power/scripts.d/* ${pkgdir}/etc/power/scripts.d || return 1 #ln -fs /etc/power/scripts.d/laptop-mode ${pkgdir}/etc/power/event.d || return 1 }