From 5e8a900203cf4dd771c0c447185ea5e01f9cd93a Mon Sep 17 00:00:00 2001 From: Andi Hechtbauer Date: Fri, 6 Dec 2024 09:57:26 +0100 Subject: [PATCH] packaging: add debian scripts and manpage --- debian/control.template | 9 +++++++++ debian/postinst | 10 ++++++++++ debian/ringlog.1 | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 debian/control.template create mode 100755 debian/postinst create mode 100644 debian/ringlog.1 diff --git a/debian/control.template b/debian/control.template new file mode 100644 index 0000000..3162b54 --- /dev/null +++ b/debian/control.template @@ -0,0 +1,9 @@ +Package: ringlog +Version: @VERSION@ +Section: utils +Priority: optional +Architecture: amd64 +Maintainer: Andi Hechtbauer +Description: pipe-friendly utility to manage log files by capping size or line count +Installed-Size: 2200237 +Depends: libc6 (>= 2.31), systemd diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..1da9af2 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,10 @@ +#!/bin/bash +# postinst script for ringlog + +# Install the man page +if [ -f debian/ringlog.1 ]; then + install -m 644 debian/ringlog.1 /usr/share/man/man1/ringlog.1 + mandb -q || true +fi + +exit 0 diff --git a/debian/ringlog.1 b/debian/ringlog.1 new file mode 100644 index 0000000..520ebbd --- /dev/null +++ b/debian/ringlog.1 @@ -0,0 +1,39 @@ +.TH RINGLOG 1 "December 2024" "ringlog 1.0" "User Commands" +.SH NAME +ringlog – pipe-friendly utility to manage log files by capping size or line count. + +.SH SYNOPSIS +.B ringlog +.RI [ options ] + +.SH DESCRIPTION +.B ringlog +is a utility designed to cap log file size or line count while being pipe-friendly. It reads input from stdin and writes to a specified log file, ensuring the log does not grow beyond a defined size or number of lines. + +.SH OPTIONS +.TP +.B \-s +Maximum size of the log file in bytes. +.TP +.B \-l +Maximum number of lines in the log file. +.TP +.B \-f +Path to the log file where the input will be appended. +.TP +.B \-v +Enable verbose output. Prints information about log actions to stderr. + +.SH USAGE +.B ringlog +is primarily used to cap log output from scripts or cron jobs to ensure log files remain manageable. + +Example usage: + +.nf + ./my_script.sh | ringlog -l 1000 -f /var/log/my_log.log +.fi + +.SH AUTHOR Written by anti-spin. + +.SH LICENSE MIT License.