-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-global.sh
More file actions
executable file
·114 lines (98 loc) · 3.92 KB
/
install-global.sh
File metadata and controls
executable file
·114 lines (98 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# Global Installation Script for Git Migration Tool
# Created by Dev Kraken <soman@devkraken.com>
set -e
# Script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BANNER_LIB="$SCRIPT_DIR/src/banner-utils.sh"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
WHITE='\033[1;37m'
NC='\033[0m'
# Import banner utilities if available
if [[ -f "$BANNER_LIB" ]]; then
source "$BANNER_LIB"
else
# Fallback banner function
print_installation_banner() {
echo -e "${WHITE}╔═══════════════════════════════════════════════════════════════════════════╗${NC}"
echo -e "${WHITE}║ Git Migration Tool - Global Install ║${NC}"
echo -e "${WHITE}║ Created by Dev Kraken ║${NC}"
echo -e "${WHITE}║ https://devkraken.com ║${NC}"
echo -e "${WHITE}╚═══════════════════════════════════════════════════════════════════════════╝${NC}"
}
fi
# Logging functions
log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
log_step() { echo -e "${BLUE}[STEP]${NC} $1"; }
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
# Show banner
print_installation_banner
echo
# Check if script exists
if [[ ! -f "git-migration-tool.sh" ]]; then
log_error "git-migration-tool.sh not found in current directory"
echo "Please run this script from the git-migration directory"
exit 1
fi
# Check for sudo access
if [[ $EUID -eq 0 ]]; then
log_warn "Running as root - installing to /usr/local/bin/"
INSTALL_DIR="/usr/local/bin"
TOOL_NAME="git-migration-tool"
else
log_info "Installing to /usr/local/bin/ (requires sudo)"
INSTALL_DIR="/usr/local/bin"
TOOL_NAME="git-migration-tool"
fi
# Installation steps
log_step "Installing Git Migration Tool globally..."
# Make script executable
log_info "Making script executable..."
chmod +x git-migration-tool.sh
# Copy to global location
if [[ $EUID -eq 0 ]]; then
cp git-migration-tool.sh "$INSTALL_DIR/$TOOL_NAME"
chmod +x "$INSTALL_DIR/$TOOL_NAME"
else
log_info "Copying to $INSTALL_DIR (requires sudo password)"
sudo cp git-migration-tool.sh "$INSTALL_DIR/$TOOL_NAME"
sudo chmod +x "$INSTALL_DIR/$TOOL_NAME"
fi
# Create user config directory
USER_CONFIG_DIR="$HOME/.git-migration-tool"
log_info "Creating user configuration directory: $USER_CONFIG_DIR"
mkdir -p "$USER_CONFIG_DIR/logs" "$USER_CONFIG_DIR/config"
# Copy configuration template if it exists
if [[ -f "config/migration-config.yml" ]]; then
cp config/migration-config.yml "$USER_CONFIG_DIR/config/"
log_info "Configuration template copied to $USER_CONFIG_DIR/config/"
fi
# Test installation
log_step "Testing installation..."
if command -v git-migration-tool >/dev/null 2>&1; then
log_success "✓ Installation successful!"
echo
echo "You can now use the tool globally:"
echo -e "${GREEN} git-migration-tool --help${NC}"
echo -e "${GREEN} git-migration-tool --interactive${NC}"
echo
echo "Default author settings:"
echo -e "${BLUE} Name: Dev Kraken${NC}"
echo -e "${BLUE} Email: soman@devkraken.com${NC}"
echo
echo "Configuration and logs will be stored in:"
echo -e "${BLUE} $USER_CONFIG_DIR${NC}"
else
log_error "Installation failed - tool not found in PATH"
echo "Please ensure $INSTALL_DIR is in your PATH"
exit 1
fi
echo
log_info "Installation complete! 🚀"
echo "Run 'git-migration-tool --interactive' to get started!"