Skip to content

Commit cb01697

Browse files
committed
Align installer and README with release targets
1 parent 7c42670 commit cb01697

2 files changed

Lines changed: 44 additions & 26 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ sudo mv dusk /usr/local/bin/
4444
### From source
4545

4646
```bash
47-
# Using cargo (requires Rust 1.75+)
47+
# Using cargo (requires Rust 1.77+)
4848
cargo install dusk
4949

5050
# Or build manually
@@ -157,7 +157,7 @@ src/
157157
└── text_input.rs # Text input for search/filter
158158
```
159159

160-
**~4,100 lines of Rust** | **36 tests** | **0 clippy warnings**
160+
The codebase is a single Rust crate with focused modules for scanning, the disk tree model, configuration, and the terminal UI.
161161

162162
### Key Design Decisions
163163

@@ -180,6 +180,7 @@ src/
180180
| `humansize` | Human-readable file sizes |
181181
| `serde` + `toml` | Bookmark serialization |
182182
| `dirs` | XDG config directory paths |
183+
| `unicode-width` | Unicode-safe terminal text layout |
183184
| `anyhow` + `thiserror` | Error handling |
184185

185186
## License

install.sh

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,53 @@ get_latest_version() {
2929
curl -sL "https://api.github.com/repos/$REPO/releases/latest" | grep -o '"tag_name": ".*"' | cut -d'"' -f4
3030
}
3131

32+
resolve_target() {
33+
local os="$1"
34+
local arch="$2"
35+
36+
case "$os/$arch" in
37+
linux/x86_64) echo "x86_64-unknown-linux-musl" ;;
38+
macos/x86_64) echo "x86_64-apple-darwin" ;;
39+
macos/aarch64) echo "aarch64-apple-darwin" ;;
40+
*) echo "" ;;
41+
esac
42+
}
43+
3244
download_release() {
3345
local version="$1"
3446
local os="$2"
3547
local arch="$3"
36-
local ext="tar.gz"
37-
38-
if [ "$os" = "windows" ]; then
39-
ext="zip"
48+
local target
49+
target=$(resolve_target "$os" "$arch")
50+
51+
if [ -z "$target" ]; then
52+
echo "No prebuilt release for $os/$arch. Falling back to source install..."
53+
install_from_source
54+
return $?
4055
fi
41-
42-
local filename="dusk-${arch}-unknown-${os}-musl.${ext}"
56+
57+
local filename="dusk-${target}.tar.gz"
4358
local url="https://github.com/$REPO/releases/download/${version}/${filename}"
44-
45-
echo "Downloading dusk $version for $os/$arch..."
46-
curl -fSL "$url" -o "/tmp/dusk.${ext}" || return 1
47-
59+
local tmpdir
60+
tmpdir=$(mktemp -d)
61+
local archive="$tmpdir/$filename"
62+
63+
echo "Downloading dusk $version for $target..."
64+
curl -fSL "$url" -o "$archive" || {
65+
rm -rf "$tmpdir"
66+
return 1
67+
}
68+
4869
echo "Extracting..."
49-
tar xzf "/tmp/dusk.${ext}" -C /tmp 2>/dev/null || unzip -q "/tmp/dusk.${ext}" -d /tmp
50-
51-
local binary="/tmp/dusk"
52-
if [ ! -f "$binary" ]; then
53-
binary="/tmp/dusk-${version}-${arch}-unknown-${os}-musl/dusk"
54-
fi
55-
70+
tar xzf "$archive" -C "$tmpdir"
71+
72+
local binary="$tmpdir/dusk"
5673
if [ ! -f "$binary" ]; then
57-
echo "Error: Could not find extracted binary"
74+
echo "Error: Could not find extracted binary in $filename"
75+
rm -rf "$tmpdir"
5876
return 1
5977
fi
60-
78+
6179
echo "Installing to $INSTALL_DIR..."
6280
if [ "$FORCE" = "true" ] || [ -w "$INSTALL_DIR" ]; then
6381
mv "$binary" "$INSTALL_DIR/dusk"
@@ -66,17 +84,16 @@ download_release() {
6684
else
6785
echo "Error: Cannot write to $INSTALL_DIR (try with sudo)"
6886
echo " sudo mv $binary $INSTALL_DIR/dusk"
87+
rm -rf "$tmpdir"
6988
return 1
7089
fi
71-
72-
rm -f "/tmp/dusk.${ext}"
73-
rm -rf "/tmp/dusk-"*
74-
90+
91+
rm -rf "$tmpdir"
7592
return 0
7693
}
7794

7895
install_from_source() {
79-
echo "Building from source (requires Rust 1.75+)..."
96+
echo "Building from source (requires Rust 1.77+)..."
8097

8198
if ! command -v cargo &> /dev/null; then
8299
echo "Error: cargo not found. Install Rust from https://rustup.rs"

0 commit comments

Comments
 (0)