| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Shutdown instead of sleeping if no one is logged in | 7 # Shutdown instead of sleeping if no one is logged in |
| 8 if ! test -f /var/run/state/logged-in; then | 8 if ! test -f /var/run/state/logged-in; then |
| 9 shutdown -h now | 9 shutdown -h now |
| 10 exit 0 | 10 exit 0 |
| 11 fi | 11 fi |
| 12 | 12 |
| 13 # Check whether the lid is closed before proceeding |
| 14 grep -q open /proc/acpi/button/lid/*/state |
| 15 if [ $? = 0 ]; then |
| 16 exit 0 |
| 17 fi |
| 18 |
| 13 # On lid close: | 19 # On lid close: |
| 14 # - lock the screen | 20 # - lock the screen |
| 15 export HOME=/home/chronos | 21 export HOME=/home/chronos |
| 16 /usr/bin/xscreensaver-command -l | 22 /usr/bin/xscreensaver-command -l |
| 17 | 23 |
| 18 # - suspend the cryptohome device | 24 # - suspend the cryptohome device |
| 19 #CRYPTOHOME=/dev/mapper/cryptohome | 25 #CRYPTOHOME=/dev/mapper/cryptohome |
| 20 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup suspend $CRYPTOHOME | 26 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup suspend $CRYPTOHOME |
| 21 | 27 |
| 22 # - suspend to ram | 28 # - suspend to ram |
| 23 echo -n mem > /sys/power/state | 29 echo -n mem > /sys/power/state |
| 24 | 30 |
| 25 # On lid open: | 31 # On lid open: |
| 26 # - has it such that you don't have to press a key to display lock screen | 32 # - has it such that you don't have to press a key to display lock screen |
| 27 /usr/bin/xscreensaver-command -deactivate | 33 /usr/bin/xscreensaver-command -deactivate |
| 28 | 34 |
| 29 # - resume cryptohome device | 35 # - resume cryptohome device |
| 30 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME | 36 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME |
| OLD | NEW |