Skip to content

Commit 500f5f8

Browse files
committed
added install file
1 parent 0aa991a commit 500f5f8

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

get-beamstack.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
set -e
3+
BINARY_NAME="beamstack"
4+
5+
download_binary() {
6+
echo "Downloading the binary..."
7+
curl -L -o /tmp/${BINARY_NAME} "https://raw.githubusercontent.com/beamstackproj/beamstack-cli/main/releases/latest/beamstack-linux-amd64"
8+
if [ ! -f /tmp/${BINARY_NAME} ]; then
9+
echo "Error: Binary download failed."
10+
exit 1
11+
fi
12+
}
13+
14+
install_binary() {
15+
echo "Creating directories..."
16+
mkdir -p ~/."$BINARY_NAME"
17+
mkdir -p ~/."$BINARY_NAME"/config
18+
mkdir -p ~/."$BINARY_NAME"/profiles
19+
20+
echo "Creating config file..."
21+
if [ ! -f ~/."$BINARY_NAME"/config/config.json ]; then
22+
cat <<EOF > ~/."$BINARY_NAME"/config/config.json
23+
{
24+
"version": "1.0.0",
25+
"contexts": {}
26+
}
27+
EOF
28+
echo "Created new config file: ${CONFIG_FILE}"
29+
fi
30+
31+
# TODO: UPDATE version
32+
echo "Moving binary to /usr/local/bin..."
33+
sudo mv /tmp/${BINARY_NAME} /usr/local/bin/${BINARY_NAME}
34+
sudo chmod +x /usr/local/bin/${BINARY_NAME}
35+
36+
echo "Setting permissions..."
37+
sudo chmod -R 777 ~/."$BINARY_NAME"
38+
39+
echo "${BINARY_NAME} installed..!"
40+
}
41+
42+
download_binary
43+
install_binary

0 commit comments

Comments
 (0)