Skip to content

Commit 5a9a5f2

Browse files
committed
mod: rm system-wide changes and print instructions if system-wide changes are necessary
Signed-off-by: Josh Duffney <jduffney@microsoft.com>
1 parent 1f1aba5 commit 5a9a5f2

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

install.sh

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ print_error() {
5353
}
5454

5555
# Configuration
56-
BINARY_NAME="wassette" # Change this to your binary name
57-
GITHUB_REPO="microsoft/wassette" # GitHub repository (owner/repo)
58-
BASE_URL="https://api.github.com/repos/${GITHUB_REPO}/releases/latest" # Base download URL
59-
INSTALL_DIR="$HOME/.local/bin" # Installation directory
56+
BINARY_NAME="wassette"
57+
GITHUB_REPO="microsoft/wassette"
58+
BASE_URL="https://api.github.com/repos/${GITHUB_REPO}/releases/latest"
59+
INSTALL_DIR="$HOME/.local/bin"
6060

6161
# OS and Architecture detection
6262
get_os() {
@@ -110,7 +110,6 @@ get_latest_release_info() {
110110
exit 1
111111
fi
112112

113-
# Extract tag name (version) - using sed instead of grep -P for macOS compatibility
114113
local tag_name
115114
tag_name=$(echo "$api_response" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p' | head -1)
116115

@@ -124,10 +123,8 @@ get_latest_release_info() {
124123

125124
print_status "Latest version: $tag_name"
126125

127-
# Wassette binary naming: wassette_0.11.0_darwin_amd64.tar.gz (no 'v' prefix in filename)
128126
BINARY_ARCHIVE="${BINARY_NAME}_${version}_${PLATFORM}.tar.gz"
129127

130-
# Extract download URL for our platform - using sed instead of grep -P
131128
DOWNLOAD_URL=$(echo "$api_response" | sed -n 's/.*"browser_download_url": *"\([^"]*'"$BINARY_ARCHIVE"'[^"]*\)".*/\1/p' | head -1)
132129

133130
if [[ -z "$DOWNLOAD_URL" ]]; then
@@ -147,7 +144,6 @@ download_and_extract() {
147144
# Create temporary directory
148145
local tmp_dir
149146
tmp_dir=$(mktemp -d)
150-
print_status "Using temporary directory: $tmp_dir"
151147

152148
# Download the binary archive
153149
local archive_path="$tmp_dir/$BINARY_ARCHIVE"
@@ -275,22 +271,6 @@ if add_path_to_file "$HOME/.profile"; then
275271
modified_files+=("$HOME/.profile")
276272
fi
277273

278-
# Create a system-wide PATH file for immediate recognition
279-
print_status "Creating PATH configuration in /etc/environment (if writable)"
280-
if sudo -n true 2>/dev/null; then
281-
# We have sudo access
282-
if [[ -f /etc/environment ]]; then
283-
if ! sudo grep -q "$HOME/.local/bin" /etc/environment 2>/dev/null; then
284-
echo "PATH=\"$HOME/.local/bin:\$PATH\"" | sudo tee -a /etc/environment > /dev/null
285-
print_status "Added PATH to /etc/environment"
286-
fi
287-
fi
288-
else
289-
# Skip system-wide PATH configuration
290-
print_warning "Skipping system-wide PATH configuration in /etc/environment"
291-
print_warning "Consider manually adding '$HOME/.local/bin' to your PATH if needed"
292-
fi
293-
294274
# Update current session's PATH
295275
export PATH="$HOME/.local/bin:$PATH"
296276

@@ -316,16 +296,12 @@ print_status "Installation Summary:"
316296
echo " Binary: $BINARY_NAME"
317297
echo " Platform: $PLATFORM"
318298
echo " Location: $INSTALL_DIR/$BINARY_NAME"
319-
echo " Available in current session: Yes"
320299

321300
if [[ ${#modified_files[@]} -gt 0 ]]; then
322301
echo " Modified files:"
323302
for file in "${modified_files[@]}"; do
324303
echo " - $file"
325304
done
326-
echo ""
327-
print_status "The binary will be available in new bash sessions automatically."
328-
print_status "No need to source any files - just open a new terminal!"
329305
else
330306
echo ""
331307
print_warning "No shell configuration files were modified."
@@ -334,4 +310,5 @@ fi
334310

335311
echo ""
336312
print_status "You can now run '$BINARY_NAME' from any new terminal window."
313+
print_status "For system-wide access, you can manually add '$HOME/.local/bin' to your system PATH if needed."
337314
echo ""

0 commit comments

Comments
 (0)