Compare commits
23 Commits
Author | SHA1 | Date |
---|---|---|
earnest ma | e7aab11f9f | |
earnest ma | 2271857b7c | |
earnest ma | a1cffdb13f | |
earnest ma | a9e21971fb | |
earnest ma | 93652c35a3 | |
earnest ma | aa417bebab | |
earnest ma | 02bac12c49 | |
earnest ma | dd285f65a5 | |
earnest ma | 161b78fd26 | |
earnest ma | dc4d6244ae | |
earnest ma | 78df941e99 | |
earnest ma | a3ee2179ef | |
earnest ma | 0383db3690 | |
earnest ma | 59b5b1c648 | |
earnest ma | 9faefc5d50 | |
earnest ma | d5b93744a2 | |
earnest ma | 627fc026d1 | |
earnest ma | 778acb4d76 | |
earnest ma | c209761d1e | |
earnest ma | 64e09d296d | |
earnest ma | 3f23633dcc | |
earnest ma | b083995b70 | |
earnest ma | 3589e04177 |
13
.build.yml
13
.build.yml
|
@ -1,13 +0,0 @@
|
|||
image: ubuntu/next
|
||||
packages:
|
||||
- dpkg
|
||||
- dpkg-dev
|
||||
- shellcheck
|
||||
|
||||
sources:
|
||||
- https://git.sr.ht/~earnestma/aptpkg
|
||||
|
||||
tasks:
|
||||
- test: |
|
||||
cd aptpkg
|
||||
make test
|
|
@ -0,0 +1,2 @@
|
|||
*.1
|
||||
*.5
|
|
@ -0,0 +1,20 @@
|
|||
branches: main # Ideally, only run on pushes to main branch and PRs
|
||||
pipeline:
|
||||
pull-request:
|
||||
image: ubuntu:jammy
|
||||
when:
|
||||
event: [ pull_request ]
|
||||
commands:
|
||||
- apt -y update
|
||||
- apt -y install dpkg dpkg-dev scdoc shellcheck
|
||||
- make test
|
||||
|
||||
main:
|
||||
image: ubuntu:jammy
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
commands:
|
||||
- apt -y update
|
||||
- apt -y install dpkg dpkg-dev scdoc shellcheck
|
||||
- make test
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright © 2021 earnest ma <me@earne.link>
|
||||
Copyright © 2021-2022 earnest ma <me@earne.link>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the “Software”), to deal in
|
||||
|
|
36
Makefile
36
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)/man5/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)
|
||||
|
|
30
README.md
30
README.md
|
@ -1,35 +1,27 @@
|
|||
# aptpkg
|
||||
[![sr.ht Project hub](https://img.shields.io/badge/sr.ht-Project%20hub-grey)](https://sr.ht/~earnestma/aptpkg)
|
||||
[![builds.sr.ht status](https://builds.sr.ht/~earnestma/aptpkg.svg)](https://builds.sr.ht/~earnestma/aptpkg?)
|
||||
|
||||
- **[aptpkg.earne.link packaging git
|
||||
repository](https://git.sr.ht/~earnestma/aptpkg-pkgs)**
|
||||
- **[aptpkg.earne.link Package archive setup/
|
||||
info](https://man.sr.ht/~earnestma/aptpkg)**
|
||||
**Please note:** I am not actively using or maintaining this project.
|
||||
|
||||
Easily create debian packages.
|
||||
- [packaging repo example](https://git.earne.link/earnestma/aptpkg-pkgs)
|
||||
- [wiki page](https://git.earne.link/earnestma/aptpkg/wiki)
|
||||
|
||||
aptpkg can be used to easily create/ get debian packages, and can be used with a tool such as **reprepro**(1).
|
||||
|
||||
## 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
|
||||
|
||||
Send patches to [this mailing
|
||||
list](https://lists.sr.ht/~earnestma/aptpkg-devel); you can follow [this
|
||||
guide](https://git-send-email.io) if you don't know how.
|
||||
|
||||
File **confirmed** bugs/ feature requests
|
||||
[here](https://todo.sr.ht/~earnestma/aptpkg)!
|
||||
Creating [issues](https://git.earne.link/earnestma/aptpkg/issues), [discussion](https://discuss.earne.link/t/earnest), or [pull requests](https://git.earne.link/earnestma/aptpkg/pulls) are welcome!
|
||||
|
||||
## License
|
||||
|
||||
`aptpkg` is published under an MIT License. See the LICENSE file for copyright
|
||||
and license details.
|
||||
`aptpkg` is published under an MIT License. See the LICENSE file for copyright and license details.
|
||||
|
|
70
aptpkg
70
aptpkg
|
@ -1,7 +1,7 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Init variables
|
||||
APTPKG_VERSION="0.2.0"
|
||||
APTPKG_VERSION="1.1.0"
|
||||
|
||||
# Show help
|
||||
show_help(){
|
||||
|
@ -11,11 +11,14 @@ aptpkg v$APTPKG_VERSION
|
|||
|
||||
Easily create debian packages.
|
||||
|
||||
Documentation: https://man.sr.ht/~earnestma/aptpkg
|
||||
For more documentation, run man aptpkg
|
||||
|
||||
Usage:
|
||||
aptpkg [directory]
|
||||
aptpkg --all [directory] Build all folders under directory
|
||||
aptpkg --auto (commit id) Autobuild modified packages from commit
|
||||
aptpkg -h, --help Show help
|
||||
aptpkg -v, --version Show version
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -28,7 +31,9 @@ error_usage_die(){
|
|||
|
||||
# Verify sha512sums
|
||||
verify(){
|
||||
echo "${sha512sums:?}" | sha512sum -c
|
||||
if [ ! "${sha512sums:?}" = "SKIP" ]; then
|
||||
echo "${sha512sums:?}" | sha512sum -c
|
||||
fi
|
||||
}
|
||||
|
||||
# Copy/ install wrapper for files
|
||||
|
@ -58,7 +63,7 @@ Section:
|
|||
Priority:
|
||||
Homepage: ${url:?}
|
||||
Description: ${description:?}
|
||||
${customcontrol:?}
|
||||
${customcontrol:=}
|
||||
" > "$builddir"/DEBIAN/control
|
||||
}
|
||||
|
||||
|
@ -77,9 +82,9 @@ build_file(){
|
|||
cd "$1" || error_usage_die "Problem with changing directory"
|
||||
mkdir -p "$builddir"
|
||||
|
||||
for url in $source; do
|
||||
for urls in $source; do
|
||||
echo "Getting $source"
|
||||
wget -q "$url"
|
||||
wget -q "$urls"
|
||||
done
|
||||
|
||||
verify
|
||||
|
@ -103,7 +108,8 @@ load_build(){
|
|||
mkdir -p dist
|
||||
|
||||
# shellcheck disable=SC1090
|
||||
source "${1/build:?}"
|
||||
# shellcheck disable=SC1091
|
||||
source "${1:?}/build"
|
||||
|
||||
case "${type:?}" in
|
||||
deb)
|
||||
|
@ -113,10 +119,60 @@ load_build(){
|
|||
esac
|
||||
}
|
||||
|
||||
# Autobuild packages based on git list files changed in commit
|
||||
# latest (HEAD) assumed if commit hash not provided
|
||||
change_autobuild_pkgs(){
|
||||
[ -d .git ] || error_usage_die "Current directory is not a git repository!"
|
||||
|
||||
commitid=$1
|
||||
[ -n "$commitid" ] || commitid=HEAD
|
||||
|
||||
if [[ "$commitid" = HEAD ]]; then
|
||||
before_run=$(git log HEAD^..HEAD | grep aptpkg-auto-run | sed 's#aptpkg-auto-run: ##' | sed 's# ##')
|
||||
|
||||
if [ -n "$before_run" ]; then
|
||||
for m in $before_run; do
|
||||
build_chg_pre=$(git diff-tree --no-commit-id --name-only -r "$m" | grep "build" | sed 's#/build##')
|
||||
echo "Using $m with files $build_chg_pre"
|
||||
|
||||
for a in $build_chg_pre; do
|
||||
aptpkg "$a"
|
||||
done
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
build_chg=$(git diff-tree --no-commit-id --name-only -r $commitid | grep "build" | sed 's#/build##')
|
||||
echo "Using $commitid with files $build_chg"
|
||||
|
||||
for f in $build_chg; do
|
||||
aptpkg "$f"
|
||||
done
|
||||
}
|
||||
|
||||
# Build all in directory
|
||||
build_all_in_dir(){
|
||||
[ -d "$1" ] || error_usage_die "Provide a directory"
|
||||
buildfile_folders=$(ls -d "$1"/*)
|
||||
|
||||
for ww in $buildfile_folders; do
|
||||
printf "\nBuilding %s\n\n" "$ww"
|
||||
aptpkg "$ww"
|
||||
done
|
||||
}
|
||||
|
||||
# Run!
|
||||
case $1 in
|
||||
-h|--help)
|
||||
show_help ;;
|
||||
--all)
|
||||
shift
|
||||
build_all_in_dir "$1" ;;
|
||||
--auto)
|
||||
shift
|
||||
change_autobuild_pkgs "$1" ;;
|
||||
-v|--version)
|
||||
echo "aptpkg $APTPKG_VERSION" ;;
|
||||
*)
|
||||
if [ $# -ne 1 ]; then
|
||||
error_usage_die "You must provide one directory"
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
aptpkg(1)
|
||||
|
||||
# NAME
|
||||
|
||||
aptpkg - easily create/ get debian packages
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
*aptpkg* _path_
|
||||
|
||||
*aptpkg* --all _path_
|
||||
|
||||
*aptpkg* --auto [git commit hash]
|
||||
|
||||
*aptpkg* -h | --help
|
||||
|
||||
*aptpkg* -v | --version
|
||||
|
||||
# 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. The aptpkg script *must* be
|
||||
available in $PATH.
|
||||
|
||||
For mass rebuilds, aptpkg --auto can be used, passing a directory with folders
|
||||
under which the build files are located.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*aptpkg*(5)
|
||||
|
||||
# AUTHORS
|
||||
|
||||
https://git.earne.link/earnestma/aptpkg
|
|
@ -0,0 +1,64 @@
|
|||
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 <email@example.org>
|
||||
```
|
||||
|
||||
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
|
||||
- customcontrol: This is optional and only if extra information needs to be
|
||||
added to the control file
|
||||
|
||||
## SOURCE
|
||||
|
||||
Provide URL(s) pointing to the file(s) to download
|
||||
|
||||
## SHA512SUMS
|
||||
|
||||
The output of `sha512sum filename` that will be used to verify. Write SKIP if
|
||||
you do not want any verification done.
|
||||
|
||||
## 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)
|
||||
|
||||
Some good packaging file examples: https://git.earne.link/earnestma/aptpkg-pkgs
|
||||
|
||||
# AUTHORS
|
||||
|
||||
https://git.earne.link/earnestma/aptpkg
|
Loading…
Reference in New Issue