Add curl one-liner install support
- Switch REPO_URL to HTTPS for machines without SSH keys - Handle piped execution (curl | bash) where BASH_SOURCE is unavailable - Add one-liner install commands to README (root and user mode) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
20
README.md
20
README.md
@@ -41,10 +41,26 @@ A generic Linux backup tool with a Whiptail TUI and CLI interface. Define named
|
||||
|
||||
## Installation
|
||||
|
||||
### One-liner (root)
|
||||
|
||||
```bash
|
||||
git clone ssh://git@git.linux-hosting.co.il:2222/shukivaknin/gniza4linux.git
|
||||
curl -sSL https://git.linux-hosting.co.il/shukivaknin/gniza4linux/raw/branch/main/scripts/install.sh | sudo bash
|
||||
```
|
||||
|
||||
### One-liner (user mode)
|
||||
|
||||
```bash
|
||||
curl -sSL https://git.linux-hosting.co.il/shukivaknin/gniza4linux/raw/branch/main/scripts/install.sh | bash
|
||||
```
|
||||
|
||||
### From source
|
||||
|
||||
```bash
|
||||
git clone https://git.linux-hosting.co.il/shukivaknin/gniza4linux.git
|
||||
cd gniza4linux
|
||||
bash scripts/install.sh
|
||||
sudo bash scripts/install.sh # root mode
|
||||
# or
|
||||
bash scripts/install.sh # user mode
|
||||
```
|
||||
|
||||
Root mode installs to `/usr/local/gniza`. User mode installs to `~/.local/share/gniza`.
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
|
||||
REPO_URL="ssh://git@git.linux-hosting.co.il:2222/shukivaknin/gniza4linux.git"
|
||||
REPO_URL="https://git.linux-hosting.co.il/shukivaknin/gniza4linux.git"
|
||||
|
||||
# Colors
|
||||
if [[ -t 1 ]]; then
|
||||
# Colors — force enable when piped (curl | bash), since output still goes to terminal
|
||||
C_GREEN=$'\033[0;32m'
|
||||
C_RED=$'\033[0;31m'
|
||||
C_YELLOW=$'\033[0;33m'
|
||||
C_BOLD=$'\033[1m'
|
||||
C_RESET=$'\033[0m'
|
||||
else
|
||||
C_GREEN="" C_RED="" C_YELLOW="" C_BOLD="" C_RESET=""
|
||||
fi
|
||||
|
||||
info() { echo "${C_GREEN}[INFO]${C_RESET} $*"; }
|
||||
warn() { echo "${C_YELLOW}[WARN]${C_RESET} $*" >&2; }
|
||||
@@ -43,12 +39,16 @@ echo ""
|
||||
# ── Determine source ────────────────────────────────────────
|
||||
SOURCE_DIR=""
|
||||
|
||||
# Check if running from a local clone
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
if [[ -f "$SCRIPT_DIR/../lib/constants.sh" && -f "$SCRIPT_DIR/../bin/gniza" ]]; then
|
||||
# Check if running from a local clone (won't work when piped via curl)
|
||||
if [[ -n "${BASH_SOURCE[0]:-}" && "${BASH_SOURCE[0]}" != "bash" ]]; then
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" 2>/dev/null && pwd)" || true
|
||||
if [[ -n "${SCRIPT_DIR:-}" && -f "$SCRIPT_DIR/../lib/constants.sh" && -f "$SCRIPT_DIR/../bin/gniza" ]]; then
|
||||
SOURCE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
info "Installing from local clone: $SOURCE_DIR"
|
||||
else
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$SOURCE_DIR" ]]; then
|
||||
# Clone from git
|
||||
if ! command -v git &>/dev/null; then
|
||||
die "git is required to install gniza4linux (or run from a local clone)"
|
||||
|
||||
Reference in New Issue
Block a user