[Frugalware-git] frugalwareutils: timeconfig: add systemd support

Miklos Vajna vmiklos at frugalware.org
Sat Dec 18 01:13:44 CET 2010


Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalwareutils.git;a=commitdiff;h=12d217a9fd88edb09489527f57d37fda2838f282

commit 12d217a9fd88edb09489527f57d37fda2838f282
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Sat Dec 18 01:11:59 2010 +0100

timeconfig: add systemd support

diff --git a/Makefile b/Makefile
index 7015b57..a39eaca 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,7 @@ install:
$(INSTALL) -d $(DESTDIR)$(fwlibdir)
$(INSTALL) -d $(DESTDIR)$(libexecdir)
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/sysconfig/network
+	$(INSTALL) -d $(DESTDIR)$(sysconfdir)/systemd/system/sysinit.target.wants
$(INSTALL) -d $(DESTDIR)$(mandir)/man1
$(INSTALL) -d $(DESTDIR)$(mandir)/man3
$(INSTALL) -d $(DESTDIR)$(includedir)
diff --git a/libfwtimeconfig/libfwtimeconfig.c b/libfwtimeconfig/libfwtimeconfig.c
index 9c0ade0..8c7825a 100644
--- a/libfwtimeconfig/libfwtimeconfig.c
+++ b/libfwtimeconfig/libfwtimeconfig.c
@@ -1,7 +1,7 @@
/*
*  libfwtimeconfig.c for frugalwareutils
*
- *  Copyright (c) 2006 by Miklos Vajna <vmiklos at frugalware.org>
+ *  Copyright (c) 2006, 2010 by Miklos Vajna <vmiklos at frugalware.org>
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
@@ -57,6 +57,20 @@ int fwtime_hwclockconf(char *path, char *mode)
fprintf(fp, "# /etc/hardwareclock\n\n"
"# this file is generated by timeconfig\n\n%s\n", mode);
fclose(fp);
+
+	if (!strcmp(mode, "localtime"))
+	{
+		symlink("/lib/systemd/system/hwclock-load.service", "/etc/systemd/system/sysinit.target.wants/hwclock-load.service");
+		symlink("/etc/rc.d/rc.time", "/etc/rc.d/rcS.d/S18rc.time");
+	}
+	else
+	{
+		unlink("/etc/systemd/system/sysinit.target.wants/hwclock-load.service");
+		// we have CONFIG_RTC_HCTOSYS=y in the kernel so we can
+		// safely get rid of this service when using UTC
+		unlink("/etc/rc.d/rcS.d/S18rc.time");
+	}
+
return(0);
}


More information about the Frugalware-git mailing list