Add comprehensive installation system with install.sh and INSTALLATION.md

The new installation system provides a painless, one-command setup for all users:

install.sh Enhancements:
- 5-step installation wizard with visual progress indicators
- Auto-detects bash/zsh shell and updates rc files appropriately
- Automatically adds PATH exports for system-wide or user-local installation
- Automatically sources alias.sh for convenience commands
- Clear instructions for next steps
- Better error messages and validation
- Supports both sudo and non-sudo installation paths
- Default to user-local installation (no sudo required)

INSTALLATION.md Documentation:
- Comprehensive installation guide for all user types
- Multiple installation options (system-wide vs user-local)
- Detailed troubleshooting section
- Manual installation instructions for advanced users
- Platform-specific notes (Linux, macOS, Windows WSL)
- Uninstallation instructions
- Verification steps

README.md Updates:
- Updated Quick Start section to reference install.sh
- Added INSTALLATION.md to documentation index
- Clear distinction between user and developer setup

This enables users to set up VideoTools with:
  bash install.sh
  source ~/.bashrc
  VideoTools

No manual shell configuration needed!
This commit is contained in:
Stu Leak 2025-11-29 20:17:18 -05:00
parent d327d7f65e
commit 5d22bc306c
3 changed files with 465 additions and 36 deletions

359
INSTALLATION.md Normal file
View File

@ -0,0 +1,359 @@
# VideoTools Installation Guide
This guide will help you install VideoTools with minimal setup.
## Quick Start (Recommended for Most Users)
### One-Command Installation
```bash
bash install.sh
```
That's it! The installer will:
1. ✅ Check your Go installation
2. ✅ Build VideoTools from source
3. ✅ Install the binary to your system
4. ✅ Set up shell aliases automatically
5. ✅ Configure your shell environment
### After Installation
Reload your shell:
```bash
# For bash users:
source ~/.bashrc
# For zsh users:
source ~/.zshrc
```
Then start using VideoTools:
```bash
VideoTools
```
---
## Installation Options
### Option 1: System-Wide Installation (Recommended for Shared Computers)
```bash
bash install.sh
# Select option 1 when prompted
# Enter your password if requested
```
**Advantages:**
- ✅ Available to all users on the system
- ✅ Binary in standard system path
- ✅ Professional setup
**Requirements:**
- Sudo access (for system-wide installation)
---
### Option 2: User-Local Installation (Recommended for Personal Use)
```bash
bash install.sh
# Select option 2 when prompted (default)
```
**Advantages:**
- ✅ No sudo required
- ✅ Works immediately
- ✅ Private to your user account
- ✅ No administrator needed
**Requirements:**
- None - works on any system!
---
## What the Installer Does
The `install.sh` script performs these steps:
### Step 1: Go Verification
- Checks if Go 1.21+ is installed
- Displays Go version
- Exits with helpful error message if not found
### Step 2: Build
- Cleans previous builds
- Downloads dependencies
- Compiles VideoTools binary
- Validates build success
### Step 3: Installation Path Selection
- Presents two options:
- System-wide (`/usr/local/bin`)
- User-local (`~/.local/bin`)
- Creates directories if needed
### Step 4: Binary Installation
- Copies binary to selected location
- Sets proper file permissions (755)
- Validates installation
### Step 5: Shell Environment Setup
- Detects your shell (bash/zsh)
- Adds VideoTools installation path to PATH
- Sources alias script for convenience commands
- Adds to appropriate rc file (`.bashrc` or `.zshrc`)
---
## Convenience Commands
After installation, you'll have access to:
```bash
VideoTools # Run VideoTools directly
VideoToolsRebuild # Force rebuild from source
VideoToolsClean # Clean build artifacts and cache
```
---
## Requirements
### Essential
- **Go 1.21 or later** - https://go.dev/dl/
- **Bash or Zsh** shell
### Optional
- **FFmpeg** (for actual video encoding)
```bash
ffmpeg -version
```
### System
- Linux, macOS, or WSL (Windows Subsystem for Linux)
- At least 2 GB free disk space
- Stable internet connection (for dependencies)
---
## Troubleshooting
### "Go is not installed"
**Solution:** Install Go from https://go.dev/dl/
```bash
# After installing Go, verify:
go version
```
### Build Failed
**Solution:** Check build log for specific errors:
```bash
bash install.sh
# Look for error messages in the build log output
```
### Installation Path Not in PATH
If you see this warning:
```
Warning: ~/.local/bin is not in your PATH
```
**Solution:** Reload your shell:
```bash
source ~/.bashrc # For bash
source ~/.zshrc # For zsh
```
Or manually add to your shell configuration:
```bash
# Add this line to ~/.bashrc or ~/.zshrc:
export PATH="$HOME/.local/bin:$PATH"
```
### "Permission denied" on binary
**Solution:** Ensure file has correct permissions:
```bash
chmod +x ~/.local/bin/VideoTools
# or for system-wide:
ls -l /usr/local/bin/VideoTools
```
### Aliases Not Working
**Solution:** Ensure alias script is sourced:
```bash
# Check if this line is in your ~/.bashrc or ~/.zshrc:
source /path/to/VideoTools/scripts/alias.sh
# If not, add it manually:
echo 'source /path/to/VideoTools/scripts/alias.sh' >> ~/.bashrc
source ~/.bashrc
```
---
## Advanced: Manual Installation
If you prefer to install manually:
### Step 1: Build
```bash
cd /path/to/VideoTools
CGO_ENABLED=1 go build -o VideoTools .
```
### Step 2: Install Binary
```bash
# User-local installation:
mkdir -p ~/.local/bin
cp VideoTools ~/.local/bin/VideoTools
chmod +x ~/.local/bin/VideoTools
# System-wide installation:
sudo cp VideoTools /usr/local/bin/VideoTools
sudo chmod +x /usr/local/bin/VideoTools
```
### Step 3: Setup Aliases
```bash
# Add to ~/.bashrc or ~/.zshrc:
source /path/to/VideoTools/scripts/alias.sh
# Add to PATH if needed:
export PATH="$HOME/.local/bin:$PATH"
```
### Step 4: Reload Shell
```bash
source ~/.bashrc # for bash
source ~/.zshrc # for zsh
```
---
## Uninstallation
### If Installed System-Wide
```bash
sudo rm /usr/local/bin/VideoTools
```
### If Installed User-Local
```bash
rm ~/.local/bin/VideoTools
```
### Remove Shell Configuration
Remove these lines from `~/.bashrc` or `~/.zshrc`:
```bash
# VideoTools installation path
export PATH="$HOME/.local/bin:$PATH"
# VideoTools convenience aliases
source "/path/to/VideoTools/scripts/alias.sh"
```
---
## Verification
After installation, verify everything works:
```bash
# Check binary is accessible:
which VideoTools
# Check version/help:
VideoTools --help
# Check aliases are available:
type VideoToolsRebuild
type VideoToolsClean
```
---
## Getting Help
For issues or questions:
1. Check **BUILD_AND_RUN.md** for build-specific help
2. Check **DVD_USER_GUIDE.md** for usage help
3. Review installation logs in `/tmp/videotools-build.log`
4. Check shell configuration files for errors
---
## Next Steps
After successful installation:
1. **Read the Quick Start Guide:**
```bash
cat DVD_USER_GUIDE.md
```
2. **Launch VideoTools:**
```bash
VideoTools
```
3. **Convert your first video:**
- Go to Convert module
- Load a video
- Select "DVD-NTSC (MPEG-2)" or "DVD-PAL (MPEG-2)"
- Click "Add to Queue"
- Click "View Queue" → "Start Queue"
---
## Platform-Specific Notes
### Linux (Ubuntu/Debian)
Installation is fully automatic. The script handles all steps.
### Linux (Arch/Manjaro)
Same as above. Installation works without modification.
### macOS
Installation works but requires Xcode Command Line Tools:
```bash
xcode-select --install
```
### Windows (WSL)
Installation works in WSL environment. Ensure you have WSL with Linux distro installed.
---
Enjoy using VideoTools! 🎬

