-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_goose.sh
executable file
·63 lines (51 loc) · 1.66 KB
/
install_goose.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
echo "Installing Goose..."
if ! command -v curl &> /dev/null
then
echo "curl is required to install goose, please install it"
exit 1
fi
if ! command -v bzip2 &> /dev/null
then
echo "bzip2 is required to extract goose, installing it now"
sudo apt update
sudo apt install -y bzip2
fi
DOWNLOAD_DIR=$(mktemp -d)
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | bash -s -- -d $DOWNLOAD_DIR
if [ -f "$DOWNLOAD_DIR/goose" ]; then
sudo mv "$DOWNLOAD_DIR/goose" "$HOME/.local/bin/goose"
echo "Goose installed to $HOME/.local/bin"
else
echo "Goose binary not found in download directory."
exit 1
fi
rm -rf "$DOWNLOAD_DIR"
# Detect the shell
if [ -f "$HOME/.bashrc" ]; then
CONFIG_FILE="$HOME/.bashrc"
elif [ -f "$HOME/.zshrc" ]; then
CONFIG_FILE="$HOME/.zshrc"
else
echo "Could not find .bashrc or .zshrc, creating .bashrc"
CONFIG_FILE="$HOME/.bashrc"
touch "$CONFIG_FILE"
fi
# Set the path in the config file
if ! grep -q "export PATH="$HOME/.local/bin:\\\\\$PATH"" "$CONFIG_FILE"; then
echo "export PATH="$HOME/.local/bin:\\\\\$PATH"" >> "$CONFIG_FILE"
echo "Added export PATH to $CONFIG_FILE"
else
echo "PATH already configured in $CONFIG_FILE"
fi
echo "Please reload your shell (e.g. 'source ~/.bashrc', 'source ~/.zshrc') to apply changes in new sessions."
echo "Goose installation complete."
# Copy secrets.json to the same directory as the script (if it's not there)
if [ ! -f "./secrets.json" ]; then
echo "secrets.json not found in current directory, exiting"
exit 1
fi
cp "./secrets.json" "$HOME/secrets.json"
# Call set_env.sh
echo "Setting up environment variables..."
./set_env.sh