feat(bootstrap): add installer download and execution script for automated deployment
- commit
- 1e96984d9d54a05e338611c46c2421b793dcdf92
- author
- bnema · · 2025-10-26 09:42 UTC
- parent
- c6247a6
- signature
- unsigned
1 file · +77 -0
A install-bin.sh +77 -0
| @@ -0,0 +1,77 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | # ArchUp Installer Bootstrap Script | |
| 3 | + | # Downloads and runs the ArchUp Go installer | |
| 4 | + | ||
| 5 | + | set -e | |
| 6 | + | ||
| 7 | + | # Colors for output | |
| 8 | + | RED='\033[0;31m' | |
| 9 | + | GREEN='\033[0;32m' | |
| 10 | + | BLUE='\033[0;34m' | |
| 11 | + | NC='\033[0m' # No Color | |
| 12 | + | ||
| 13 | + | info() { | |
| 14 | + | echo -e "${BLUE}[INFO]${NC} $1" | |
| 15 | + | } | |
| 16 | + | ||
| 17 | + | success() { | |
| 18 | + | echo -e "${GREEN}[OK]${NC} $1" | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | error() { | |
| 22 | + | echo -e "${RED}[ERROR]${NC} $1" | |
| 23 | + | exit 1 | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | # Check if running on Arch Linux | |
| 27 | + | info "Checking system requirements..." | |
| 28 | + | if [ ! -f /etc/arch-release ]; then | |
| 29 | + | error "This installer must be run on Arch Linux ISO" | |
| 30 | + | fi | |
| 31 | + | success "Running on Arch Linux" | |
| 32 | + | ||
| 33 | + | # Check for UEFI mode | |
| 34 | + | if [ ! -d /sys/firmware/efi ]; then | |
| 35 | + | error "UEFI mode required (legacy BIOS not supported)" | |
| 36 | + | fi | |
| 37 | + | success "UEFI mode detected" | |
| 38 | + | ||
| 39 | + | # Check architecture | |
| 40 | + | ARCH=$(uname -m) | |
| 41 | + | if [ "$ARCH" != "x86_64" ]; then | |
| 42 | + | error "Only x86_64 architecture is supported (detected: $ARCH)" | |
| 43 | + | fi | |
| 44 | + | success "Architecture: $ARCH" | |
| 45 | + | ||
| 46 | + | # GitHub repository details | |
| 47 | + | REPO_OWNER="bnema" | |
| 48 | + | REPO_NAME="archup" | |
| 49 | + | BINARY_NAME="archup-installer" | |
| 50 | + | ||
| 51 | + | # Download latest release | |
| 52 | + | info "Fetching latest release information..." | |
| 53 | + | LATEST_RELEASE_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | |
| 54 | + | LATEST_TAG=$(curl -s "$LATEST_RELEASE_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| 55 | + | ||
| 56 | + | if [ -z "$LATEST_TAG" ]; then | |
| 57 | + | error "Failed to fetch latest release tag" | |
| 58 | + | fi | |
| 59 | + | success "Latest version: $LATEST_TAG" | |
| 60 | + | ||
| 61 | + | # Download binary | |
| 62 | + | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | |
| 63 | + | BINARY_PATH="/tmp/$BINARY_NAME" | |
| 64 | + | ||
| 65 | + | info "Downloading installer binary..." | |
| 66 | + | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |
| 67 | + | error "Failed to download installer binary from $BINARY_URL" | |
| 68 | + | fi | |
| 69 | + | success "Binary downloaded" | |
| 70 | + | ||
| 71 | + | # Make executable | |
| 72 | + | chmod +x "$BINARY_PATH" | |
| 73 | + | ||
| 74 | + | # Run installer | |
| 75 | + | info "Launching ArchUp installer..." | |
| 76 | + | echo "" | |
| 77 | + | exec "$BINARY_PATH" | |
| @@ -0,0 +1,77 @@ | |||||
| 1 | + | #!/bin/bash | |||
| 2 | + | # ArchUp Installer Bootstrap Script | |||
| 3 | + | # Downloads and runs the ArchUp Go installer | |||
| 4 | + | ||||
| 5 | + | set -e | |||
| 6 | + | ||||
| 7 | + | # Colors for output | |||
| 8 | + | RED='\033[0;31m' | |||
| 9 | + | GREEN='\033[0;32m' | |||
| 10 | + | BLUE='\033[0;34m' | |||
| 11 | + | NC='\033[0m' # No Color | |||
| 12 | + | ||||
| 13 | + | info() { | |||
| 14 | + | echo -e "${BLUE}[INFO]${NC} $1" | |||
| 15 | + | } | |||
| 16 | + | ||||
| 17 | + | success() { | |||
| 18 | + | echo -e "${GREEN}[OK]${NC} $1" | |||
| 19 | + | } | |||
| 20 | + | ||||
| 21 | + | error() { | |||
| 22 | + | echo -e "${RED}[ERROR]${NC} $1" | |||
| 23 | + | exit 1 | |||
| 24 | + | } | |||
| 25 | + | ||||
| 26 | + | # Check if running on Arch Linux | |||
| 27 | + | info "Checking system requirements..." | |||
| 28 | + | if [ ! -f /etc/arch-release ]; then | |||
| 29 | + | error "This installer must be run on Arch Linux ISO" | |||
| 30 | + | fi | |||
| 31 | + | success "Running on Arch Linux" | |||
| 32 | + | ||||
| 33 | + | # Check for UEFI mode | |||
| 34 | + | if [ ! -d /sys/firmware/efi ]; then | |||
| 35 | + | error "UEFI mode required (legacy BIOS not supported)" | |||
| 36 | + | fi | |||
| 37 | + | success "UEFI mode detected" | |||
| 38 | + | ||||
| 39 | + | # Check architecture | |||
| 40 | + | ARCH=$(uname -m) | |||
| 41 | + | if [ "$ARCH" != "x86_64" ]; then | |||
| 42 | + | error "Only x86_64 architecture is supported (detected: $ARCH)" | |||
| 43 | + | fi | |||
| 44 | + | success "Architecture: $ARCH" | |||
| 45 | + | ||||
| 46 | + | # GitHub repository details | |||
| 47 | + | REPO_OWNER="bnema" | |||
| 48 | + | REPO_NAME="archup" | |||
| 49 | + | BINARY_NAME="archup-installer" | |||
| 50 | + | ||||
| 51 | + | # Download latest release | |||
| 52 | + | info "Fetching latest release information..." | |||
| 53 | + | LATEST_RELEASE_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases/latest" | |||
| 54 | + | LATEST_TAG=$(curl -s "$LATEST_RELEASE_URL" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |||
| 55 | + | ||||
| 56 | + | if [ -z "$LATEST_TAG" ]; then | |||
| 57 | + | error "Failed to fetch latest release tag" | |||
| 58 | + | fi | |||
| 59 | + | success "Latest version: $LATEST_TAG" | |||
| 60 | + | ||||
| 61 | + | # Download binary | |||
| 62 | + | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | |||
| 63 | + | BINARY_PATH="/tmp/$BINARY_NAME" | |||
| 64 | + | ||||
| 65 | + | info "Downloading installer binary..." | |||
| 66 | + | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |||
| 67 | + | error "Failed to download installer binary from $BINARY_URL" | |||
| 68 | + | fi | |||
| 69 | + | success "Binary downloaded" | |||
| 70 | + | ||||
| 71 | + | # Make executable | |||
| 72 | + | chmod +x "$BINARY_PATH" | |||
| 73 | + | ||||
| 74 | + | # Run installer | |||
| 75 | + | info "Launching ArchUp installer..." | |||
| 76 | + | echo "" | |||
| 77 | + | exec "$BINARY_PATH" | |||