saving uncommitted changes in /etc prior to emerge run

This commit is contained in:
2015-02-27 01:58:55 +01:00
committed by root
commit b3cea8d893
2385 changed files with 507432 additions and 0 deletions

View File

@@ -0,0 +1 @@
adp

View File

@@ -0,0 +1,5 @@
adp
bat
dyn
med
quiet

View File

@@ -0,0 +1,17 @@
#
# power/ptest
#
local state="$(echo /sys/class/power_supply/A*)"
if test -n "$state" -a -r "$state"; then
state=$(< "$state")
case "$state" in
(1) echo "adp";;
(0) echo "bat";;
esac
fi
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#

View File

@@ -0,0 +1,4 @@
This is a sample power profile setup. It's different from other profiles in
that there are no configuration files to be switched. All the magic happens
in the start scripts, found in the scripts/ directory. ptest is still used to
determine the current profile of course.

View File

@@ -0,0 +1 @@
AC

View File

@@ -0,0 +1,4 @@
AC
Medium
Battery
Dynamic

22
hprofile/profiles/power/ptest Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# This script should echo only the name of the profile that should be used
# It should assume it is called before any other scripts. In particular, it
# cannot rely on environment variables set in /etc/profile or elsewhere. The
# script may assume it will be run as root.
profile="AC"
if test -f /proc/acpi/ac_adapter/AC0/state ; then
status="$(cat /proc/acpi/ac_adapter/AC0/state)"
case "${status}" in
*on-line)
profile="AC"
;;
*off-line)
profile="Battery"
;;
esac
fi
echo "${profile}"

View File

@@ -0,0 +1,4 @@
#!/bin/bash
speedfreq -p performance
echo "15" > /proc/acpi/asus/brn

View File

@@ -0,0 +1,4 @@
#!/bin/bash
speedfreq -p powersave
echo "6" > /proc/acpi/asus/brn

View File

@@ -0,0 +1,4 @@
#!/bin/bash
speedfreq -p dynamic

View File

@@ -0,0 +1,4 @@
#!/bin/bash
speedfreq -p 1000
echo "11" > /proc/acpi/asus/brn

View File

@@ -0,0 +1,15 @@
#
# power/scripts/adp.start
#
start "powersave" "auto" "auto" "min_power" "1" "0" "1000" "default"
start-profile "disk" "adp"
if [[ "$DISPLAY" ]]; then
xbacklight -set 30
xset dpms 300 400 600
fi
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#

View File

@@ -0,0 +1,16 @@
#
# power/scripts/bat.start
#
#
start "powersave" "auto" "auto" "min_power" "1" "0" "1500" "powersave"
start-profile "disk" "bat"
if [[ "$DISPLAY" ]]; then
xbacklight -set 30
xset dpms 300 400 600
fi
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#

View File

@@ -0,0 +1,15 @@
#
# power/scripts/dyn.start
#
start "performance" "on" "on" "mix_power" "0" "1" "500" "performance"
start-profile "disk" "dyn"
if [[ "$DISPLAY" ]]; then
xbacklight -set 30
xset dpms 300 400 600
fi
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#

View File

@@ -0,0 +1,15 @@
#
# power/scripts/med.start
#
start "performance" "on" "on" "min_power" "0" "1" "500" "performance"
start-profile "disk" "adp"
if [[ "$DISPLAY" ]]; then
xbacklight -set 30
xset dpms 300 400 600
fi
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#

View File

@@ -0,0 +1,15 @@
#
# power/scripts/quiet.start
#
start "powersave" "auto" "auto" "min_power" "1" "0" "2500" "powersave"
start-profile "disk" "quiet"
if [[ "$DISPLAY" ]]; then
xbacklight -set 30
xset dpms 300 400 600
fi
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#

View File

@@ -0,0 +1,67 @@
#
# $Header: profiles/power/start Exp $
#
local cpu pci usb hda nmi vmw aspm scsi
declare -A opt
opt=(
[cpu]=${1:-powersave}
[pci]=${2:-auto}
[usb]=${3:-auto}
[hda]=${5:-1}
[nmi]=${6:-0}
[vmw]=${7:-1000}
[aspm]=${8:-default}
[scsi]=${4:-min_power}
)
for cpu in /sys/devices/system/cpu/cpu[0-9]*; do
echo ${opt[cpu]} >$cpu/cpufreq/scaling_governor
done
[ -e /sys/module/pcie_aspm/parameters/policy ] &&
echo ${opt[aspm]} >/sys/module/pcie_aspm/parameters/policy >/dev/null 2>&1
for scsi in /sys/class/scsi_host/host[0-9]*; do
[ -e $scsi/link_power_management_policy ] || continue
case "$(< $scsi/proc_name)" in
(ahci|usb-storage)
echo ${opt[scsi]} >$scsi/link_power_management_policy;;
(*) ;;
esac
done
# set usb host to auto powersave
for usb in /sys/bus/usb/devices/{usb[0-9],[0-9]-[0-9]}; do
echo ${opt[usb]} >$usb/power/control
done
# pci power control
for pci in /sys/bus/pci/devices/0000:0*; do
echo ${opt[pci]} >$pci/power/control
done
# snd-hda-intel powersave
[ -e /sys/module/snd_hda_intel/parameters/power_save ] &&
echo ${opt[hda]} >/sys/module/snd_hda_intel/parameters/power_save
# turn off NMI watchdog
[ -e /proc/sys/kernel/nmi_watchdog ] &&
echo ${opt[nmi]} >/proc/sys/kernel/nmi_watchdog
# VM write back timeout
[ -e /proc/sys/vm/dirty_writeback_centisecs ] &&
echo ${opt[vmw]} >/proc/sys/vm/dirty_writeback_centisecs
unset opt
[[ "${HPROFILE[power]}" == "network" ]] || return
local iface running
for iface in $(ifconfig | sed -nre 's/(^[ew].*[0-9]{1}):.*/\1/p'); do
running="$(ifconfig $iface | sed -nre /$iface/'s/.*(RUNNING).*/\1/p')"
[[ "$running" ]] || ifconfig "$iface" down
done
#
# vim:fenc=utf-8:ft=sh:ci:pi:sts=0:sw=4:ts=4:
#