Github messages for voidlinux
 help / color / mirror / Atom feed
From: voidlinux-github@inbox.vuxu.org
To: ml@inbox.vuxu.org
Subject: [PR PATCH] New package: fake-hwclock-0.11
Date: Thu, 03 Oct 2019 05:08:41 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-14985@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1311 bytes --]

There is a new pull request by dreamtigers against master on the void-packages repository

https://github.com/dreamtigers/void-packages master
https://github.com/void-linux/void-packages/pull/14985

New package: fake-hwclock-0.11
Save/restore system clock on machines without working RTC hardware.

Some machines don't have a working Real Time Clock (RTC) unit, or no driver for
said hardware. `fake-hwclock` is a simple set of scripts to save the kernel's
current clock periodically (including at shutdown) and restore it at boot so
that the system clock keeps at least close to the real time. This will stop
some of the problems that may be caused by a system believing it has travelled
in time back to 1970, such as needing to perform filesystem checks at every
boot.

This is originally a Debian package, and as Debian uses `systemd` as it's init
and service manager, most of the init and service instructions were useless for
Void.

I took the liberty of adapting the scripts and patching the manpage with the
instructions to make `fake-hwclock` execute on boot and shutdown in Void Linux
(or at least distributions that use `runit` as init), all while being as
faithful to upstream as possible.


A patch file from https://github.com/void-linux/void-packages/pull/14985.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-14985.patch --]
[-- Type: text/x-diff, Size: 4631 bytes --]

From 281b99979ad7533e956465d4e36e5de2e38d0dff Mon Sep 17 00:00:00 2001
From: Ivan Gonzalez Polanco <ivan14polanco@gmail.com>
Date: Wed, 2 Oct 2019 16:37:03 -0400
Subject: [PATCH] New package: fake-hwclock-0.11

---
 srcpkgs/fake-hwclock/files/rc.local        |  4 ++
 srcpkgs/fake-hwclock/files/rc.shutdown     |  3 ++
 srcpkgs/fake-hwclock/patches/manpage.patch | 45 ++++++++++++++++++++++
 srcpkgs/fake-hwclock/template              | 30 +++++++++++++++
 4 files changed, 82 insertions(+)
 create mode 100644 srcpkgs/fake-hwclock/files/rc.local
 create mode 100644 srcpkgs/fake-hwclock/files/rc.shutdown
 create mode 100644 srcpkgs/fake-hwclock/patches/manpage.patch
 create mode 100644 srcpkgs/fake-hwclock/template

