Ajout ACPID
authorgobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Sun, 8 May 2011 03:44:30 +0000 (03:44 +0000)
committergobo72 <gobo72@364a67c3-989e-7be9-548d-dae8560ea662>
Sun, 8 May 2011 03:44:30 +0000 (03:44 +0000)
config/packages-list
stage2/bootscripts/acpid [new file with mode: 0755]
stage2/hv-install-2
stage2/misc/hvs2ram [new file with mode: 0755]
stage2/packages-update
stage2/pkg/acpid [new file with mode: 0644]

index 7dcd95d..ff97787 100644 (file)
@@ -4,6 +4,7 @@
 # as well the corresponding patches, if needed.
 
 ABIWORD="abiword-2.8.6"
+ACPID="acpid-2.0.9"
 AGG="agg-2.5"
 ALSA_LIB="alsa-lib-1.0.21"
 ALSA_PLUGINS="alsa-plugins-1.0.21"
diff --git a/stage2/bootscripts/acpid b/stage2/bootscripts/acpid
new file mode 100755 (executable)
index 0000000..362d2fe
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# acpid
+
+# Source functions library
+source /etc/rc.d/init.d/functions
+
+DAEMON=acpid
+DAEMON_DESC="ACPI"
+DAEMON_OPTS="--netlink --logevents"
+
+log_script_name "$0 $*"
+
+case "$1" in
+    start)
+       cmd_run_log_box_warn "${DAEMON_DESC} daemon start" loadproc /usr/sbin/${DAEMON} ${DAEMON_OPTS}
+       ;;
+
+    stop)
+       cmd_run_log_box_warn "${DAEMON_DESC} daemon stop" killproc ${DAEMON}
+        ;;
+
+    status)
+        statusproc ${DAEMON}
+        ;;
+
+    restart)
+        $0 stop
+        sleep 1
+        $0 start
+        ;;
+
+    *)
+       echo "Usage: $0 {restart|start|status|stop}"
+       exit ${EXIT_CODE_FAILURE}
+       ;;
+esac
+
+exit $?
index 1a78e4c..918bc76 100755 (executable)
@@ -48,6 +48,7 @@ if [ -n "${WIFI_SUPPORT}" ]; then
 fi
 
 ipkg ${NANO}
+ipkg -m noac ${ACPID}
 
 rscr once "Installing HV-utilities" install-hv-utilities
 rscr once "Installing bootscripts"  install-bootscripts
diff --git a/stage2/misc/hvs2ram b/stage2/misc/hvs2ram
new file mode 100755 (executable)
index 0000000..8b68703
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# discover video card's ID
+ID=`lspci | grep VGA | awk '{ print $1 }' | sed -e 's@0000:@@' -e 's@:@/@'`
+
+# securely create a temporary file
+TMP_FILE=`mktemp /var/tmp/video_state.XXXXXX`
+trap 'rm -f $TMP_FILE' 0 1 15
+
+# write all unwritten data (just in case)
+sync
+
+# dump current data from the video card to the
+# temporary file
+cat /proc/bus/pci/$ID > $TMP_FILE
+
+# Stopping network.
+# Sony VAIO PCG-Z505RX and PCMCIA Linksys wifi card
+/etc/rc.d/init.d/network stop
+
+echo "Entering suspend mode"
+
+# suspend
+echo -n mem > /sys/power/state
+
+echo "Resuming"
+
+# restore video card data from the temporary file
+# on resume
+cat $TMP_FILE > /proc/bus/pci/$ID
+
+/etc/rc.d/init.d/network start
+
+# remove temporary file
+rm -f $TMP_FILE
index 0ef7037..06a1f9b 100755 (executable)
@@ -87,5 +87,6 @@ fpkg ${UDEV_CONFIG} "http://www.linuxfromscratch.org/lfs/downloads/development"
 fpkg -e "tar.gz" ${GRUB} "ftp://alpha.gnu.org/gnu/grub"
 fpkg -e "tar.gz" ${DHCP} "ftp://ftp.isc.org/isc/dhcp/dhcp-3.0-history"
 
-exit $?
+fpkg -e "tar.gz" ${ACPID} "http://www.tedfelix.com/linux"
 
+exit $?
diff --git a/stage2/pkg/acpid b/stage2/pkg/acpid
new file mode 100644 (file)
index 0000000..8eabe5a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+hvbuild_post()
+{
+    install -d -m755 /etc/acpi/events
+
+    cat > /etc/acpi/events/s2ram << EOF
+# When a button/power event is received, the hvs2ram script is run.
+
+event=button/power
+action=/usr/local/bin/hvs2ram
+EOF
+
+    install -m755 ${SCRDIR}/misc/hvs2ram /usr/local/bin
+
+    install -v -m740 ${SCRDIR}/bootscripts/acpid /etc/rc.d/init.d
+    bootscript_add_rcsysinit acpid 65 90
+}