fix(bootstrap): improve prerelease detection and add dedicated dev installer script
- commit
- c2ef753dcb647aef20b4a1e97c8b389b89843c51
- author
- bnema · · 2025-10-26 14:16 UTC
- parent
- 854257e
- signature
- unsigned
2 files · +133 -1
A install-bin-dev.sh +131 -0
| @@ -0,0 +1,131 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | # ArchUp Installer Bootstrap Script - Dev/Pre-release Version | |
| 3 | + | # Downloads and runs the latest ArchUp Go installer pre-release | |
| 4 | + | # | |
| 5 | + | # Usage: | |
| 6 | + | # curl -fsSL https://archup.run/install/bin/dev | bash | |
| 7 | + | # | |
| 8 | + | # Or locally: | |
| 9 | + | # ./install-bin-dev.sh # Install latest pre-release | |
| 10 | + | # ./install-bin-dev.sh --version v0.4.0-dev # Install specific version | |
| 11 | + | ||
| 12 | + | set -e | |
| 13 | + | ||
| 14 | + | # Default to dev mode | |
| 15 | + | DEV_MODE=true | |
| 16 | + | SPECIFIC_VERSION="" | |
| 17 | + | ||
| 18 | + | while [[ $# -gt 0 ]]; do | |
| 19 | + | case $1 in | |
| 20 | + | --version) | |
| 21 | + | SPECIFIC_VERSION="$2" | |
| 22 | + | shift 2 | |
| 23 | + | ;; | |
| 24 | + | *) | |
| 25 | + | echo "Unknown option: $1" | |
| 26 | + | echo "Usage: $0 [--version VERSION]" | |
| 27 | + | exit 1 | |
| 28 | + | ;; | |
| 29 | + | esac | |
| 30 | + | done | |
| 31 | + | ||
| 32 | + | # Colors for output | |
| 33 | + | RED='\033[0;31m' | |
| 34 | + | GREEN='\033[0;32m' | |
| 35 | + | BLUE='\033[0;34m' | |
| 36 | + | YELLOW='\033[0;33m' | |
| 37 | + | NC='\033[0m' # No Color | |
| 38 | + | ||
| 39 | + | info() { | |
| 40 | + | echo -e "${BLUE}[INFO]${NC} $1" | |
| 41 | + | } | |
| 42 | + | ||
| 43 | + | success() { | |
| 44 | + | echo -e "${GREEN}[OK]${NC} $1" | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | warning() { | |
| 48 | + | echo -e "${YELLOW}[WARN]${NC} $1" | |
| 49 | + | } | |
| 50 | + | ||
| 51 | + | error() { | |
| 52 | + | echo -e "${RED}[ERROR]${NC} $1" | |
| 53 | + | exit 1 | |
| 54 | + | } | |
| 55 | + | ||
| 56 | + | # Check if running on Arch Linux | |
| 57 | + | info "Checking system requirements..." | |
| 58 | + | if [ ! -f /etc/arch-release ]; then | |
| 59 | + | error "This installer must be run on Arch Linux ISO" | |
| 60 | + | fi | |
| 61 | + | success "Running on Arch Linux" | |
| 62 | + | ||
| 63 | + | # Check for UEFI mode | |
| 64 | + | if [ ! -d /sys/firmware/efi ]; then | |
| 65 | + | error "UEFI mode required (legacy BIOS not supported)" | |
| 66 | + | fi | |
| 67 | + | success "UEFI mode detected" | |
| 68 | + | ||
| 69 | + | # Check architecture | |
| 70 | + | ARCH=$(uname -m) | |
| 71 | + | if [ "$ARCH" != "x86_64" ]; then | |
| 72 | + | error "Only x86_64 architecture is supported (detected: $ARCH)" | |
| 73 | + | fi | |
| 74 | + | success "Architecture: $ARCH" | |
| 75 | + | ||
| 76 | + | # GitHub repository details | |
| 77 | + | REPO_OWNER="bnema" | |
| 78 | + | REPO_NAME="archup" | |
| 79 | + | BINARY_NAME="archup-installer" | |
| 80 | + | ||
| 81 | + | # Determine which version to download | |
| 82 | + | if [ -n "$SPECIFIC_VERSION" ]; then | |
| 83 | + | # User specified a version | |
| 84 | + | LATEST_TAG="$SPECIFIC_VERSION" | |
| 85 | + | info "Using specific version: $LATEST_TAG" | |
| 86 | + | else | |
| 87 | + | # Get latest pre-release (including dev/rc builds) | |
| 88 | + | warning "Dev mode: fetching latest pre-release..." | |
| 89 | + | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | |
| 90 | + | # Filter for releases where "prerelease": true, then get the first tag_name | |
| 91 | + | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -B 10 '"prerelease": true' | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') | |
| 92 | + | ||
| 93 | + | if [ -z "$LATEST_TAG" ]; then | |
| 94 | + | error "Failed to fetch latest pre-release" | |
| 95 | + | fi | |
| 96 | + | warning "Latest pre-release: $LATEST_TAG" | |
| 97 | + | fi | |
| 98 | + | ||
| 99 | + | # Download binary | |
| 100 | + | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | |
| 101 | + | BINARY_PATH="/tmp/$BINARY_NAME" | |
| 102 | + | CHECKSUM_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/checksums.txt" | |
| 103 | + | CHECKSUM_PATH="/tmp/checksums.txt" | |
| 104 | + | ||
| 105 | + | info "Downloading installer binary..." | |
| 106 | + | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |
| 107 | + | error "Failed to download installer binary from $BINARY_URL" | |
| 108 | + | fi | |
| 109 | + | success "Binary downloaded" | |
| 110 | + | ||
| 111 | + | # Download and verify checksum | |
| 112 | + | info "Downloading checksums..." | |
| 113 | + | if ! curl -fsSL "$CHECKSUM_URL" -o "$CHECKSUM_PATH"; then | |
| 114 | + | error "Failed to download checksums from $CHECKSUM_URL" | |
| 115 | + | fi | |
| 116 | + | success "Checksums downloaded" | |
| 117 | + | ||
| 118 | + | info "Verifying checksum..." | |
| 119 | + | cd /tmp | |
| 120 | + | if ! sha256sum -c "$CHECKSUM_PATH" --ignore-missing 2>/dev/null; then | |
| 121 | + | error "Checksum verification failed! Binary may be corrupted or tampered with." | |
| 122 | + | fi | |
| 123 | + | success "Checksum verified" | |
| 124 | + | ||
| 125 | + | # Make executable | |
| 126 | + | chmod +x "$BINARY_PATH" | |
| 127 | + | ||
| 128 | + | # Run installer | |
| 129 | + | info "Launching ArchUp installer..." | |
| 130 | + | echo "" | |
| 131 | + | exec "$BINARY_PATH" | |
| @@ -0,0 +1,131 @@ | |||||
| 1 | + | #!/bin/bash | |||
| 2 | + | # ArchUp Installer Bootstrap Script - Dev/Pre-release Version | |||
| 3 | + | # Downloads and runs the latest ArchUp Go installer pre-release | |||
| 4 | + | # | |||
| 5 | + | # Usage: | |||
| 6 | + | # curl -fsSL https://archup.run/install/bin/dev | bash | |||
| 7 | + | # | |||
| 8 | + | # Or locally: | |||
| 9 | + | # ./install-bin-dev.sh # Install latest pre-release | |||
| 10 | + | # ./install-bin-dev.sh --version v0.4.0-dev # Install specific version | |||
| 11 | + | ||||
| 12 | + | set -e | |||
| 13 | + | ||||
| 14 | + | # Default to dev mode | |||
| 15 | + | DEV_MODE=true | |||
| 16 | + | SPECIFIC_VERSION="" | |||
| 17 | + | ||||
| 18 | + | while [[ $# -gt 0 ]]; do | |||
| 19 | + | case $1 in | |||
| 20 | + | --version) | |||
| 21 | + | SPECIFIC_VERSION="$2" | |||
| 22 | + | shift 2 | |||
| 23 | + | ;; | |||
| 24 | + | *) | |||
| 25 | + | echo "Unknown option: $1" | |||
| 26 | + | echo "Usage: $0 [--version VERSION]" | |||
| 27 | + | exit 1 | |||
| 28 | + | ;; | |||
| 29 | + | esac | |||
| 30 | + | done | |||
| 31 | + | ||||
| 32 | + | # Colors for output | |||
| 33 | + | RED='\033[0;31m' | |||
| 34 | + | GREEN='\033[0;32m' | |||
| 35 | + | BLUE='\033[0;34m' | |||
| 36 | + | YELLOW='\033[0;33m' | |||
| 37 | + | NC='\033[0m' # No Color | |||
| 38 | + | ||||
| 39 | + | info() { | |||
| 40 | + | echo -e "${BLUE}[INFO]${NC} $1" | |||
| 41 | + | } | |||
| 42 | + | ||||
| 43 | + | success() { | |||
| 44 | + | echo -e "${GREEN}[OK]${NC} $1" | |||
| 45 | + | } | |||
| 46 | + | ||||
| 47 | + | warning() { | |||
| 48 | + | echo -e "${YELLOW}[WARN]${NC} $1" | |||
| 49 | + | } | |||
| 50 | + | ||||
| 51 | + | error() { | |||
| 52 | + | echo -e "${RED}[ERROR]${NC} $1" | |||
| 53 | + | exit 1 | |||
| 54 | + | } | |||
| 55 | + | ||||
| 56 | + | # Check if running on Arch Linux | |||
| 57 | + | info "Checking system requirements..." | |||
| 58 | + | if [ ! -f /etc/arch-release ]; then | |||
| 59 | + | error "This installer must be run on Arch Linux ISO" | |||
| 60 | + | fi | |||
| 61 | + | success "Running on Arch Linux" | |||
| 62 | + | ||||
| 63 | + | # Check for UEFI mode | |||
| 64 | + | if [ ! -d /sys/firmware/efi ]; then | |||
| 65 | + | error "UEFI mode required (legacy BIOS not supported)" | |||
| 66 | + | fi | |||
| 67 | + | success "UEFI mode detected" | |||
| 68 | + | ||||
| 69 | + | # Check architecture | |||
| 70 | + | ARCH=$(uname -m) | |||
| 71 | + | if [ "$ARCH" != "x86_64" ]; then | |||
| 72 | + | error "Only x86_64 architecture is supported (detected: $ARCH)" | |||
| 73 | + | fi | |||
| 74 | + | success "Architecture: $ARCH" | |||
| 75 | + | ||||
| 76 | + | # GitHub repository details | |||
| 77 | + | REPO_OWNER="bnema" | |||
| 78 | + | REPO_NAME="archup" | |||
| 79 | + | BINARY_NAME="archup-installer" | |||
| 80 | + | ||||
| 81 | + | # Determine which version to download | |||
| 82 | + | if [ -n "$SPECIFIC_VERSION" ]; then | |||
| 83 | + | # User specified a version | |||
| 84 | + | LATEST_TAG="$SPECIFIC_VERSION" | |||
| 85 | + | info "Using specific version: $LATEST_TAG" | |||
| 86 | + | else | |||
| 87 | + | # Get latest pre-release (including dev/rc builds) | |||
| 88 | + | warning "Dev mode: fetching latest pre-release..." | |||
| 89 | + | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | |||
| 90 | + | # Filter for releases where "prerelease": true, then get the first tag_name | |||
| 91 | + | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -B 10 '"prerelease": true' | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') | |||
| 92 | + | ||||
| 93 | + | if [ -z "$LATEST_TAG" ]; then | |||
| 94 | + | error "Failed to fetch latest pre-release" | |||
| 95 | + | fi | |||
| 96 | + | warning "Latest pre-release: $LATEST_TAG" | |||
| 97 | + | fi | |||
| 98 | + | ||||
| 99 | + | # Download binary | |||
| 100 | + | BINARY_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/$BINARY_NAME" | |||
| 101 | + | BINARY_PATH="/tmp/$BINARY_NAME" | |||
| 102 | + | CHECKSUM_URL="https://github.com/$REPO_OWNER/$REPO_NAME/releases/download/$LATEST_TAG/checksums.txt" | |||
| 103 | + | CHECKSUM_PATH="/tmp/checksums.txt" | |||
| 104 | + | ||||
| 105 | + | info "Downloading installer binary..." | |||
| 106 | + | if ! curl -fsSL "$BINARY_URL" -o "$BINARY_PATH"; then | |||
| 107 | + | error "Failed to download installer binary from $BINARY_URL" | |||
| 108 | + | fi | |||
| 109 | + | success "Binary downloaded" | |||
| 110 | + | ||||
| 111 | + | # Download and verify checksum | |||
| 112 | + | info "Downloading checksums..." | |||
| 113 | + | if ! curl -fsSL "$CHECKSUM_URL" -o "$CHECKSUM_PATH"; then | |||
| 114 | + | error "Failed to download checksums from $CHECKSUM_URL" | |||
| 115 | + | fi | |||
| 116 | + | success "Checksums downloaded" | |||
| 117 | + | ||||
| 118 | + | info "Verifying checksum..." | |||
| 119 | + | cd /tmp | |||
| 120 | + | if ! sha256sum -c "$CHECKSUM_PATH" --ignore-missing 2>/dev/null; then | |||
| 121 | + | error "Checksum verification failed! Binary may be corrupted or tampered with." | |||
| 122 | + | fi | |||
| 123 | + | success "Checksum verified" | |||
| 124 | + | ||||
| 125 | + | # Make executable | |||
| 126 | + | chmod +x "$BINARY_PATH" | |||
| 127 | + | ||||
| 128 | + | # Run installer | |||
| 129 | + | info "Launching ArchUp installer..." | |||
| 130 | + | echo "" | |||
| 131 | + | exec "$BINARY_PATH" | |||
M install-bin.sh +2 -1
| @@ -94,7 +94,8 @@ elif [ "$DEV_MODE" = true ]; then | |||
| 94 | 94 | # Get latest pre-release (including dev/rc builds) | |
| 95 | 95 | warning "Dev mode: fetching latest pre-release..." | |
| 96 | 96 | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | |
| 97 | - | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -m 1 '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | |
| 97 | + | # Filter for releases where "prerelease": true, then get the first tag_name | |
| 98 | + | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -B 10 '"prerelease": true' | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') | |
| 98 | 99 | ||
| 99 | 100 | if [ -z "$LATEST_TAG" ]; then | |
| 100 | 101 | error "Failed to fetch latest pre-release" | |
| @@ -94,7 +94,8 @@ elif [ "$DEV_MODE" = true ]; then | |||||
| 94 | # Get latest pre-release (including dev/rc builds) | 94 | # Get latest pre-release (including dev/rc builds) | ||
| 95 | warning "Dev mode: fetching latest pre-release..." | 95 | warning "Dev mode: fetching latest pre-release..." | ||
| 96 | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | 96 | RELEASES_URL="https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/releases" | ||
| 97 | - | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -m 1 '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') | 97 | + | # Filter for releases where "prerelease": true, then get the first tag_name |
| 98 | + | LATEST_TAG=$(curl -s "$RELEASES_URL" | grep -B 10 '"prerelease": true' | grep '"tag_name":' | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/') | |||
| 98 | 99 | ||||
| 99 | if [ -z "$LATEST_TAG" ]; then | 100 | if [ -z "$LATEST_TAG" ]; then | ||
| 100 | error "Failed to fetch latest pre-release" | 101 | error "Failed to fetch latest pre-release" | ||