diff --git a/srcpkgs/fake-hwclock/files/rc.local b/srcpkgs/fake-hwclock/files/rc.local
new file mode 100644
index 00000000000..b5e5a925bed
--- /dev/null
+++ b/srcpkgs/fake-hwclock/files/rc.local
@@ -0,0 +1,4 @@
+if (command -v /sbin/fake-hwclock >/dev/null 2>&1) ; then
+	[ -r /etc/default/fake-hwclock ] && . /etc/default/fake-hwclock
+	/sbin/fake-hwclock load $FORCE
+fi
diff --git a/srcpkgs/fake-hwclock/files/rc.shutdown b/srcpkgs/fake-hwclock/files/rc.shutdown
new file mode 100644
index 00000000000..822a0b65375
--- /dev/null
+++ b/srcpkgs/fake-hwclock/files/rc.shutdown
@@ -0,0 +1,3 @@
+if (command -v /sbin/fake-hwclock >/dev/null 2>&1) ; then
+	/sbin/fake-hwclock save
+fi
diff --git a/srcpkgs/fake-hwclock/patches/manpage.patch b/srcpkgs/fake-hwclock/patches/manpage.patch
new file mode 100644
index 00000000000..0009bcbd9ce
--- /dev/null
+++ b/srcpkgs/fake-hwclock/patches/manpage.patch
@@ -0,0 +1,45 @@
+--- o.fake-hwclock.8	2019-10-02 15:24:24.861930286 -0400
++++ fake-hwclock.8	2019-10-02 16:04:14.727887488 -0400
+@@ -1,4 +1,4 @@
+-.TH FAKE-HWCLOCK 8 "1 October 2014" Debian
++.TH FAKE-HWCLOCK 8 "2 October 2019" Debian
+ .SH NAME
+ fake-hwclock \- Control fake hardware clock
+ .SH SYNOPSIS
+@@ -23,6 +23,20 @@
+ case, in which case it is possible to modify the init system
+ configuration to move things earlier/later as appropriate.
+
++This program was originally written for Debian, which uses an init system
++different from \fBrunit\fP. In order to load the time on startup, the system
++administrator must add the command \fBfake-hwclock load\fP to
++\fI/etc/rc.local\fP. To facilitate this process, two example snippets are
++provided in \fI/usr/share/examples/fake-hwclock/\fP. They can be used like:
++
++.nf
++cat /usr/share/examples/fake-hwclock/rc.local | sudo tee -a /etc/rc.local
++.fi
++
++To save the time before shutdown, substitute both \fIrc.local\fP to
++\fIrc.shutdown\fP in the previous command, or manually add \fBfake-hwclock
++save\fP to \fI/etc/rc.shutdown\fP.
++
+ .SH DESCRIPTION
+ \fBfake-hwclock\fP sets and queries a fake "hardware clock" which stores the
+ time in a file. This program may be run by the system administrator
+@@ -47,11 +61,11 @@
+ \fB/etc/fake-hwclock.data\fR
+ The file used to store the time
+ .TP
+-\fB/etc/init.d/fake-hwclock\fR
+-The init script used to run fake-hwclock on startup and shutdown
++\fB/usr/share/examples/fake-hwclock/rc.local\fR
++Example snippet for /etc/rc.local to run fake-hwclock on startup
+ .TP
+-\fB/lib/systemd/system/fake-hwclock.service\fR
+-systemd service used to run fake-hwclock on startup and shutdown
++\fB/usr/share/examples/fake-hwclock/rc.shutdown\fR
++Example snippet for /etc/rc.shutdown to run fake-hwclock on shutdown
+ .TP
+ \fB/etc/default/fake-hwclock\fR
+ Settings file for the init script.
diff --git a/srcpkgs/fake-hwclock/template b/srcpkgs/fake-hwclock/template
new file mode 100644
index 00000000000..3d53f97bde1
--- /dev/null
+++ b/srcpkgs/fake-hwclock/template
@@ -0,0 +1,30 @@
+# Template file for 'fake-hwclock'
+pkgname=fake-hwclock
+version=0.11
+revision=1
+short_desc="Save/restore system clock on machines without working RTC hardware"
+maintainer="Ivan Gonzalez Polanco <ivan14polanco@gmail.com>"
+license="GPL-2.0"
+homepage="https://tracker.debian.org/pkg/fake-hwclock"
+distfiles="${DEBIAN_SITE}/main/f/${pkgname}/${pkgname}_${version}.tar.gz"
+checksum="58e29ff272a8e8b40ab972c49f82fd8fb6ef69a7fdde5f84292f800b53ea29ce"
+create_wrksrc=yes
+archs=noarch
+
+do_extract() {
+	filename="$(basename ${distfiles})"
+	tar xzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${filename} --strip-components=1 -C ${wrksrc}
+}
+
+do_install() {
+	vbin ${pkgname}
+	vconf etc/default/${pkgname}
+	vinstall debian/${pkgname}.cron.hourly 755 etc/cron.hourly ${pkgname}
+	vman ${pkgname}.8
+}
+
+post_install() {
+	vlicense COPYING
+	vsconf ${FILESDIR}/rc.local
+	vsconf ${FILESDIR}/rc.shutdown
+}

             reply	other threads:[~2019-10-03  3:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03  3:08 voidlinux-github [this message]
2019-10-04  7:16 ` [PR PATCH] [Closed]: " voidlinux-github
2019-10-04  8:11 [PR PATCH] " voidlinux-github

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-14985@inbox.vuxu.org \
    --to=voidlinux-github@inbox.vuxu.org \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).