| --- laptop-mode-tools-1.59//usr/sbin/laptop_mode 2012-06-15 17:33:49.052591220 -0700 |
| +++ laptop-mode-tools-1.59//usr/sbin/laptop_mode 2012-06-20 11:02:11.248576131 -0700 |
| @@ -37,6 +37,12 @@ |
| # as well, so don't change the format! |
| LMTVERSION=1.59 |
| |
| +if [ -f /var/run/laptop-mode-tools/laptop-mode.conf ]; then |
| + LAPTOP_MODE_CONFIG_DIR=/var/run/laptop-mode-tools |
| +else |
| + LAPTOP_MODE_CONFIG_DIR=/etc/laptop-mode |
| +fi |
| + |
| # This script is loaded from multiple scripts to set the config defaults |
| # and to read the configuration on top of those. Only when the command is |
| # recognized does this script do anything else. |
| @@ -229,26 +235,32 @@ |
| # Source config. Some config settings have been moved from the main config file |
| # to modular configuration files, and to support existing laptop-mode.conf |
| # files from earlier versions, we source the modular configuration files FIRST. |
| - if [ -d /etc/laptop-mode/conf.d ] ; then |
| - for CONF in /etc/laptop-mode/conf.d/*.conf /etc/laptop-mode/conf.d/board-specific/*.conf; do |
| - if [ -r "$CONF" ] ; then |
| - . "$CONF" |
| - #Handle individual module debug settings |
| - if [ "$DEBUG" -eq 1 ]; then |
| - export $(basename $CONF | cut -d . -f1 | tr "[:lower:]" "[:upper:]" | sed 's/-/_/g')_DEBUG=1 |
| - log "VERBOSE" "Enabling debug mode for module $CONF" |
| - fi |
| - DEBUG=0 |
| - else |
| - log "MSG" "Warning: Configuration file $CONF is not readable, skipping." |
| + if [ -d ${LAPTOP_MODE_CONFIG_DIR}/conf.d ] ; then |
| + for subdir in conf.d conf.d/board-specific; do |
| + if [ ! -d ${LAPTOP_MODE_CONFIG_DIR}/$subdir ]; then |
| + continue |
| fi |
| + for CONF in ${LAPTOP_MODE_CONFIG_DIR}/$subdir/*.conf; do |
| + if [ -r "$CONF" ] ; then |
| + . "$CONF" |
| + #Handle individual module debug settings |
| + if [ "$DEBUG" -eq 1 ]; then |
| + export $(basename $CONF | cut -d . -f1 | tr "[:lower:]" "[:upper:]" | \ |
| + sed 's/-/_/g')_DEBUG=1 |
| + log "VERBOSE" "Enabling debug mode for module $CONF" |
| + fi |
| + DEBUG=0 |
| + else |
| + log "MSG" "Warning: Configuration file $CONF is not readable, skipping." |
| + fi |
| + done |
| done |
| fi |
| - if [ -r /etc/laptop-mode/laptop-mode.conf ] ; then |
| - . /etc/laptop-mode/laptop-mode.conf |
| + if [ -r ${LAPTOP_MODE_CONFIG_DIR}/laptop-mode.conf ] ; then |
| + . ${LAPTOP_MODE_CONFIG_DIR}/laptop-mode.conf |
| else |
| - log "ERR" "$0: Configuration file /etc/laptop-mode/laptop-mode.conf not present or not readable." |
| - exit 1 |
| + log "ERR" "$0: Configuration file ${LAPTOP_MODE_CONFIG_DIR}/laptop-mode.conf not present or not readable."; |
| + exit 1; |
| fi |
| |
| if [ x$ENABLE_LAPTOP_MODE_TOOLS = x0 ]; then |
| @@ -1049,7 +1061,7 @@ |
| |
| # Note that the /usr/local/lib path is deprecated. |
| export FORCE STATE ON_AC ACTIVATE ACTIVATE_WITH_POSSIBLE_DATA_LOSS KLEVEL KMINOR WAS_ACTIVE LM_VERBOSE DEVICES |
| - for SCRIPT in /usr/share/laptop-mode-tools/modules/* /usr/local/lib/laptop-mode-tools/modules/* /usr/local/share/laptop-mode-tools/modules/* /etc/laptop-mode/modules/* ; do |
| + for SCRIPT in /usr/share/laptop-mode-tools/modules/* /usr/local/lib/laptop-mode-tools/modules/* /usr/local/share/laptop-mode-tools/modules/* ${LAPTOP_MODE_CONFIG_DIR}/modules/* ; do |
| # Skip failed globs |
| [ -f "$SCRIPT" ] || continue |
| |