saving uncommitted changes in /etc prior to emerge run
This commit is contained in:
29
acpi/actions/power
Executable file
29
acpi/actions/power
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $Header: /etc/acpi/actions/power Exp $
|
||||
#
|
||||
|
||||
set $*
|
||||
group=${1%/*}
|
||||
action=${1#*/}
|
||||
device=$2
|
||||
id=$3
|
||||
value=$4
|
||||
|
||||
case $group in
|
||||
(ac_adapter)
|
||||
case $value in
|
||||
*0) hprofile power.bat;;
|
||||
*1) hprofile power.adp;;
|
||||
esac
|
||||
;;
|
||||
(battery)
|
||||
case $value in
|
||||
*0|*1) hprofile power.adp;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
|
||||
#
|
||||
68
acpi/actions/powerbtn.sh
Executable file
68
acpi/actions/powerbtn.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/sh
|
||||
# /etc/acpi/powerbtn.sh
|
||||
# Taken from Debian's 2.0.4-1 diff file. This version handles KDE4.
|
||||
# Power Button event handler.
|
||||
# Checks to see if gnome or KDE are already handling the power button.
|
||||
# If not, initiates a plain shutdown.
|
||||
|
||||
# getXuser gets the X user belonging to the display in $displaynum.
|
||||
# If you want the foreground X user, use getXconsole!
|
||||
# Input:
|
||||
# displaynum - X display number
|
||||
# Output:
|
||||
# XUSER - the name of the user
|
||||
# XAUTHORITY - full pathname of the user's .Xauthority file
|
||||
getXuser() {
|
||||
user=`pinky -fw | awk '{ if ($2 == ":'$displaynum'" || $(NF) == ":'$displaynum'" ) { print $1; exit; } }'`
|
||||
if [ x"$user" = x"" ]; then
|
||||
startx=`pgrep -n startx`
|
||||
if [ x"$startx" != x"" ]; then
|
||||
user=`ps -o user --no-headers $startx`
|
||||
fi
|
||||
fi
|
||||
if [ x"$user" != x"" ]; then
|
||||
userhome=`getent passwd $user | cut -d: -f6`
|
||||
export XAUTHORITY=$userhome/.Xauthority
|
||||
else
|
||||
export XAUTHORITY=""
|
||||
fi
|
||||
export XUSER=$user
|
||||
}
|
||||
|
||||
# Gets the X display number for the active virtual terminal.
|
||||
# Output:
|
||||
# DISPLAY - the X display number
|
||||
# See getXuser()'s output.
|
||||
getXconsole() {
|
||||
console=`fgconsole`;
|
||||
displaynum=`ps t tty$console | sed -n -re 's,.*/X .*:([0-9]+).*,\1,p'`
|
||||
if [ x"$displaynum" != x"" ]; then
|
||||
export DISPLAY=":$displaynum"
|
||||
getXuser
|
||||
fi
|
||||
}
|
||||
|
||||
# Skip if we are just in the middle of resuming.
|
||||
test -f /var/lock/acpisleep && exit 0
|
||||
|
||||
# If the current X console user is running a power management daemon that
|
||||
# handles suspend/resume requests, let them handle policy.
|
||||
|
||||
getXconsole
|
||||
|
||||
# A list of power management system process names.
|
||||
PMS="gnome-power-manager kpowersave xfce4-power-manager"
|
||||
PMS="$PMS guidance-power-manager.py dalston-power-applet"
|
||||
|
||||
# If one of those is running or any of several others,
|
||||
if pidof x $PMS > /dev/null ||
|
||||
( test "$XUSER" != "" && pidof dcopserver > /dev/null && test -x /usr/bin/dcop && /usr/bin/dcop --user $XUSER kded kded loadedModules | grep -q klaptopdaemon) ||
|
||||
( test "$XUSER" != "" && test -x /usr/bin/qdbus && test -r /proc/$(pidof kded4)/environ && su - $XUSER -c "eval $(echo -n 'export '; cat /proc/$(pidof kded4)/environ |tr '\0' '\n'|grep DBUS_SESSION_BUS_ADDRESS); qdbus org.kde.kded" | grep -q powerdevil) ; then
|
||||
# Get out as the power manager that is running will take care of things.
|
||||
exit
|
||||
fi
|
||||
|
||||
# No power managment system appears to be running. Just initiate a plain
|
||||
# shutdown.
|
||||
/sbin/shutdown -h now "Power button pressed"
|
||||
|
||||
59
acpi/default.sh
Executable file
59
acpi/default.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
# /etc/acpi/default.sh
|
||||
# Default acpi script that takes an entry for all actions
|
||||
|
||||
set $*
|
||||
|
||||
group=${1%%/*}
|
||||
action=${1#*/}
|
||||
device=$2
|
||||
id=$3
|
||||
value=$4
|
||||
|
||||
log_unhandled() {
|
||||
logger "ACPI event unhandled: $*"
|
||||
}
|
||||
|
||||
case "$group" in
|
||||
button)
|
||||
case "$action" in
|
||||
power)
|
||||
/etc/acpi/actions/powerbtn.sh
|
||||
;;
|
||||
|
||||
# if your laptop doesnt turn on/off the display via hardware
|
||||
# switch and instead just generates an acpi event, you can force
|
||||
# X to turn off the display via dpms. note you will have to run
|
||||
# 'xhost +local:0' so root can access the X DISPLAY.
|
||||
#lid)
|
||||
# xset dpms force off
|
||||
# ;;
|
||||
|
||||
*) log_unhandled $* ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
ac_adapter)
|
||||
case "$value" in
|
||||
# Add code here to handle when the system is unplugged
|
||||
# (maybe change cpu scaling to powersave mode). For
|
||||
# multicore systems, make sure you set powersave mode
|
||||
# for each core!
|
||||
#*0)
|
||||
# cpufreq-set -g powersave
|
||||
# ;;
|
||||
|
||||
# Add code here to handle when the system is plugged in
|
||||
# (maybe change cpu scaling to performance mode). For
|
||||
# multicore systems, make sure you set performance mode
|
||||
# for each core!
|
||||
#*1)
|
||||
# cpufreq-set -g performance
|
||||
# ;;
|
||||
|
||||
*) log_unhandled $* ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*) log_unhandled $* ;;
|
||||
esac
|
||||
19
acpi/events/default
Normal file
19
acpi/events/default
Normal file
@@ -0,0 +1,19 @@
|
||||
# /etc/acpi/events/default
|
||||
# This is the ACPID default configuration, it takes all
|
||||
# events and passes them to /etc/acpi/default.sh for further
|
||||
# processing.
|
||||
|
||||
# event keeps a regular expression matching the event. To get
|
||||
# power events only, just use something like "event=button[ /]power.*"
|
||||
# to catch it.
|
||||
# action keeps the command to be executed after an event occurs
|
||||
# In case of the power event above, your entry may look this way:
|
||||
#event=button[ /]power.*
|
||||
#action=/sbin/init 0
|
||||
|
||||
# Optionally you can specify the placeholder %e. It will pass
|
||||
# through the whole kernel event message to the program you've
|
||||
# specified.
|
||||
|
||||
event=.*
|
||||
action=/etc/acpi/default.sh %e
|
||||
15
acpi/events/power
Executable file
15
acpi/events/power
Executable file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# $Header: /etc/acpi/actions/power Exp $
|
||||
#
|
||||
|
||||
# Take care of battery events
|
||||
event=battery.*
|
||||
action=/etc/acpi/action/power %e
|
||||
|
||||
# Take care of ac_adapter events
|
||||
event=ac_adapter.*
|
||||
action=/etc/acpi/action/power %e
|
||||
|
||||
#
|
||||
# vim:fenc=utf-8::ci:pi:sts=0:sw=4:ts=4:
|
||||
#
|
||||
Reference in New Issue
Block a user