View File

@ -27,17 +27,32 @@ VideoTools is a professional-grade video processing application with a modern GU
## Quick Start ## Quick Start
### One-Time Setup ### Installation (One Command)
```bash ```bash
cd /home/stu/Projects/VideoTools bash install.sh
source scripts/alias.sh
``` ```
### Run VideoTools The installer will build, install, and set up everything automatically!
**After installation:**
```bash ```bash
source ~/.bashrc # (or ~/.zshrc for zsh)
VideoTools VideoTools
``` ```
### Alternative: Developer Setup
If you already have the repo cloned:
```bash
cd /path/to/VideoTools
source scripts/alias.sh
VideoTools
```
For detailed installation options, see **INSTALLATION.md**.
## How to Create a Professional DVD ## How to Create a Professional DVD
1. **Start VideoTools**`VideoTools` 1. **Start VideoTools**`VideoTools`
@ -57,6 +72,9 @@ Output is professional quality, ready for:
## Documentation ## Documentation
**Getting Started:**
- **INSTALLATION.md** - Comprehensive installation guide (read this first!)
**For Users:** **For Users:**
- **BUILD_AND_RUN.md** - How to build and run VideoTools - **BUILD_AND_RUN.md** - How to build and run VideoTools
- **DVD_USER_GUIDE.md** - Complete guide to DVD encoding - **DVD_USER_GUIDE.md** - Complete guide to DVD encoding

View File

