mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
Add alarm/fake-hwclock
This commit is contained in:
parent
51e439c53b
commit
1c5fb136c5
3 changed files with 63 additions and 0 deletions
23
alarm/fake-hwclock/PKGBUILD
Normal file
23
alarm/fake-hwclock/PKGBUILD
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Maintainer: Oleg Rakhmanov <orakhmanov [at] gmail [dot] com>
|
||||||
|
#
|
||||||
|
# Reworked Alexander Manning's rc.d script for systemd
|
||||||
|
# Reference: http://archplusplus.co.uk/post/31401843803/fake-hwclock-for-arch-linux-arm-on-raspberry-pi
|
||||||
|
|
||||||
|
pkgname=fake-hwclock
|
||||||
|
pkgver=0.1
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Saves time on shutdown and restores it on boot from a file"
|
||||||
|
arch=('arm')
|
||||||
|
license=('GPL')
|
||||||
|
source=('savesettime.sh'
|
||||||
|
'fake-hwclock.service')
|
||||||
|
|
||||||
|
md5sums=('8264f56630b0ed3299b51a43f3854285'
|
||||||
|
'555ce36333857e6ee56c98daa7df2f5f')
|
||||||
|
|
||||||
|
package() {
|
||||||
|
mkdir -p "${pkgdir}/usr/lib/systemd/"{scripts,system}
|
||||||
|
|
||||||
|
cp "${srcdir}/savesettime.sh" "${pkgdir}/usr/lib/systemd/scripts/"
|
||||||
|
cp "${srcdir}/fake-hwclock.service" "${pkgdir}/usr/lib/systemd/system/"
|
||||||
|
}
|
13
alarm/fake-hwclock/fake-hwclock.service
Normal file
13
alarm/fake-hwclock/fake-hwclock.service
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Sets time to what it was at last shutdown.
|
||||||
|
After=sysinit.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/lib/systemd/scripts/savesettime.sh set
|
||||||
|
RemainAfterExit=true
|
||||||
|
ExecStop=/usr/lib/systemd/scripts/savesettime.sh save
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sysinit.target
|
||||||
|
|
27
alarm/fake-hwclock/savesettime.sh
Executable file
27
alarm/fake-hwclock/savesettime.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MYSELF=$0
|
||||||
|
|
||||||
|
setclock() {
|
||||||
|
echo "Setting hardware clock \n"
|
||||||
|
MYTIME=$(date -r $MYSELF '+%Y-%m-%d %r')
|
||||||
|
date --set="$MYTIME" &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
saveclock() {
|
||||||
|
echo "Saving current time \n"
|
||||||
|
touch $MYSELF &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
set)
|
||||||
|
setclock
|
||||||
|
;;
|
||||||
|
save)
|
||||||
|
saveclock
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $MYSELF {set|save}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in a new issue