-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathashar.sh
More file actions
executable file
·62 lines (51 loc) · 1.58 KB
/
ashar.sh
File metadata and controls
executable file
·62 lines (51 loc) · 1.58 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
#!/usr/bin/env bash
set -euo pipefail
REPO_URL="https://raw.githubusercontent.com/arpansource/ashar/main/packages"
ASHAR_DIR="$HOME/ashar"
check_network() {
if ! ping -c 1 -W 2 8.8.8.8 &>/dev/null && ! ping -c 1 -W 2 1.1.1.1 &>/dev/null; then
echo "❌ Network connectivity check failed. Please ensure you have internet access."
exit 1
fi
}
download_and_run() {
local script_url=$1
local tmp_script
tmp_script=$(mktemp)
echo "→ Running $(basename "$script_url") ..."
if ! curl -fsSL "$script_url" -o "$tmp_script"; then
echo "❌ Failed to download $script_url. Please check your network connection."
rm -f "$tmp_script"
exit 1
fi
bash "$tmp_script"
rm -f "$tmp_script"
}
check_network
# Upgrade system
echo "→ Upgrading system..."
sudo pacman -Syu --noconfirm
# Install base packages
download_and_run "$REPO_URL/base.sh"
# Install and setup git
download_and_run "$REPO_URL/git.sh"
# Clean up old clone
echo "→ Cleaning up old repo..."
rm -rf "$ASHAR_DIR"
# Clone fresh repo
echo "→ Cloning latest ashar repo..."
if ! git clone https://github.com/arpansource/ashar.git "$ASHAR_DIR"; then
echo "❌ Failed to clone repository. Please check your network connection."
exit 1
fi
# Run installer
echo "→ Running installer..."
bash "$ASHAR_DIR/installer.sh"
echo "✅ Ashar setup complete!"
read -rp "Do you want to restart the machine now? (y/N): " REBOOT_CHOICE </dev/tty
if [[ "$REBOOT_CHOICE" =~ ^[Yy]$ ]]; then
echo "→ Rebooting..."
sudo reboot
else
echo "→ Skipping reboot. Please restart manually when ready."
fi