-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·63 lines (52 loc) · 1.97 KB
/
setup.sh
File metadata and controls
executable file
·63 lines (52 loc) · 1.97 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
#!/usr/bin/env bash
# ML4W Dotfiles Settings Bootstrap Script
set -e
# --- Colors ---
BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
# --- UI ---
info() { echo -e "${BLUE}[BOOTSTRAP]${NC} $1"; }
success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
info "Starting ML4W Dotfiles Settings Setup..."
# 1. Distro Detection by Binary (as requested)
if command -v pacman &> /dev/null; then
DISTRO="arch"
info "Arch Linux detected. Installing base dependencies..."
sudo pacman -S --needed --noconfirm git make jq awk gum
elif command -v dnf &> /dev/null; then
DISTRO="fedora"
info "Fedora detected. Installing base dependencies..."
sudo dnf install -y git make jq awk gum
elif command -v zypper &> /dev/null; then
DISTRO="opensuse"
info "openSUSE detected. Installing base dependencies..."
sudo zypper install -y git make jq awk gum
else
error "Unsupported distribution. Please install git, make, wak, gum, and jq manually."
fi
# 2. Prepare Temporary Folder
TEMP_DIR=$(mktemp -d -t ml4w-dotfiles-settings-XXXXXX)
info "Cloning ML4W Dotfiles Settings into $TEMP_DIR..."
# 3. Clone and Install the App
git clone --depth=1 https://github.com/mylinuxforwork/ml4w-dotfiles-settings.git "$TEMP_DIR"
cd "$TEMP_DIR"
info "Installing ML4W Dotfiles Settings to ~/.local/bin..."
make install
# 4. Ensure ~/.local/bin is in PATH for this session
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
warn "~/.local/bin is not in your PATH. Adding it for this session..."
export PATH="$HOME/.local/bin:$PATH"
# Add to .bashrc if not present
if [[ -f "$HOME/.bashrc" ]] && ! grep -q ".local/bin" "$HOME/.bashrc"; then
info "Adding ~/.local/bin to your .bashrc for future sessions..."
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc"
fi
fi
# Cleanup
rm -rf "$TEMP_DIR"
success "Setup process finished!"