mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
edaec43cea
* PKGBUILD: modified to install directories with correct permissions (in case of a restrictive umask). * PKGBUILD: change arch to any as this is arch-indep. * fake-hwclock.sh: add 'load' command that sets the system time only if the current time is older; make 'set' an deprecated alias of it. * Add fake-hwclock-save timer and service that saves the time every 15 minutes. * install: suggest to enable timer unit instead of cron.
37 lines
581 B
Bash
Executable file
37 lines
581 B
Bash
Executable file
#!/bin/bash
|
|
|
|
THISFILE=$0
|
|
STATEFILE=$0
|
|
|
|
loadclock() {
|
|
local savedtime=$(stat -c %Y "$STATEFILE")
|
|
if [ $(date +%s) -lt $savedtime ]; then
|
|
echo "Restoring saved system time"
|
|
date -s @$savedtime
|
|
else
|
|
echo "Not restoring old system time"
|
|
fi
|
|
}
|
|
|
|
saveclock() {
|
|
echo "Saving current time."
|
|
touch "$STATEFILE"
|
|
}
|
|
|
|
case "$1" in
|
|
load)
|
|
loadclock
|
|
;;
|
|
set)
|
|
echo "'set' is deprecated, use 'load' instead."
|
|
echo "Consider using the systemd timer unit fake-hwclock-save.timer"
|
|
loadclock
|
|
;;
|
|
save)
|
|
saveclock
|
|
;;
|
|
*)
|
|
echo "Usage: $THISFILE {load|save}"
|
|
exit 1
|
|
;;
|
|
esac
|