From 611b19b9cb83774230bf192a48ecf385ab7eabc3 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 8 May 2024 00:04:05 +0200 Subject: [PATCH] Centralize meta information about dss. This defines a couple of package related variables in Makefile, renames dss.suite -> dss.suite.m4 and index.html.in -> index.html.m4, and tweaks the recipes to generate dss.suite and index.html.in from the m4 files, referring to these variables. The contents of the README file are moved into Makefile so that the three paragraphs can be printed with make README. --- .gitignore | 1 + Makefile | 113 +++++++++++++++++++++++++++---- README | 21 +----- dss.suite => dss.suite.m4 | 35 +++++++--- index.html.in | 139 -------------------------------------- index.html.m4 | 99 +++++++++++++++++++++++++++ 6 files changed, 227 insertions(+), 181 deletions(-) rename dss.suite => dss.suite.m4 (98%) delete mode 100644 index.html.in create mode 100644 index.html.m4 diff --git a/.gitignore b/.gitignore index fc6a8bb..aedd74e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ version.c *.swp dss.lsg.* dss +dss.suite dss.1.gz dss.1.html index.html diff --git a/Makefile b/Makefile index eaf3e54..46b9c8c 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,74 @@ # SPDX-License-Identifier: GPL-2.0 + +PACKAGE := dss +SLOGAN := the dyadic snapshot scheduler +define DESCRIPTION1 := + $(PACKAGE) maintains hardlink-based snapshots of a given directory on a + remote or local host using rsync's link-dest feature. The snapshots + are organized so that any snapshot can directly be deployed as an + (emergency) replacement for the primary system. +endef +define DESCRIPTION2 := + $(PACKAGE) is admin friendly: It is easy to configure and needs little + attention after the initial setup. In particular, no full, incremental + or differential backups need to be configured, and there is no database + to maintain. $(PACKAGE) is also user-friendly: Assuming the snapshot server + allows read-only user access over the network, users can restore + accidentically removed files without admin intervention, using their + favorite file browser to copy files from the snapshot directory back + to the primary system. +endef +define DESCRIPTION3 := + $(PACKAGE) keeps track of the age and the state of existing snapshots and + triggers snapshot creation and removal according to the configuration + settings. It tries to maintain a scheme where many recent snapshots + and few old snapshots exist, for example 16 snapshots newer than a + week, 8 snapshots between one and two weeks old, 4 snapshots between + two and three weeks old, and so on. +endef +AUTHOR := Andre Noll +EMAIL := maan@tuebingen.mpg.de +URL := https://people.tuebingen.mpg.de/maan/$(PACKAGE)/ +CLONE_URL := https://git.tuebingen.mpg.de/$(PACKAGE) +GITWEB_URL := https://git.tuebingen.mpg.de/$(PACKAGE).git +PACKAGE_HOMEPAGE := https://people.tuebingen.mpg.de/maan/$(PACKAGE)/ +HOME_URL := https://people.tuebingen.mpg.de/maan/ +LICENSE := GPL-2.0 +LICENSE_URL := https://www.gnu.org/licenses/ + PREFIX ?= /usr/local INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= $(INSTALL) -m 644 MKDIR_P := mkdir -p -VERSION := $(shell ./version-gen.sh dss version.c) +VERSION := $(shell ./version-gen.sh $(PACKAGE) version.c) RM := rm -f LSG := lopsubgen GROFF := groff -m man -Thtml -P -l -P -r GZIP := gzip -cfn9 - -units := dss str file exec sig daemon df tv snap ipc dss.lsg version +units := $(PACKAGE) $(PACKAGE).lsg str file exec sig daemon df tv snap ipc version +M4 := m4 \ + -D "AUTHOR=$(AUTHOR)" \ + -D "PACKAGE=$(PACKAGE)" \ + -D "SLOGAN=$(SLOGAN)" \ + -D "EMAIL=$(EMAIL)" \ + -D "URL=$(URL)" \ + -D "CLONE_URL=$(CLONE_URL)" \ + -D "GITWEB_URL=$(GITWEB_URL)" \ + -D "HOME_URL=$(HOME_URL)" \ + -D "PACKAGE_HOMEPAGE=$(PACKAGE_HOMEPAGE)" \ + -D "LICENSE=$(LICENSE)" \ + -D "LICENSE_URL=$(LICENSE_URL)" \ + -D "DESCRIPTION1=$(DESCRIPTION1)" \ + -D "DESCRIPTION2=$(DESCRIPTION2)" \ + -D "DESCRIPTION3=$(DESCRIPTION3)" objs := $(addsuffix .o, $(units)) deps := $(addsuffix .d, $(units)) +all := $(PACKAGE) $(PACKAGE).1.gz -all: dss dss.1.gz -man: dss.1.gz -$(objs): dss.lsg.h Makefile +all: $(all) +man: $(PACKAGE).1.gz +$(objs): $(PACKAGE).lsg.h Makefile -include $(deps) DSS_CPPFLAGS += -Wunused-macros @@ -43,15 +95,20 @@ else endif version.c: $(call SAY, VG $@) - ./version-gen.sh dss version.c > /dev/null -dss: $(objs) + ./version-gen.sh $(PACKAGE) version.c > /dev/null +$(PACKAGE): $(objs) $(call SAY, LD $@) $(CC) -o $@ $(objs) $(LDFLAGS) -llopsub %.o: %.c $(call SAY, CC $<) $(CC) -c -o $@ $(DSS_CPPFLAGS) $(CPPFLAGS) $(DSS_CFLAGS) $(CFLAGS) \ -MMD -MF $(*F).d -MT $@ $< -.PRECIOUS: %.lsg.c %.lsg.h %.1.gz + +.PHONY: all clean install README +.PRECIOUS: %.lsg.c %.lsg.h %.suite %.1 +$(PACKAGE).suite: $(PACKAGE).suite.m4 Makefile + $(call SAY, M4 $<) + $(M4) $< > $@ %.lsg.h: %.suite $(call SAY, LSGH $<) $(LSG) --gen-h=$@ < $< @@ -69,7 +126,8 @@ dss: $(objs) $(GROFF) $< | sed -e '1,/^/d; /^<\/body>/,$$d' > $@ clean: $(call SAY, CLEAN) - $(RM) *.[od] dss dss.1.* *.html dss.lsg.[ch] version.c + $(RM) *.[od] $(all) *.html $(PACKAGE).1 $(PACKAGE).suite \ + $(PACKAGE).lsg.[ch] version.c ifneq ($(findstring strip, $(MAKECMDGOALS)),) strip_option := -s @@ -78,12 +136,39 @@ bindir := $(DESTDIR)$(PREFIX)/bin mandir := $(DESTDIR)$(PREFIX)/share/man/man1 install install-strip: all $(MKDIR_P) $(bindir) $(mandir) - $(INSTALL_PROGRAM) $(strip_option) dss $(bindir) - $(INSTALL_DATA) dss.1.gz $(mandir) + $(INSTALL_PROGRAM) $(strip_option) $(PACKAGE) $(bindir) + $(INSTALL_DATA) $(PACKAGE).1.gz $(mandir) + +define README := +$(PACKAGE) - $(SLOGAN) + +$(DESCRIPTION1) + +$(DESCRIPTION2) + +$(DESCRIPTION3) + +Resources +~~~~~~~~~ +web page: $(PACKAGE_HOMEPAGE) +git clone URL: $(CLONE_URL) +gitweb: $(GITWEB_URL) +author home page: $(HOME_URL) +report bugs to: $(AUTHOR) <$(EMAIL)> +endef + +README: + @printf '%s\n' "$(README)" -index.html: dss.1.html index.html.in INSTALL README NEWS +index.html.in: index.html.m4 + $(call SAY, M4 $<) + $(M4) $< > $@ +index.html: dss.1.html index.html.in INSTALL NEWS + $(call SAY, MD $@) sed -e '/@README@/,$$d' index.html.in > $@ - markdown README >> $@ + printf '

