79 lines
2.5 KiB
Bash
Executable File
79 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Install rlogg and create file association for .log files
|
|
# This script installs to user-local directories (~/.local/) and does not require sudo
|
|
|
|
set -e
|
|
|
|
echo "Installing RLogg Log Viewer..."
|
|
echo ""
|
|
|
|
# Determine the directory where this script is located
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
# Check if rlogg binary exists
|
|
if [ ! -f "$SCRIPT_DIR/../../target/release/rlogg" ]; then
|
|
echo "Error: rlogg binary not found at $SCRIPT_DIR/../../target/release/rlogg"
|
|
echo "Please build the project first with: cargo build --release"
|
|
exit 1
|
|
fi
|
|
|
|
# User-local installation (no sudo required)
|
|
echo "Installing binary to ~/.local/bin/..."
|
|
mkdir -p ~/.local/bin
|
|
cp "$SCRIPT_DIR/../../target/release/rlogg" ~/.local/bin/
|
|
chmod +x ~/.local/bin/rlogg
|
|
|
|
# Install desktop file with correct path
|
|
echo "Installing desktop file..."
|
|
mkdir -p ~/.local/share/applications
|
|
|
|
# Create desktop file with absolute path to the binary
|
|
cat > ~/.local/share/applications/rlogg.desktop <<EOF
|
|
[Desktop Entry]
|
|
Version=1.0
|
|
Type=Application
|
|
Name=RLogg
|
|
GenericName=Log Viewer
|
|
Comment=Fast log file viewer with search, filtering, and highlighting
|
|
Exec=$HOME/.local/bin/rlogg %F
|
|
Icon=rlogg
|
|
Terminal=false
|
|
Categories=Development;Utility;
|
|
MimeType=text/x-log;
|
|
Keywords=log;viewer;search;filter;
|
|
EOF
|
|
|
|
# Update MIME database
|
|
echo "Installing MIME type definition..."
|
|
mkdir -p ~/.local/share/mime/packages
|
|
cp "$SCRIPT_DIR/text-x-log.xml" ~/.local/share/mime/packages/
|
|
|
|
# Update desktop and MIME databases
|
|
echo "Updating databases..."
|
|
if command -v update-desktop-database &> /dev/null; then
|
|
update-desktop-database ~/.local/share/applications 2>/dev/null || true
|
|
fi
|
|
|
|
if command -v update-mime-database &> /dev/null; then
|
|
update-mime-database ~/.local/share/mime 2>/dev/null || true
|
|
fi
|
|
|
|
echo ""
|
|
echo "Installation complete!"
|
|
echo ""
|
|
echo "RLogg has been installed to: ~/.local/bin/rlogg"
|
|
echo ""
|
|
echo "IMPORTANT: Make sure ~/.local/bin is in your PATH."
|
|
echo "Add this line to your ~/.bashrc or ~/.zshrc if it's not already there:"
|
|
echo ' export PATH="$HOME/.local/bin:$PATH"'
|
|
echo ""
|
|
echo "File associations have been configured for .log files."
|
|
echo "You may need to log out and log back in for file associations to take effect."
|
|
echo ""
|
|
echo "To uninstall, run:"
|
|
echo " rm ~/.local/bin/rlogg"
|
|
echo " rm ~/.local/share/applications/rlogg.desktop"
|
|
echo " rm ~/.local/share/mime/packages/text-x-log.xml"
|
|
echo " update-desktop-database ~/.local/share/applications"
|
|
echo " update-mime-database ~/.local/share/mime"
|