diff --git a/.build.yml b/.build.yml index dcc1eb1..dac03f9 100644 --- a/.build.yml +++ b/.build.yml @@ -2,6 +2,7 @@ image: ubuntu/next packages: - dpkg - dpkg-dev + - scdoc - shellcheck sources: diff --git a/Makefile b/Makefile index da7d092..4852505 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,52 @@ +.POSIX: +.SUFFIXES: +.SUFFIXES: .1 .5 .1.scd .5.scd + PREFIX?=/usr/local BINDIR?=$(PREFIX)/bin +MANDIR?=$(PREFIX)/share/man # Exists in GNUMake but not in NetBSD make and others. RM?=rm -f +RMDIR_IF_EMPTY:=sh -c '\ +if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \ + rmdir $$0; \ +fi' + +all: docs ## Build and generate files + +docs: docs/aptpkg.1 docs/aptpkg.5 ## Generate docs + +.1.scd.1: + scdoc < $< > $@ + +.5.scd.5: + scdoc < $< > $@ + +.PHONY: clean +clean: ## Remove generated files + $(RM) docs/aptpkg.1 docs/aptpkg.5 + .PHONY: help help: ## Show this help @egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' .PHONY: install install: ## Install aptpkg - mkdir -m755 -p $(DESTDIR)$(BINDIR) + mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(MANDIR)/man5 install -m755 aptpkg $(DESTDIR)$(BINDIR)/aptpkg + install -m644 docs/aptpkg.1 $(DESTDIR)$(MANDIR)/man1/aptpkg.1 + install -m644 docs/aptpkg.5 $(DESTDIR)$(MANDIR)/man1/aptpkg.5 .PHONY: test test: ## Run shellcheck tests shellcheck aptpkg -RMDIR_IF_EMPTY:=sh -c '\ -if test -d $$0 && ! ls -1qA $$0 | grep -q . ; then \ - rmdir $$0; \ -fi' - .PHONY: uninstall uninstall: ## Uninstall aptpkg $(RM) $(DESTDIR)$(BINDIR)/aptpkg + $(RM) $(DESTDIR)$(MANDIR)/man1/aptpkg.1 + $(RM) $(DESTDIR)$(MANDIR)/man5/aptpkg.5 ${RMDIR_IF_EMPTY} $(DESTDIR)$(BINDIR) + ${RMDIR_IF_EMPTY} $(DESTDIR)$(MANDIR) diff --git a/README.md b/README.md index 4166a2f..fa2d2da 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ Easily create/ get debian packages. ## Prerequisites -- ubuntu-dev-tools +- scdoc (build) +- dpkg, dpkg-dev - git, wget, bash -- unzip, tar, ar, etc. +- unzip, tar, etc. ## Usage -See the [wiki](https://man.sr.ht/~earnestma/aptpkg) or run `./aptpkg --help` for -more information. +Run `aptpkg --help` or `man aptpkg` for more information. ## Contribute diff --git a/aptpkg b/aptpkg index 3290047..a2f98a7 100755 --- a/aptpkg +++ b/aptpkg @@ -11,7 +11,7 @@ aptpkg v$APTPKG_VERSION Easily create debian packages. -Documentation: https://man.sr.ht/~earnestma/aptpkg +For more documentation, run man aptpkg Usage: aptpkg [directory] diff --git a/docs/aptpkg.1.scd b/docs/aptpkg.1.scd new file mode 100644 index 0000000..a4375d4 --- /dev/null +++ b/docs/aptpkg.1.scd @@ -0,0 +1,31 @@ +aptpkg(1) + +# NAME + +aptpkg - easily create/ get debian packages + +# SYNOPSIS + +*aptpkg* _path_ + +*aptpkg* --auto [git commit hash] + +*aptpkg* --help + +# DESCRIPTION + +aptpkg can be used to easily create/ get debian packages, and can be used with +a tool such as *reprepro*(1). + +Provide aptpkg with a path to a folder containing an *aptpkg*(5) build file. +The --auto option can also be used to build modified packages based on a git +commit hash, using _HEAD_ if one is not provided. + +# SEE ALSO + +*aptpkg*(5) + +# AUTHORS + +Sources, maintainers list, and how to submit bugs/ patches can be done at +https://sr.ht/~earnestma/aptpkg. diff --git a/docs/aptpkg.5.scd b/docs/aptpkg.5.scd new file mode 100644 index 0000000..a9be333 --- /dev/null +++ b/docs/aptpkg.5.scd @@ -0,0 +1,62 @@ +aptpkg(5) + +# NAME + +aptpkg - file format reference + +# SYNTAX + +The file must be named _build_ and placed in a directory named the program. + +## MAINTAINERS + +The first line should start like so: + + ``` + # Maintainer: Name + ``` + +More maintainers can be listed after. + +## COMMON + +- name: Name of the package +- version: Version number +- rev: Revision number (often 0, only useful if type=file) +- type + - type=deb: Debian package that will be downloaded and checked + - type=file: Download file(s), check, and execute the _steps_ function +- url: Homepage of upstream +- description: Description similar to what upstream says + +## SOURCE + +Provide a URL pointing to the file to download + +## SHA512SUMS + +The output of `sha512sum filename` that will be used to verify + +## STEPS + +Steps to extract and "install" the package + +- $builddir: The root directory +- cin-bin: Install an executable file (with permissions 755) +- cin-file: Install a file (with permissions 644) + +## MAINTAINER SCRIPTS + +Maintainer scripts can be placed along _build_: examples include preinst, +postinst, prerm, and postrm + +# SEE ALSO + +*aptpkg*(1) + +Files that aptpkg.earne.link uses: https://git.sr.ht/~earnestma/aptpkg-pkgs + +# AUTHORS + +Sources, maintainers list, and how to submit bugs/ patches can be done at +https://sr.ht/~earnestma/aptpkg.