Skip to content

Commit 53696f3

Browse files
committed
add linux installer script
1 parent a501f8c commit 53696f3

4 files changed

Lines changed: 154 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Added `install.sh` for Linux CLI installs via `curl -fsSL https://raw.githubusercontent.com/ppotepa/rpack/main/install.sh | bash`.
10+
711
## [0.1.22] - 2026-06-15
812

913
### Added

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ The MSI installs `rpack.exe`, `rpack-open.exe`, associates `.rpack` files with
7474
rpack, and adds the installation directory to `PATH`.
7575
Open a new terminal after installation if `rpack` is not immediately found.
7676

77+
Install or update the CLI on Linux with one command:
78+
79+
```bash
80+
curl -fsSL https://raw.githubusercontent.com/ppotepa/rpack/main/install.sh | bash
81+
```
82+
83+
The script clones or updates `https://github.com/ppotepa/rpack.git`, installs a
84+
user-local .NET SDK 10 if needed, publishes `src/Rpack.Cli`, and writes
85+
`~/.local/bin/rpack`. It does not install the Windows `rpack-open` GUI.
86+
7787
You can also build from source:
7888

7989
```bash

install.sh

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
repo_url="${RPACK_REPO_URL:-https://github.com/ppotepa/rpack.git}"
5+
branch="${RPACK_BRANCH:-main}"
6+
source_dir="${RPACK_SOURCE_DIR:-$HOME/.local/share/rpack/source}"
7+
publish_dir="${RPACK_PUBLISH_DIR:-$HOME/.local/share/rpack/publish}"
8+
bin_dir="${RPACK_BIN_DIR:-$HOME/.local/bin}"
9+
dotnet_dir="${RPACK_DOTNET_DIR:-$HOME/.dotnet}"
10+
dotnet_channel="${RPACK_DOTNET_CHANNEL:-10.0}"
11+
12+
log() {
13+
printf 'rpack installer: %s\n' "$*"
14+
}
15+
16+
fail() {
17+
printf 'rpack installer: %s\n' "$*" >&2
18+
exit 1
19+
}
20+
21+
has_command() {
22+
command -v "$1" >/dev/null 2>&1
23+
}
24+
25+
download() {
26+
local url="$1"
27+
local output="$2"
28+
29+
if has_command curl; then
30+
curl -fsSL "$url" -o "$output"
31+
return
32+
fi
33+
34+
if has_command wget; then
35+
wget -qO "$output" "$url"
36+
return
37+
fi
38+
39+
fail "curl or wget is required."
40+
}
41+
42+
ensure_git() {
43+
if ! has_command git; then
44+
fail "git is required. Install git with your distribution package manager and rerun this script."
45+
fi
46+
}
47+
48+
dotnet_has_required_sdk() {
49+
has_command dotnet && dotnet --list-sdks 2>/dev/null | grep -Eq "^${dotnet_channel}[.]"
50+
}
51+
52+
ensure_dotnet() {
53+
if [ -x "$dotnet_dir/dotnet" ]; then
54+
export DOTNET_ROOT="$dotnet_dir"
55+
export PATH="$dotnet_dir:$PATH"
56+
fi
57+
58+
if dotnet_has_required_sdk; then
59+
return
60+
fi
61+
62+
log ".NET SDK ${dotnet_channel} not found; installing user-local SDK to ${dotnet_dir}"
63+
mkdir -p "$dotnet_dir"
64+
65+
local installer
66+
installer="$(mktemp)"
67+
download "https://dot.net/v1/dotnet-install.sh" "$installer"
68+
bash "$installer" --channel "$dotnet_channel" --install-dir "$dotnet_dir"
69+
rm -f "$installer"
70+
71+
export DOTNET_ROOT="$dotnet_dir"
72+
export PATH="$dotnet_dir:$PATH"
73+
74+
dotnet_has_required_sdk || fail "failed to install .NET SDK ${dotnet_channel}."
75+
}
76+
77+
sync_source() {
78+
mkdir -p "$(dirname "$source_dir")"
79+
80+
if [ -d "$source_dir/.git" ]; then
81+
log "updating ${source_dir}"
82+
git -C "$source_dir" fetch origin "$branch"
83+
git -C "$source_dir" checkout "$branch"
84+
git -C "$source_dir" pull --ff-only origin "$branch"
85+
return
86+
fi
87+
88+
if [ -e "$source_dir" ]; then
89+
fail "${source_dir} exists but is not a git repository. Set RPACK_SOURCE_DIR or remove that directory."
90+
fi
91+
92+
log "cloning ${repo_url} into ${source_dir}"
93+
git clone --branch "$branch" "$repo_url" "$source_dir"
94+
}
95+
96+
publish_rpack() {
97+
log "publishing rpack CLI"
98+
rm -rf "$publish_dir"
99+
mkdir -p "$publish_dir"
100+
101+
dotnet publish "$source_dir/src/Rpack.Cli/Rpack.Cli.csproj" \
102+
--configuration Release \
103+
--self-contained false \
104+
--output "$publish_dir"
105+
}
106+
107+
install_launcher() {
108+
mkdir -p "$bin_dir"
109+
110+
cat > "$bin_dir/rpack" <<EOF
111+
#!/usr/bin/env bash
112+
if [ -x "${dotnet_dir}/dotnet" ]; then
113+
export DOTNET_ROOT="${dotnet_dir}"
114+
export PATH="${dotnet_dir}:\$PATH"
115+
fi
116+
exec dotnet "${publish_dir}/rpack.dll" "\$@"
117+
EOF
118+
119+
chmod +x "$bin_dir/rpack"
120+
}
121+
122+
main() {
123+
ensure_git
124+
ensure_dotnet
125+
sync_source
126+
publish_rpack
127+
install_launcher
128+
129+
log "installed $("$bin_dir/rpack" version 2>/dev/null || printf 'rpack')"
130+
log "binary: ${bin_dir}/rpack"
131+
132+
case ":$PATH:" in
133+
*":$bin_dir:"*) ;;
134+
*) log "add ${bin_dir} to PATH if 'rpack' is not found in a new shell." ;;
135+
esac
136+
}
137+
138+
main "$@"

progress.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# rpack Progress
22

3-
Last updated: 2026-06-14
3+
Last updated: 2026-06-15
44

55
## Done
66

@@ -56,6 +56,7 @@ Last updated: 2026-06-14
5656
- Added `PackageJobRunner`, `GuiResultMapper`, and `GuiIssueViewModel`, and routed `OpenBatchForm` check/apply orchestration through shared `Rpack.App` use cases.
5757
- Added docs for architecture, package formats, validation, diagnostics, agent packages, state, actions, LLM authoring, and repair flow.
5858
- Updated top-level docs after the fake-project E2E scenarios: README now reflects the current project layout and agent package commands, and `docs/testing.md` documents the single-package and five-package CLI scenarios.
59+
- Added `install.sh` and README instructions for one-command Linux CLI install/update via `curl ... | bash`.
5960
- Added fixtures-backed golden tests for agent package-root flows and current `rpack-v1` package creation/inspection.
6061
- Added a fake-project end-to-end CLI scenario that creates, inspects, applies, and undoes a package on a synthetic repository.
6162
- Added an incremental fake-project end-to-end CLI scenario that creates and applies five sequential feature packages, each changing at least three files.

0 commit comments

Comments
 (0)