Files
telfax/deployment/install.sh
T
Warren 55bca92691 V1.0: Class 1 fax — real-world 4-page send to external number confirmed
Core features:
- Class 1 T.30 protocol: full send/receive implementation
- HDLC: DLE-stuffing, FCS strip, USR5637 bit-reversal handling
- T.4 MH encoder/decoder (1728px A4 standard)
- Document pipeline: PDF (Ghostscript), PNG, TIFF input
- Width clamping: US Letter 1734px → 1728px fax standard
- Cover page: CJK rasterization (TW/CN/JP/EN), TIFF + HTML output
- OCR verification: Tesseract 5 with eng+chi_tra, CJK space-tolerant
- API server (axum): health, send, jobs, cover, retry, cancel
- Background worker: auto-poll queue, speed fallback, retry policy
- Modem detection, pool management

Real-world test results (2026-07-23):
- V90 → 25153038: 4 pages, V.17 12000 bps, 2:33 ✅
- USR5637 → 25153038: 4 pages, V.17 12000 bps, 2:26 ✅
- Both faxes confirmed received on remote machine

Tested: loopback (100% pixel match), multi-page, all input formats,
cover pages, OCR verify, API endpoints, worker processing.
13 unit tests pass, 0 new clippy warnings.
2026-07-24 18:47:15 +08:00

64 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
# Telfax Enterprise Fax Server Installation Script
#
# Usage: sudo ./install.sh
set -e
INSTALL_DIR="/opt/telfax"
DATA_DIR="/var/lib/telfax"
LOG_DIR="/var/log/telfax"
CONFIG_FILE="$INSTALL_DIR/config.toml"
echo "=== Telfax Enterprise Fax Server Installation ==="
# Create user and group
echo "Creating telfax user..."
if ! id -u telfax &>/dev/null; then
useradd -r -s /bin/false telfax
fi
# Create directories
echo "Creating directories..."
mkdir -p "$INSTALL_DIR/bin"
mkdir -p "$DATA_DIR"
mkdir -p "$LOG_DIR"
# Build the binary
echo "Building telfax..."
cd "$(dirname "$0")/.."
cargo build --release
cp target/release/telfax "$INSTALL_DIR/bin/"
# Copy default config if not exists
if [ ! -f "$CONFIG_FILE" ]; then
echo "Copying default configuration..."
cp deployment/config.toml "$CONFIG_FILE"
echo "IMPORTANT: Edit $CONFIG_FILE and set your authentication tokens!"
fi
# Install systemd service
echo "Installing systemd service..."
cp deployment/telfax.service /etc/systemd/system/
systemctl daemon-reload
# Set permissions
echo "Setting permissions..."
chown -R telfax:telfax "$INSTALL_DIR"
chown -R telfax:telfax "$DATA_DIR"
chown -R telfax:telfax "$LOG_DIR"
chmod 600 "$CONFIG_FILE"
echo ""
echo "=== Installation Complete ==="
echo ""
echo "Configuration file: $CONFIG_FILE"
echo "Data directory: $DATA_DIR"
echo "Log directory: $LOG_DIR"
echo ""
echo "Next steps:"
echo " 1. Edit $CONFIG_FILE and configure your modems and auth tokens"
echo " 2. systemctl enable telfax"
echo " 3. systemctl start telfax"
echo " 4. journalctl -u telfax -f # View logs"
echo ""