Files
rlogg/packaging/README.md

7.0 KiB

Packaging Guide

This directory contains packaging files and installation scripts for RLogg on different platforms.

Directory Structure

packaging/
├── linux/
│   ├── rlogg.desktop          # XDG desktop entry file
│   ├── text-x-log.xml         # MIME type definition for .log files
│   └── install.sh             # Linux installation script
├── windows/
│   ├── file-association.reg   # Windows registry file for manual setup
│   └── install.ps1            # PowerShell installation script
└── README.md                  # This file

Building for Distribution

Linux

  1. Build the release binary:

    cargo build --release
    
  2. Test the installation script:

    cd packaging/linux
    ./install.sh
    
  3. Create a distribution package:

    # Create a tarball
    cd target/release
    tar -czf rlogg-linux-x64.tar.gz rlogg ../../packaging/linux/*
    

Windows

  1. Build the release binary:

    cargo build --release
    
  2. Test the installation script:

    cd packaging\windows
    powershell -ExecutionPolicy Bypass -File install.ps1
    
  3. Create a distribution package:

    # Create a ZIP file
    Compress-Archive -Path target\release\rlogg.exe, packaging\windows\* -DestinationPath rlogg-windows-x64.zip
    

Distribution Packages

Linux Packages

DEB Package (Debian/Ubuntu)

Create a debian/ directory structure for building .deb packages:

mkdir -p debian/usr/local/bin
mkdir -p debian/usr/share/applications
mkdir -p debian/usr/share/mime/packages

cp target/release/rlogg debian/usr/local/bin/
cp packaging/linux/rlogg.desktop debian/usr/share/applications/
cp packaging/linux/text-x-log.xml debian/usr/share/mime/packages/

# Create DEBIAN control file
mkdir -p debian/DEBIAN
cat > debian/DEBIAN/control <<EOF
Package: rlogg
Version: 0.3.1
Section: utils
Priority: optional
Architecture: amd64
Maintainer: Your Name <your.email@example.com>
Description: Fast log file viewer
 A fast log file viewer with search, filtering, and highlighting capabilities
EOF

# Build the package
dpkg-deb --build debian rlogg_0.3.1_amd64.deb

AppImage

For universal Linux distribution:

# Install linuxdeploy
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy-x86_64.AppImage

# Create AppDir structure
mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/share/applications
mkdir -p AppDir/usr/share/mime/packages

cp target/release/rlogg AppDir/usr/bin/
cp packaging/linux/rlogg.desktop AppDir/usr/share/applications/
cp packaging/linux/text-x-log.xml AppDir/usr/share/mime/packages/

# Build AppImage
./linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage

Windows Packages

NSIS Installer

Install NSIS and create an installer script:

!define APPNAME "RLogg"
!define COMPANYNAME "Your Company"
!define DESCRIPTION "Fast log file viewer"
!define VERSIONMAJOR 0
!define VERSIONMINOR 3
!define VERSIONBUILD 1

RequestExecutionLevel user

Name "${APPNAME}"
Icon "path\to\icon.ico"
OutFile "rlogg-setup.exe"
InstallDir "$LOCALAPPDATA\Programs\${APPNAME}"

Section "Install"
  SetOutPath $INSTDIR
  File "target\release\rlogg.exe"

  WriteUninstaller "$INSTDIR\Uninstall.exe"

  # Create file association
  WriteRegStr HKCU "Software\Classes\.log" "" "RLogg.LogFile"
  WriteRegStr HKCU "Software\Classes\RLogg.LogFile\shell\open\command" "" '"$INSTDIR\rlogg.exe" "%1"'
SectionEnd

Section "Uninstall"
  Delete "$INSTDIR\rlogg.exe"
  Delete "$INSTDIR\Uninstall.exe"
  RMDir "$INSTDIR"

  DeleteRegKey HKCU "Software\Classes\.log"
  DeleteRegKey HKCU "Software\Classes\RLogg.LogFile"
SectionEnd

Testing File Associations

Linux Testing

  1. Create a test log file:

    echo "Test log entry" > /tmp/test.log
    
  2. Test command-line opening:

    rlogg /tmp/test.log
    
  3. Test XDG opening:

    xdg-open /tmp/test.log
    
  4. Test in file manager:

    • Navigate to /tmp/ in your file manager
    • Double-click test.log
    • Right-click → Open With → RLogg
  5. Test multiple files:

    echo "Log 1" > /tmp/test1.log
    echo "Log 2" > /tmp/test2.log
    rlogg /tmp/test1.log /tmp/test2.log
    

Windows Testing

  1. Create a test log file:

    "Test log entry" | Out-File -FilePath "$env:TEMP\test.log"
    
  2. Test command-line opening:

    & "$env:LOCALAPPDATA\Programs\RLogg\rlogg.exe" "$env:TEMP\test.log"
    
  3. Test in File Explorer:

    • Open File Explorer
    • Navigate to %TEMP%
    • Double-click test.log
    • Right-click → Open with → RLogg
  4. Test multiple files:

    "Log 1" | Out-File -FilePath "$env:TEMP\test1.log"
    "Log 2" | Out-File -FilePath "$env:TEMP\test2.log"
    & "$env:LOCALAPPDATA\Programs\RLogg\rlogg.exe" "$env:TEMP\test1.log" "$env:TEMP\test2.log"
    

Platform-Specific Notes

Linux

  • Desktop environments tested:

    • GNOME 40+
    • KDE Plasma 5.20+
    • XFCE 4.16+
    • i3/sway (via xdg-utils)
  • Dependencies:

    • xdg-utils for update-desktop-database and update-mime-database
    • Usually pre-installed on most distributions
  • Wayland compatibility:

    • Tested and working on Wayland sessions
    • File associations work the same as X11

Windows

  • Tested on:

    • Windows 10 (version 1909+)
    • Windows 11
  • Registry location:

    • User-local: HKEY_CURRENT_USER\Software\Classes\
    • No admin rights required
  • Antivirus:

    • Some antivirus software may flag unsigned executables
    • Consider code signing for production releases

CI/CD Integration

GitHub Actions Example

name: Build and Package

on:
  release:
    types: [created]

jobs:
  build-linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build
        run: cargo build --release
      - name: Package
        run: |
          cd target/release
          tar -czf rlogg-linux-x64.tar.gz rlogg ../../packaging/linux/*
      - name: Upload
        uses: actions/upload-artifact@v3
        with:
          name: rlogg-linux
          path: target/release/rlogg-linux-x64.tar.gz

  build-windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build
        run: cargo build --release
      - name: Package
        run: |
          Compress-Archive -Path target\release\rlogg.exe, packaging\windows\* -DestinationPath rlogg-windows-x64.zip
      - name: Upload
        uses: actions/upload-artifact@v3
        with:
          name: rlogg-windows
          path: rlogg-windows-x64.zip

Troubleshooting

See docs/FILE_ASSOCIATIONS.md for detailed troubleshooting guides.

Contributing

When adding new packaging formats or improving existing ones:

  1. Test on the target platform
  2. Update this README with clear instructions
  3. Add troubleshooting steps if needed
  4. Submit a pull request with test results