Skip to content

Commit cdb6a18

Browse files
feedback
1 parent 0f601a3 commit cdb6a18

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ winget install git-rain.git-rain
8888

8989
First-party install script (same idea as [`git-fire/scripts/install.sh`](https://github.com/git-fire/git-fire/blob/main/scripts/install.sh)): downloads the matching `.tar.gz` from [Releases](https://github.com/git-fire/git-rain/releases), verifies `checksums.txt`, and installs to `$INSTALL_DIR` (default `~/.local/bin`).
9090

91+
The `main` URL below always runs the installer script from the latest commit on that branch, while the binary itself comes from the latest GitHub release (or from `VERSION` if you set it). That is convenient for copy-paste installs, but it means the script can drift ahead of any given release. For a fully pinned install, use the release tag in the URL (as in each release’s notes) and set `VERSION` to the same tag.
92+
9193
```bash
9294
curl -fsSL https://raw.githubusercontent.com/git-fire/git-rain/main/scripts/install.sh | bash
9395
```
@@ -98,6 +100,12 @@ Pin a version or install directory (environment variables must apply to `bash`,
98100
curl -fsSL https://raw.githubusercontent.com/git-fire/git-rain/main/scripts/install.sh | VERSION=v0.9.1 INSTALL_DIR=/usr/local/bin bash
99101
```
100102

103+
If your shell does not already include `~/.local/bin` on `PATH`, add it (the installer prints a reminder). Example for bash:
104+
105+
```bash
106+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
107+
```
108+
101109
Windows is not supported by this script — use **WinGet** or download a `.zip` from Releases.
102110

103111
### Linux native packages (`.deb` / `.rpm`)

scripts/install.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ normalize_arch() {
6868
case "$raw_arch" in
6969
x86_64 | amd64) echo "amd64" ;;
7070
aarch64 | arm64) echo "arm64" ;;
71+
# linux/arm is published as armv6 only; armv7l is ABI-compatible.
7172
armv6l | armv7l) echo "armv6" ;;
7273
i386 | i686) echo "386" ;;
7374
*)
@@ -105,25 +106,38 @@ install_binary() {
105106
fail "install path exists but is not a directory: $target_dir"
106107
fi
107108

108-
if [ -w "$target_dir" ]; then
109-
install -m 0755 "$src_bin" "$target_bin"
110-
return
109+
if [ ! -d "$target_dir" ]; then
110+
if mkdir -p "$target_dir" 2>/dev/null; then
111+
:
112+
elif command -v sudo >/dev/null 2>&1; then
113+
sudo mkdir -p "$target_dir"
114+
else
115+
fail "could not create install directory: $target_dir"
116+
fi
111117
fi
112118

113-
if [ ! -e "$target_dir" ] && mkdir -p "$target_dir"; then
119+
if [ -w "$target_dir" ]; then
114120
install -m 0755 "$src_bin" "$target_bin"
115121
return
116122
fi
117123

118124
if command -v sudo >/dev/null 2>&1; then
119-
sudo mkdir -p "$target_dir"
120125
sudo install -m 0755 "$src_bin" "$target_bin"
121126
return
122127
fi
123128

124129
fail "install directory is not writable and sudo is unavailable: $target_dir"
125130
}
126131

132+
path_has_dir() {
133+
local dir="$1"
134+
case ":${PATH:-}:" in
135+
*":${dir}:"*) return 0 ;;
136+
*) return 1 ;;
137+
esac
138+
}
139+
140+
# Preflight: fail fast before downloads (curl/wget checked in download_to).
127141
need_cmd tar
128142
os="$(normalize_os)"
129143
arch="$(normalize_arch)"
@@ -163,4 +177,7 @@ tar -xzf "$archive_path" -C "$tmp_dir"
163177
install_binary "$tmp_dir/$BINARY_NAME" "$INSTALL_DIR"
164178

165179
log "installed to $INSTALL_DIR/$BINARY_NAME"
180+
if ! path_has_dir "$INSTALL_DIR"; then
181+
log "warning: $INSTALL_DIR is not on PATH; add it to your shell profile, e.g. export PATH=\"$INSTALL_DIR:\$PATH\""
182+
fi
166183
log "verify with: $BINARY_NAME --version"

0 commit comments

Comments
 (0)