#!/bin/sh

# include SmartClient hardware helper functions
. /etc/smartclient/sc_hardware
test -r /usr/lib/smartclient/sc_hardware.sh && . /usr/lib/smartclient/sc_hardware.sh

LID_STATE_FILE=/proc/acpi/button/lid/LID/state

if [ isLifebootC1320 -a -r $LID_STATE_FILE ]; then 
    o=$(cat $LID_STATE_FILE)
    set $o
    lid=$2
    echo $lid
    #
    #
    #
    if [ "$SC_HARDWARE_X_LINK_LID_STATUS" == "yes" ]; then
        cd /etc/X11
        if [ "$lid" == "open" ]; then
            ln -sf xorg.conf.clone xorg.conf
        elif [ "$lid" == "closed" ]; then
            ln -sf xorg.conf.extonly xorg.conf
        fi
    fi
fi

echo "sc_checklid: $lid" >>/tmp/sc_checklid.log
