Files
docker_file_analysis/scripts/import-remnux-cheatsheets.sh
Tobias Kessels b98aaee3e0 Major repository cleanup and enhancement
- Reorganize documentation: moved old docs to docs/ directory
- Add comprehensive README.md with build options and usage guide
- Add detailed CONTRIBUTING.md with help content management guide
- Create Makefile for automated building and testing
- Add Dockerfile.scratch for building from Ubuntu 20.04 base
- Enhance all Dockerfiles with PowerShell + PSScriptAnalyzer
- Add modern shells: zsh (with plugins) and fish (with config)
- Add modern CLI tools: fd-find, ripgrep, fzf
- Create comprehensive help system with cheat/TLDR/fish completions
- Add helper scripts for help content management and coverage checking
- Fix Dockerfile.remnux script references
- Support three build variants: upstream (REMnux), scratch (Ubuntu), kali

Build options:
  - make build-upstream: Fast, uses REMnux upstream (recommended)
  - make build-scratch: Full control, builds from Ubuntu 20.04
  - make build-kali: Legacy Kali Linux base

Features:
  - PowerShell with PSScriptAnalyzer module
  - Modern shells (zsh, fish) with custom configurations
  - Enhanced help system (cheat sheets, TLDR pages, fish completions)
  - Help coverage checking and bulk import tools
  - Comprehensive documentation for users and contributors
2025-10-01 11:45:56 +02:00

45 lines
1.4 KiB
Bash

#!/usr/bin/env bash
# import-remnux-cheatsheets.sh
# Wrapper to import a consolidated markdown cheatsheet (remnux-tldr-cheatsheet.md)
# and generate missing cheat sheets (/opt/cheatsheets/personal/<tool>) and
# tldr pages (/home/remnux/.local/share/tldr/pages/common/<tool>.md) inside the container.
#
# Usage (inside container):
# import-remnux-cheatsheets.sh /data/remnux-tldr-cheatsheet.md
# Or from host:
# docker run --rm -v "$(pwd):/data" tabledevil/file-analysis:streamlined \
# bash -lc "/usr/local/bin/import-remnux-cheatsheets.sh /data/remnux-tldr-cheatsheet.md && fhelp examples"
set -euo pipefail
SCRIPT_DIR="/usr/local/bin"
CONVERTER="$SCRIPT_DIR/convert-remnux-cheats.py"
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <path-to-remnux-tldr-cheatsheet.md> [--dry-run]" >&2
exit 2
fi
INPUT_MD="$1"; shift || true
EXTRA_ARGS=("$@")
if [[ ! -f "$INPUT_MD" ]]; then
echo "Input file not found: $INPUT_MD" >&2
exit 2
fi
# Ensure directories exist
mkdir -p /opt/cheatsheets/personal
mkdir -p /home/remnux/.local/share/tldr/pages/common
# Run the converter
python3 "$CONVERTER" --in "$INPUT_MD" \
--cheat-dir /opt/cheatsheets/personal \
--tldr-dir /home/remnux/.local/share/tldr/pages/common \
--only-missing "${EXTRA_ARGS[@]}"
# Fix ownership for remnux user
chown -R remnux:remnux /opt/cheatsheets /home/remnux/.local/share/tldr || true
echo "✅ Import complete. Try: fhelp examples"