PKGBUILDs/alarm/fake-hwclock/fake-hwclock.sh

28 lines
343 B
Bash
Raw Normal View History

2013-12-21 10:56:45 +00:00
#!/bin/bash
2014-01-13 15:02:37 +00:00
THISFILE=$0
2013-12-21 10:56:45 +00:00
setclock() {
echo "Setting clock."
MYTIME=$(date -r $THISFILE '+%Y-%m-%d %H:%M:%S')
2013-12-21 10:56:45 +00:00
date --set="$MYTIME" &>/dev/null
}
saveclock() {
echo "Saving current time."
2014-01-13 15:02:37 +00:00
touch $THISFILE &>/dev/null
2013-12-21 10:56:45 +00:00
}
case "$1" in
set)
setclock
;;
save)
saveclock
;;
*)
2014-01-13 15:02:37 +00:00
echo "Usage: $THISFILE {set|save}"
2013-12-21 10:56:45 +00:00
exit 1
;;
esac