@ -7,6 +7,7 @@ RED='\033[0;31m'
GREEN='\033[0;32m' GREEN='\033[0;32m'
YELLOW='\033[1;33m' YELLOW='\033[1;33m'
BLUE='\033[0;34m' BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color NC='\033[0m' # No Color
# Spinner function # Spinner function
@ -26,47 +27,56 @@ spinner() {
# Configuration # Configuration
BINARY_NAME="VideoTools" BINARY_NAME="VideoTools"
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEFAULT_INSTALL_PATH="/usr/local/bin" DEFAULT_INSTALL_PATH="/usr/local/bin"
USER_INSTALL_PATH="$HOME/.local/bin" USER_INSTALL_PATH="$HOME/.local/bin"
echo "=========================================" echo "════════════════════════════════════════════════════════════════"
echo " VideoTools Installation Script" echo " VideoTools Professional Installation"
echo "=========================================" echo "════════════════════════════════════════════════════════════════"
echo "" echo ""
# Check if Go is installed # Step 1: Check if Go is installed
echo -e "${CYAN}[1/5]${NC} Checking Go installation..."
if ! command -v go &> /dev/null; then if ! command -v go &> /dev/null; then
echo -e "${RED}Error: Go is not installed or not in PATH${NC}" echo -e "${RED}Error: Go is not installed or not in PATH${NC}"
echo "Please install Go 1.21+ from https://go.dev/dl/" echo "Please install Go 1.21+ from https://go.dev/dl/"
exit 1 exit 1
fi fi
# Check Go version
GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//') GO_VERSION=$(go version | awk '{print $3}' | sed 's/go//')
echo -e "${GREEN}${NC} Found Go version: $GO_VERSION" echo -e "${GREEN}${NC} Found Go version: $GO_VERSION"
# Build the binary # Step 2: Build the binary
echo "" echo ""
go build -o "$BINARY_NAME" . > /tmp/videotools-build.log 2>&1 & echo -e "${CYAN}[2/5]${NC} Building VideoTools..."
cd "$PROJECT_ROOT"
CGO_ENABLED=1 go build -o "$BINARY_NAME" . > /tmp/videotools-build.log 2>&1 &
BUILD_PID=$! BUILD_PID=$!
spinner $BUILD_PID "Building $BINARY_NAME" spinner $BUILD_PID "Building $BINARY_NAME"
if wait $BUILD_PID; then if wait $BUILD_PID; then
echo -e "${GREEN}${NC} Build successful" echo -e "${GREEN}${NC} Build successful"
else else
echo -e "${RED}Error: Build failed${NC}" echo -e "${RED}✗ Build failed${NC}"
echo ""
echo "Build log:"
cat /tmp/videotools-build.log cat /tmp/videotools-build.log
rm -f /tmp/videotools-build.log rm -f /tmp/videotools-build.log
exit 1 exit 1
fi fi
rm -f /tmp/videotools-build.log rm -f /tmp/videotools-build.log
# Determine installation path # Step 3: Determine installation path
echo ""
echo -e "${CYAN}[3/5]${NC} Installation path selection"
echo "" echo ""
echo "Where would you like to install $BINARY_NAME?" echo "Where would you like to install $BINARY_NAME?"
echo "1) System-wide (/usr/local/bin) - requires sudo" echo " 1) System-wide (/usr/local/bin) - requires sudo, available to all users"
echo "2) User-local (~/.local/bin) - no sudo needed" echo " 2) User-local (~/.local/bin) - no sudo needed, available only to you"
read -p "Enter choice [1 or 2]: " choice echo ""
read -p "Enter choice [1 or 2, default 2]: " choice
choice=${choice:-2}
case $choice in case $choice in
1) 1)
@ -76,60 +86,102 @@ case $choice in
2) 2)
INSTALL_PATH="$USER_INSTALL_PATH" INSTALL_PATH="$USER_INSTALL_PATH"
NEEDS_SUDO=false NEEDS_SUDO=false
# Create ~/.local/bin if it doesn't exist
mkdir -p "$INSTALL_PATH" mkdir -p "$INSTALL_PATH"
;; ;;
*) *)
echo -e "${RED}Invalid choice. Exiting.${NC}" echo -e "${RED}Invalid choice. Exiting.${NC}"
rm -f "$BINARY_NAME" rm -f "$BINARY_NAME"
exit 1 exit 1
;; ;;
esac esac
# Install the binary # Step 4: Install the binary
echo "" echo ""
echo -e "${CYAN}[4/5]${NC} Installing binary to $INSTALL_PATH..."
if [ "$NEEDS_SUDO" = true ]; then if [ "$NEEDS_SUDO" = true ]; then
sudo install -m 755 "$BINARY_NAME" "$INSTALL_PATH/$BINARY_NAME" > /dev/null 2>&1 & sudo install -m 755 "$BINARY_NAME" "$INSTALL_PATH/$BINARY_NAME" > /dev/null 2>&1 &
INSTALL_PID=$! INSTALL_PID=$!
spinner $INSTALL_PID "Installing $BINARY_NAME to $INSTALL_PATH" spinner $INSTALL_PID "Installing $BINARY_NAME"
if wait $INSTALL_PID; then if wait $INSTALL_PID; then
echo -e "${GREEN}${NC} Installation successful" echo -e "${GREEN}${NC} Installation successful"
else else
echo -e "${RED}Error: Installation failed${NC}" echo -e "${RED} Installation failed${NC}"
rm -f "$BINARY_NAME" rm -f "$BINARY_NAME"
exit 1 exit 1
fi fi
else else
install -m 755 "$BINARY_NAME" "$INSTALL_PATH/$BINARY_NAME" > /dev/null 2>&1 & install -m 755 "$BINARY_NAME" "$INSTALL_PATH/$BINARY_NAME" > /dev/null 2>&1 &
INSTALL_PID=$! INSTALL_PID=$!
spinner $INSTALL_PID "Installing $BINARY_NAME to $INSTALL_PATH" spinner $INSTALL_PID "Installing $BINARY_NAME"
if wait $INSTALL_PID; then if wait $INSTALL_PID; then
echo -e "${GREEN}${NC} Installation successful" echo -e "${GREEN}${NC} Installation successful"
else else
echo -e "${RED}Error: Installation failed${NC}" echo -e "${RED} Installation failed${NC}"
rm -f "$BINARY_NAME" rm -f "$BINARY_NAME"
exit 1 exit 1
fi fi
fi fi
# Clean up the local binary
rm -f "$BINARY_NAME" rm -f "$BINARY_NAME"
# Check if install path is in PATH # Step 5: Setup shell aliases and environment
echo "" echo ""
if [[ ":$PATH:" != *":$INSTALL_PATH:"* ]]; then echo -e "${CYAN}[5/5]${NC} Setting up shell environment..."
echo -e "${YELLOW}Warning: $INSTALL_PATH is not in your PATH${NC}"
echo "Add the following line to your ~/.bashrc or ~/.zshrc:" # Detect shell
echo "" if [ -n "$ZSH_VERSION" ]; then
echo " export PATH=\"$INSTALL_PATH:\$PATH\"" SHELL_RC="$HOME/.zshrc"
echo "" SHELL_NAME="zsh"
elif [ -n "$BASH_VERSION" ]; then
SHELL_RC="$HOME/.bashrc"
SHELL_NAME="bash"
else
# Default to bash
SHELL_RC="$HOME/.bashrc"
SHELL_NAME="bash"
fi
# Create alias setup script
ALIAS_SCRIPT="$PROJECT_ROOT/scripts/alias.sh"
# Add installation path to PATH if needed
if [[ ":$PATH:" != *":$INSTALL_PATH:"* ]]; then
# Check if PATH export already exists
if ! grep -q "export PATH.*$INSTALL_PATH" "$SHELL_RC" 2>/dev/null; then
echo "" >> "$SHELL_RC"
echo "# VideoTools installation path" >> "$SHELL_RC"
echo "export PATH=\"$INSTALL_PATH:\$PATH\"" >> "$SHELL_RC"
echo -e "${GREEN}${NC} Added $INSTALL_PATH to PATH in $SHELL_RC"
fi
fi
# Add alias sourcing if not already present
if ! grep -q "source.*alias.sh" "$SHELL_RC" 2>/dev/null; then
echo "" >> "$SHELL_RC"
echo "# VideoTools convenience aliases" >> "$SHELL_RC"
echo "source \"$ALIAS_SCRIPT\"" >> "$SHELL_RC"
echo -e "${GREEN}${NC} Added VideoTools aliases to $SHELL_RC"
fi fi
echo "========================================="
echo -e "${GREEN}Installation complete!${NC}"
echo "========================================="
echo "" echo ""
echo "You can now run: $BINARY_NAME" echo "════════════════════════════════════════════════════════════════"
echo -e "${GREEN}Installation Complete!${NC}"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "Next steps:"
echo ""
echo "1. ${CYAN}Reload your shell configuration:${NC}"
echo " source $SHELL_RC"
echo ""
echo "2. ${CYAN}Run VideoTools:${NC}"
echo " VideoTools"
echo ""
echo "3. ${CYAN}Available commands:${NC}"
echo " • VideoTools - Run the application"
echo " • VideoToolsRebuild - Force rebuild from source"
echo " • VideoToolsClean - Clean build artifacts and cache"
echo ""
echo "For more information, see BUILD_AND_RUN.md and DVD_USER_GUIDE.md"
echo "" echo ""