diff options
author | Patrick Spek <p.spek@tyil.nl> | 2022-06-22 08:57:31 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2022-06-22 08:57:31 +0200 |
commit | ed3d178bb8db30d7795888bf90f3e508a5711fb6 (patch) | |
tree | a50023b27ac89256e5c80db40092778a11c8d525 | |
parent | f18666297208e3166a09a0ac380931009353fc0c (diff) | |
download | bashtard-ed3d178bb8db30d7795888bf90f3e508a5711fb6.tar.gz bashtard-ed3d178bb8db30d7795888bf90f3e508a5711fb6.tar.bz2 |
Add pkg-debian target to Makefile
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | LICENSES/AGPL-3.0-or-later.txt | 3 | ||||
-rw-r--r-- | Makefile | 66 | ||||
-rw-r--r-- | etc/debian/control | 14 | ||||
-rw-r--r-- | share/doc/bashtard.1.scd | 1 | ||||
-rw-r--r-- | share/doc/bashtard.3.scd | 5 | ||||
-rw-r--r-- | share/doc/bashtard.5.scd | 5 | ||||
-rw-r--r-- | share/doc/bashtard.7.scd | 5 | ||||
-rw-r--r-- | share/doc/playbooks.d.7.scd | 9 |
9 files changed, 85 insertions, 26 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index dbcc19d..159d468 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - A `backup` subcommand has been added. This backup system uses borg, which must be installed, but should be generic enough to be usable by most people out of the box. +- The `Makefile` has been extended with targets for creating packages for + GNU+Linux distributions. ### Changed @@ -36,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 is not set explicitly, a warning will be generated, but the original name passed to the `pkg_*()` function will be used by the host's package manager. - `datetime()` now always passes `-u` on to `date`. +- All manpages now include a `NAME` section. ## [1.0.0] - 2022-05-06 diff --git a/LICENSES/AGPL-3.0-or-later.txt b/LICENSES/AGPL-3.0-or-later.txt index 26faad5..1c738a7 100644 --- a/LICENSES/AGPL-3.0-or-later.txt +++ b/LICENSES/AGPL-3.0-or-later.txt @@ -1,5 +1,4 @@ -# SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -# +# SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> # SPDX-License-Identifier: AGPL-3.0-or-later GNU AFFERO GENERAL PUBLIC LICENSE @@ -7,46 +7,78 @@ DESTDIR=/usr ETCDIR=/etc +# Variables for building (binary) packages +PREFIX= +PKG_VERSION=0.0.0 +PKG_WORKDIR:=$(or $(PKG_WORKDIR),$(shell mktemp -d)) +PKG_ROOT:=$(PKG_WORKDIR)/bashtard-$(PKG_VERSION) + all: : # No build step required, use `make install` to install this program install: bin lib share uninstall: - rm -fv -- "$(DESTDIR)/bin/bashtard" - rm -rfv -- "$(DESTDIR)/lib/bashtard" - rm -rfv -- "$(DESTDIR)/share/bashtard" + rm -fv -- "$(PREFIX)$(DESTDIR)/bin/bashtard" + rm -rfv -- "$(PREFIX)$(DESTDIR)/lib/bashtard" + rm -rfv -- "$(PREFIX)$(DESTDIR)/share/bashtard" bin: - mkdir -pv -- "$(DESTDIR)/bin" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/bin" sed \ -e 's@BASHTARD_LIBDIR=.*@BASHTARD_LIBDIR="$(DESTDIR)/lib/bashtard"@' \ -e 's@BASHTARD_SHAREDIR=.*@BASHTARD_SHAREDIR="$(DESTDIR)/share/bashtard"@' \ -e 's@BASHTARD_ETCDIR=.*@BASHTARD_ETCDIR="$(ETCDIR)/bashtard"@' \ - bin/bashtard > "$(DESTDIR)/bin/bashtard" - chmod +x "$(DESTDIR)/bin/bashtard" + bin/bashtard > "$(PREFIX)$(DESTDIR)/bin/bashtard" + chmod +x "$(PREFIX)$(DESTDIR)/bin/bashtard" lib: - mkdir -pv -- "$(DESTDIR)/lib/bashtard" - cp -rv -- lib/* "$(DESTDIR)/lib/bashtard" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/lib/bashtard" + cp -rv -- lib/* "$(PREFIX)$(DESTDIR)/lib/bashtard" man: - mkdir -pv -- "$(DESTDIR)/share/man/man"{1,3,5,7} - scdoc < share/doc/bashtard.1.scd > "$(DESTDIR)/share/man/man1/bashtard.1" - scdoc < share/doc/bashtard.3.scd > "$(DESTDIR)/share/man/man3/bashtard.3" - scdoc < share/doc/bashtard.5.scd > "$(DESTDIR)/share/man/man5/bashtard.5" - scdoc < share/doc/bashtard.7.scd > "$(DESTDIR)/share/man/man7/bashtard.7" - scdoc < share/doc/playbooks.d.7.scd > "$(DESTDIR)/share/man/man7/playbooks.d.7" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/share/man/man1" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/share/man/man3" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/share/man/man5" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/share/man/man7" + scdoc < share/doc/bashtard.1.scd | gzip -cn9 > "$(PREFIX)$(DESTDIR)/share/man/man1/bashtard.1.gz" + scdoc < share/doc/bashtard.3.scd | gzip -cn9 > "$(PREFIX)$(DESTDIR)/share/man/man3/bashtard.3.gz" + scdoc < share/doc/bashtard.5.scd | gzip -cn9 > "$(PREFIX)$(DESTDIR)/share/man/man5/bashtard.5.gz" + scdoc < share/doc/bashtard.7.scd | gzip -cn9 > "$(PREFIX)$(DESTDIR)/share/man/man7/bashtard.7.gz" + scdoc < share/doc/playbooks.d.7.scd | gzip -cn9 > "$(PREFIX)$(DESTDIR)/share/man/man7/playbooks.d.7.gz" + +pkg-debian: + mkdir -pv "$(PKG_ROOT)" + + # Install package + $(MAKE) PREFIX="$(PKG_ROOT)" install + $(MAKE) PREFIX="$(PKG_ROOT)" man + + # Apply Debian stuff + mkdir -pv "$(PKG_ROOT)/DEBIAN" + sed \ + -e 's/%VERSION%/$(PKG_VERSION)/g' \ + etc/debian/control > "$(PKG_ROOT)/DEBIAN/control" + mkdir -pv "$(PKG_ROOT)/usr/share/doc/bashtard" + gzip -cn9 < CHANGELOG.md > "$(PKG_ROOT)/usr/share/doc/bashtard/changelog.gz" + cp -rv LICENSES/AGPL-3.0-or-later.txt "$(PKG_ROOT)/usr/share/doc/bashtard/copyright" + find "$(PKG_ROOT)" -iname "*.bash" -type f -exec chmod +x {} \; + + # Build Debian package + cd "$(PKG_WORKDIR)" && dpkg --build "bashtard-$(PKG_VERSION)" + + # TODO: Remove lintian, that's a manual step + lintian --no-tag-display-limit "$(PKG_WORKDIR)/bashtard-$(PKG_VERSION).deb" qa: reuse lint shellcheck -x bin/bashtard **/*.bash share: - mkdir -pv -- "$(DESTDIR)/share/bashtard" + mkdir -pv -- "$(PREFIX)$(DESTDIR)/share/bashtard" cp -rv -- \ share/defaults \ share/os.d \ - "$(DESTDIR)/share/bashtard" + "$(PREFIX)$(DESTDIR)/share/bashtard" -.PHONY: all install uninstall qa bin lib man share +.PHONY: all install uninstall pkg-debian qa bin lib man share diff --git a/etc/debian/control b/etc/debian/control new file mode 100644 index 0000000..867a679 --- /dev/null +++ b/etc/debian/control @@ -0,0 +1,14 @@ +Package: bashtard +Version: %VERSION% +Source: bashtard +Section: admin +Priority: optional +Maintainer: Patrick Spek <p.spek+debian@tyil.nl> +Homepage: https://git.tyil.nl/bashtard +Architecture: all +Depends: +Description: Simple configuration management in Bash + Bashtard is a configuration management system built on the idea of simplicity + for the user. It lets you write reasonably simple Bash scripts to configure + your systems, while providing just enough abstractions to make it easy to + work with various base systems. diff --git a/share/doc/bashtard.1.scd b/share/doc/bashtard.1.scd index 4158169..aabc2d7 100644 --- a/share/doc/bashtard.1.scd +++ b/share/doc/bashtard.1.scd @@ -1,7 +1,6 @@ bashtard(1) ; SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -; ; SPDX-License-Identifier: AGPL-3.0-or-later # NAME diff --git a/share/doc/bashtard.3.scd b/share/doc/bashtard.3.scd index 550c448..341d8fc 100644 --- a/share/doc/bashtard.3.scd +++ b/share/doc/bashtard.3.scd @@ -1,9 +1,12 @@ bashtard(3) ; SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -; ; SPDX-License-Identifier: AGPL-3.0-or-later +# NAME + +bashtard - A Bash-based configuration management utility + # INTRODUCTION When writing a *playbook*, you will want to know of the variables and functions diff --git a/share/doc/bashtard.5.scd b/share/doc/bashtard.5.scd index cec92ea..5fe37d2 100644 --- a/share/doc/bashtard.5.scd +++ b/share/doc/bashtard.5.scd @@ -1,9 +1,12 @@ bashtard(5) ; SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -; ; SPDX-License-Identifier: AGPL-3.0-or-later +# NAME + +bashtard - A Bash-based configuration management utility + # INTRODUCTION When it comes to configuration, *bashtard* checks various locations for files diff --git a/share/doc/bashtard.7.scd b/share/doc/bashtard.7.scd index d3d2148..fc9333e 100644 --- a/share/doc/bashtard.7.scd +++ b/share/doc/bashtard.7.scd @@ -1,9 +1,12 @@ bashtard(7) "/etc/bashtard" ; SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -; ; SPDX-License-Identifier: AGPL-3.0-or-later +# NAME + +bashtard - A Bash-based configuration management utility + # HIERARCHY # defaults diff --git a/share/doc/playbooks.d.7.scd b/share/doc/playbooks.d.7.scd index 7157350..b4624a2 100644 --- a/share/doc/playbooks.d.7.scd +++ b/share/doc/playbooks.d.7.scd @@ -1,9 +1,12 @@ playbooks.d(7) "/etc/bashtard/playbooks.d" ; SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -; ; SPDX-License-Identifier: AGPL-3.0-or-later +# NAME + +bashtard - A Bash-based configuration management utility + # INTRODUCTION *bashtard* playbooks are, in essence, no more than directories with a small @@ -28,8 +31,8 @@ usually only a single sentence. This description is shown in the usage output of The _playbook.bash_ file is a regular Bash script. It must contain 3 specific functions, which are called by *bashtard* when the appropriate subcommand is -invoked. These functions are _playbook_add()_, _playbook_sync()_, and -_playbook_del()_. How you define these functions is up to you. +invoked. These functions are _playbook\_add()_, _playbook\_sync()_, and +_playbook\_del()_. How you define these functions is up to you. # SEE ALSO |