systools

System management tools
git clone git://git.meso-star.fr/systools.git
Log | Files | Refs | README | LICENSE

commit 575e1cadf84f3b63a5e4fe08f845f3e68afc6ec5
parent 89ec04531f10d2bb1a1a8447614ea7884dfe88fb
Author: vaplv <vaplv@posteo.net>
Date:   Sun, 24 Nov 2024 22:12:17 +0100

Write the ecc man page

Diffstat:
MMakefile | 5+++++
Aecc.1 | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -23,18 +23,23 @@ default: lint: shellcheck -o all backup shellcheck -o all ecc + mandoc -T lint ecc.1 mandoc -T lint backup.8 install: mkdir -p $(DESTDIR)$(BINPREFIX) + mkdir -p $(DESTDIR)$(MANPREFIX)/man1/ mkdir -p $(DESTDIR)$(MANPREFIX)/man8/ cp backup ecc $(DESTDIR)$(BINPREFIX) chmod 755 $(DESTDIR)$(BINPREFIX)/backup chmod 755 $(DESTDIR)$(BINPREFIX)/ecc + cp ecc.1 $(DESTDIR)$(MANPREFIX)/man1/ + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/ecc.1 cp backup.8 $(DESTDIR)$(MANPREFIX)/man8/ chmod 644 $(DESTDIR)$(MANPREFIX)/man8/backup.8 uninstall: rm -f $(DESTDIR)$(BINPREFIX)/backup rm -f $(DESTDIR)$(BINPREFIX)/ecc + rm -f $(DESTDIR)$(MANPREFIX)/man1/ecc.1 rm -f $(DESTDIR)$(MANPREFIX)/man8/backup.8 diff --git a/ecc.1 b/ecc.1 @@ -0,0 +1,103 @@ +.\" Copyright (C) 2023, 2024 Vincent Forest (vaplv@posteo.net) +.\" +.\" This program is free software: you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation, either version 3 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program. If not, see <http://www.gnu.org/licenses/>. +.Dd November 24, 2024 +.Dt ECC 1 +.Os +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh NAME +.Nm ecc +.Nd manage file error correction codes for verification/repair +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh SYNOPSIS +.Nm +.Cm create +.Ar file +.Nm +.Cm verify +.Ar file +.Nm +.Cm repair +.Ar file +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh DESCRIPTION +.Nm +calculates the error correction code for files to check their integrity +and repair them in the event of corruption. +Internally, ecc simply invokes +.Xr par2 1 +and adds no new functionality to it. +Its sole purpose is to define a policy for using +.Xr par2 1 +to simplify its use. +.Pp +The error correction code for a file calculated by +.Nm +is systematically stored in hidden files, alongside the file from which +it is taken. +In this way, the correction code data remains close to its associated +file without being too invasive. +.Pp +In addition to the +.Xr par2 1 +messages displayed on standard output, +.Nm +also lists error messages on standard error, providing a simple way of +listing files whose error code calculation, verification or repair has +failed. +The error messages are formated as below: +.Bd -literal -offset Ds +"ecc %s error: %s\\n", command, filepath +.Ed +.Pp +with +.Ar command +the action +.Nm +performed and +.Ar filepath +the path to the file on which the error occurred. +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh EXIT STATUS +.Ex -std +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh EXAMPLES +Calculate the error correction code for all files found recursively in +the current directory hierarchy, with the exception of error correction +code files that have already been created. +Prints errors in the temporary +.Pa log.err +file: +.Bd -literal -offset Ds +find . \\( -type f ! -name "*.par2" \\) \\ +-exec ecc create {} \\; 2> /tmp/log.err +.Ed +.Pp +Check all the files in the current directory: +.Bd -literal -offset Ds +find . \\( ! -path . -prune -type f | -name "*.par2" \\) \\ +-exec ecc verify {} \\; 2> /tmp/log.err +.Ed +.Pp +Repair all files previously detected as corrupt and listed in the +temporary +.Pa log.err +file: +.Bd -literal -offset Ds +sed -n 's/^ecc verify error: \\(.\\{1,\\}\\)$/\\1/p' /tmp/log.err \\ +| xargs -I{} ecc repair "{}" +.Ed +.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +.Sh SEE ALSO +.Xr par2 1