Add Debian package building, add manpage, release v1.0.0
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
|
||||
# Generated index files
|
||||
**/index.html
|
||||
coverage.*
|
||||
|
||||
# Debian packaging artifacts
|
||||
debian/.debhelper/
|
||||
|
||||
19
Makefile
19
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: build clean wipe test help
|
||||
.PHONY: build clean wipe test help sync-version pkg-deb
|
||||
|
||||
# Default target
|
||||
all: build
|
||||
@@ -27,6 +27,8 @@ clean:
|
||||
@echo "Cleaning build artifacts..."
|
||||
rm -f s3-genindex
|
||||
rm -f coverage.out coverage.html
|
||||
rm -rf debian/s3-genindex debian/files debian/*.substvars debian/debhelper-build-stamp
|
||||
rm -rf debian/.gocache debian/go
|
||||
find . -name index.html -delete
|
||||
@echo "Clean complete"
|
||||
|
||||
@@ -73,6 +75,19 @@ bench:
|
||||
@echo "Running benchmarks..."
|
||||
go test -bench=. ./...
|
||||
|
||||
# Sync version from debian/changelog to source code
|
||||
sync-version:
|
||||
@echo "Syncing version..."
|
||||
@version=$$(head -1 debian/changelog | sed -n 's/.*(\([^)]*\)).*/\1/p'); \
|
||||
sed -i "s/const Version = .*/const Version = \"$$version\"/" cmd/s3-genindex/main.go; \
|
||||
echo "Updated version to $$version"
|
||||
|
||||
# Build Debian package
|
||||
pkg-deb: sync-version
|
||||
@echo "Building Debian package..."
|
||||
fakeroot dpkg-buildpackage -us -uc -b
|
||||
@echo "Debian package build complete"
|
||||
|
||||
# Show help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@@ -87,4 +102,6 @@ help:
|
||||
@echo " lint - Lint code (requires golangci-lint)"
|
||||
@echo " check - Run fmt, vet, lint, and test"
|
||||
@echo " bench - Run benchmarks"
|
||||
@echo " sync-version - Sync version from debian/changelog to source"
|
||||
@echo " pkg-deb - Build Debian package"
|
||||
@echo " help - Show this help message"
|
||||
|
||||
@@ -20,6 +20,9 @@ import (
|
||||
"git.ipng.ch/ipng/s3-genindex/internal/indexgen"
|
||||
)
|
||||
|
||||
// Version is the application version (sync'd from debian/changelog)
|
||||
const Version = "1.0.0-1"
|
||||
|
||||
// S3Config holds S3 connection configuration
|
||||
type S3Config struct {
|
||||
Endpoint string
|
||||
@@ -348,6 +351,7 @@ func main() {
|
||||
var dryRun bool
|
||||
var showIndexFiles bool
|
||||
var watermarkURL string
|
||||
var showVersion bool
|
||||
|
||||
// Set defaults
|
||||
opts.DirAppend = true
|
||||
@@ -363,6 +367,7 @@ func main() {
|
||||
flag.BoolVar(&opts.Verbose, "v", false, "verbosely list every processed file")
|
||||
flag.BoolVar(&showIndexFiles, "i", false, "show index.html files in directory listings")
|
||||
flag.StringVar(&watermarkURL, "wm", "", "watermark logo URL to display in top left corner")
|
||||
flag.BoolVar(&showVersion, "version", false, "show version information")
|
||||
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, "Generate directory index files (recursive is ON, hidden files included by default).\n")
|
||||
@@ -381,6 +386,12 @@ func main() {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// Handle version flag
|
||||
if showVersion {
|
||||
fmt.Printf("s3-genindex version %s\n", Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// Check mutual exclusion and that exactly one option is provided
|
||||
if directory == "" && s3URL == "" {
|
||||
fmt.Fprintf(os.Stderr, "Error: Either -d <directory> or -s3 <url> must be specified.\n\n")
|
||||
|
||||
8
debian/changelog
vendored
Normal file
8
debian/changelog
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
s3-genindex (1.0.0-1) unstable; urgency=medium
|
||||
|
||||
* Initial release
|
||||
* HTML directory index generator for local and S3 storage
|
||||
* Support for file type icons and responsive design
|
||||
* Watermark support and hierarchical S3 navigation
|
||||
|
||||
-- Pim van Pelt <pim@ipng.ch> Tue, 03 Dec 2024 14:30:00 +0100
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
10
|
||||
21
debian/control
vendored
Normal file
21
debian/control
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
Source: s3-genindex
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Pim van Pelt <pim@ipng.ch>
|
||||
Build-Depends: debhelper (>= 10), golang-go
|
||||
Standards-Version: 4.1.2
|
||||
Homepage: https://git.ipng.ch/ipng/s3-genindex
|
||||
|
||||
Package: s3-genindex
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: HTML directory index generator for local and S3 storage
|
||||
Generate HTML directory indexes with file type icons and responsive design
|
||||
for local directories and S3-compatible storage. This is particularly useful
|
||||
for S3 buckets that are publicly readable.
|
||||
.
|
||||
Features include local directory indexing with recursive traversal,
|
||||
S3-compatible storage support (MinIO, AWS S3, etc.), hierarchical directory
|
||||
structure for S3 buckets, responsive HTML design with file type icons,
|
||||
dry run mode for testing, flexible filtering with glob patterns and regex
|
||||
exclusion, and hidden file control.
|
||||
2
debian/install
vendored
Normal file
2
debian/install
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
s3-genindex usr/bin
|
||||
docs/s3-genindex.1 usr/share/man/man1
|
||||
20
debian/rules
vendored
Executable file
20
debian/rules
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=direct
|
||||
export GOSUMDB=off
|
||||
export GOCACHE=$(CURDIR)/debian/.gocache
|
||||
export GOPATH=$(CURDIR)/debian/go
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
go build -o s3-genindex ./cmd/s3-genindex
|
||||
|
||||
override_dh_auto_test:
|
||||
go test ./...
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/s3-genindex/usr/bin
|
||||
cp s3-genindex debian/s3-genindex/usr/bin/
|
||||
126
docs/s3-genindex.1
Normal file
126
docs/s3-genindex.1
Normal file
@@ -0,0 +1,126 @@
|
||||
.TH S3-GENINDEX 1 "December 2024" "s3-genindex 1.0.0" "User Commands"
|
||||
.SH NAME
|
||||
s3-genindex \- Generate HTML directory indexes for local directories and S3 storage
|
||||
.SH SYNOPSIS
|
||||
.B s3-genindex
|
||||
[\fIOPTIONS\fR]
|
||||
.SH DESCRIPTION
|
||||
.B s3-genindex
|
||||
generates HTML directory indexes with file type icons and responsive design for local directories and S3-compatible storage. This is particularly useful for S3 buckets that are publicly readable.
|
||||
|
||||
The tool creates hierarchical directory structures with responsive HTML pages that include file type icons, sorting capabilities, and optional watermark branding.
|
||||
|
||||
By default, recursive processing is enabled, hidden files are included, and the output file is named 'index.html' with directory href appending enabled.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR \-d " \fIDIRECTORY\fR"
|
||||
Process local directory. Mutually exclusive with \-s3.
|
||||
|
||||
.TP
|
||||
.BR \-s3 " \fIURL\fR"
|
||||
Process S3-compatible storage. URL format: http://host:port/bucket or https://host/bucket.
|
||||
Mutually exclusive with \-d.
|
||||
|
||||
.TP
|
||||
.BR \-f " \fIGLOB\fR"
|
||||
Only include files matching glob pattern (default: "*").
|
||||
Example: "*.py" to include only Python files.
|
||||
|
||||
.TP
|
||||
.BR \-n
|
||||
Dry run mode. Show what would be written without actually creating files.
|
||||
|
||||
.TP
|
||||
.BR \-x " \fIREGEX\fR"
|
||||
Exclude files matching regular expression pattern.
|
||||
|
||||
.TP
|
||||
.BR \-v
|
||||
Verbose mode. List every processed file during operation.
|
||||
|
||||
.TP
|
||||
.BR \-i
|
||||
Show index.html files in directory listings (normally hidden).
|
||||
|
||||
.TP
|
||||
.BR \-wm " \fIURL\fR"
|
||||
Watermark logo URL to display in top left corner of generated pages.
|
||||
|
||||
.TP
|
||||
.BR \-\-version
|
||||
Show version information and exit.
|
||||
|
||||
.SH ENVIRONMENT
|
||||
For S3 operations, the following environment variables must be set:
|
||||
|
||||
.TP
|
||||
.B AWS_ACCESS_KEY_ID
|
||||
S3 access key ID for authentication.
|
||||
|
||||
.TP
|
||||
.B AWS_SECRET_ACCESS_KEY
|
||||
S3 secret access key for authentication.
|
||||
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Process a local directory:
|
||||
.B s3-genindex -d /var/www/html
|
||||
|
||||
.TP
|
||||
Process an S3 bucket with verbose output:
|
||||
.B s3-genindex -v -s3 http://minio.example.com:9000/my-bucket
|
||||
|
||||
.TP
|
||||
Dry run with file filtering:
|
||||
.B s3-genindex -n -f "*.log" -d /var/log
|
||||
|
||||
.TP
|
||||
S3 processing with watermark and filtering:
|
||||
.B s3-genindex -v -f "*.jpg" -wm https://example.com/logo.svg -s3 https://s3.amazonaws.com/photos
|
||||
|
||||
.TP
|
||||
Show version information:
|
||||
.B s3-genindex --version
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B index.html
|
||||
Default output filename for generated directory indexes.
|
||||
|
||||
.SH EXIT STATUS
|
||||
.TP
|
||||
.B 0
|
||||
Success
|
||||
.TP
|
||||
.B 1
|
||||
Error (invalid arguments, missing credentials, file system errors, etc.)
|
||||
|
||||
.SH FEATURES
|
||||
.IP \(bu 2
|
||||
Local directory indexing with recursive traversal
|
||||
.IP \(bu 2
|
||||
S3-compatible storage support (MinIO, AWS S3, etc.)
|
||||
.IP \(bu 2
|
||||
Hierarchical directory structure for S3 buckets
|
||||
.IP \(bu 2
|
||||
Responsive HTML design with file type icons
|
||||
.IP \(bu 2
|
||||
Dry run mode for testing
|
||||
.IP \(bu 2
|
||||
Flexible filtering with glob patterns and regex exclusion
|
||||
.IP \(bu 2
|
||||
Hidden file control and index.html visibility options
|
||||
.IP \(bu 2
|
||||
Watermark support for branding
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR ls (1),
|
||||
.BR find (1),
|
||||
.BR tree (1)
|
||||
|
||||
.SH AUTHOR
|
||||
Pim van Pelt <pim@ipng.nl>
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 2024 Pim van Pelt. Licensed under the MIT License.
|
||||
Reference in New Issue
Block a user