%s

\n' "$(DESCRIPTION1)" >> $@ + printf '

%s

\n' "$(DESCRIPTION2)" >> $@ + printf '

%s

\n' "$(DESCRIPTION3)" >> $@ sed -e '1,/@README@/d' -e '/@NEWS@/,$$d' index.html.in >> $@ markdown NEWS >> $@ sed -e '1,/@NEWS@/d' -e '/@INSTALL@/,$$d' index.html.in >> $@ diff --git a/README b/README index 052ea8d..52a1fd7 100644 --- a/README +++ b/README @@ -1,20 +1 @@ -dss maintains hardlink-based snapshots of a given directory on a -remote or local host using rsync's link-dest feature. The snapshots -are organized so that any snapshot can directly be deployed as an -(emergency) replacement for the primary system. - -dss is admin friendly: It is easy to configure and needs little -attention after the initial setup. In particular, no full, incremental -or differential backups need to be configured, and there is no database -to maintain. dss is also user-friendly: Assuming the snapshot server -allows read-only user access over the network, users can restore -accidentically removed files without admin intervention, using their -favorite file browser to copy files from the snapshot directory back -to the primary system. - -dss keeps track of the age and the state of existing snapshots and -triggers snapshot creation and removal according to the configuration -settings. It tries to maintain a scheme where many recent snapshots -and few old snapshots exist, for example 16 snapshots newer than a -week, 8 snapshots between one and two weeks old, 4 snapshots between -two and three weeks old, and so on. +Run "make README". diff --git a/dss.suite b/dss.suite.m4 similarity index 98% rename from dss.suite rename to dss.suite.m4 index f9cf8af..227b0b5 100644 --- a/dss.suite +++ b/dss.suite.m4 @@ -5,10 +5,13 @@ caption = Subcommands [supercommand dss] [description] - dss creates hardlink-based snapshots of a given directory on a remote - or local host using rsync's link-dest feature. + DESCRIPTION1() + + DESCRIPTION2() + + DESCRIPTION3() [/description] - purpose = the dyadic snapshot scheduler + purpose = SLOGAN() synopsis = [global-options...] [--] [ [subcommand-options...]] [option general-options-section] @@ -542,19 +545,35 @@ caption = Subcommands [/description] [section copyright] - Written by Andre Noll + Written by AUTHOR() .br - Copyright (C) 2008 - present Andre Noll + Copyright (C) 2008 - present AUTHOR() .br - License: GNU GPL version 2 + License: LICENSE() .br This is free software: you are free to change and redistribute it. .br There is NO WARRANTY, to the extent permitted by law. + .P + Project web page: + .UR URL() + .UE + .br + Git clone `URL': + .UR CLONE_URL() + .UE + .br + Gitweb: + .UR GITWEB_URL() + .UE + .br + Author's home page: + .UR HOME_URL() + .UE .br Report bugs to - .MT - Andre Noll + .MT EMAIL() + AUTHOR() .ME [/section] diff --git a/index.html.in b/index.html.in deleted file mode 100644 index b505761..0000000 --- a/index.html.in +++ /dev/null @@ -1,139 +0,0 @@ - - - - - DSS - The dyadic snapshot scheduler - - - - - - - - - - -
- dss - -

