fix no auto-lock on boot
This commit is contained in:
parent
fcaf355723
commit
cba3ba4b3b
16
src/xlock
16
src/xlock
|
@ -4,13 +4,17 @@ unlock_f="`mktemp --suffix=.xlock`";
|
|||
log_b="0";
|
||||
|
||||
|
||||
# lock by default
|
||||
rm "$unlock_f";
|
||||
|
||||
# automatic unlock if booted less than 2mins ago
|
||||
onboot=`echo "$(cat /proc/uptime | awk '{print $1}') > 1000;" | bc`;
|
||||
if [ "$onboot" -gt 0 ]; then
|
||||
touch "$unlock_f";
|
||||
|
||||
# returns whether the computer has just booted a few minutes ago
|
||||
booted(){
|
||||
# onboot=`echo "$(cut -d' ' -f1 /proc/uptime) > 1000;" | bc`;
|
||||
return echo "$(cut -d' ' -f1 /proc/uptime) > 1000;" | bc;
|
||||
}
|
||||
|
||||
# lock by default (if not just booted)
|
||||
if [ "$(booted)" -ne 1 ]; then
|
||||
rm "$unlock_f";
|
||||
fi;
|
||||
|
||||
while true; do
|
||||
|
|
Loading…
Reference in New Issue