The dyadic snapshot scheduler

-
- -
- - [README] - [NEWS] - [Download] - [INSTALL] - [License] - [Contact] - [Man page] - -
- -
-

- README -

-
- - @README@ - -
- -
-

- NEWS -

-
- - @NEWS@ - -
- -
-

- Download -

-
- -

Only the source code is available for download. Use - - git - - to clone the dss repository by executing

- -
- - git clone git://git.tuebingen.mpg.de/dss - -
- -

or grab the - - tarball - - of the current master branch. If you prefer to download the tarball of - the latest release, select the corresponding snapshot - link on the - - dss gitweb page - -

- -
- -
-

- INSTALL -

-
- - @INSTALL@ - -
- -
-

- License -

-
- -

dss is open source software, licensed under the - - GNU - General Public License, Version 2.

- -
- -
-

- Contact -

-
- -

Email: André Noll, maan@tuebingen.mpg.de, - Homepage: http://people.tuebingen.mpg.de/maan/ -

- - Comments and bug reports are welcome. Please provide - enough info such as the version of dss you are using and - relevant parts of the logs. Including the string [dss] in - the subject line is also a good idea. - -
- -
-

- Man page -

-
- - @MAN_PAGE@ - - - diff --git a/index.html.m4 b/index.html.m4 new file mode 100644 index 0000000..6d2f58f --- /dev/null +++ b/index.html.m4 @@ -0,0 +1,99 @@ +dnl SPDX-License-Identifier: GPL-2.0 + + + + + PACKAGE() - SLOGAN() + + + + + + + + + + +
+ dss + +

SLOGAN()

+
+ +
+ + [NEWS] + [INSTALL] + [License] + [Resources] + [Man page] + +
+ +
+

+ README +

+
+ + @README@ + +
+ +
+

+ NEWS +

+
+ + @NEWS@ + +
+ +
+

+ INSTALL +

+
+ +

To download the source code, run git clone CLONE_URL() , + or grab a current tarball from the gitweb + page and unpack it.

+ + @INSTALL@ + +
+ +
+

+ License +

+
+ +

dss is open source software, licensed under the LICENSE().

+ +
+ +

Resources

+ + +
+ +
+

+ Man page +

+
+ + @MAN_PAGE@ + + + -- 2.39.5