@@ -7,19 +7,17 @@ echo "Installing Nimbus CLI..."
77REPO=" infraspecdev/faas-engine-go"
88INSTALL_DIR=" ${INSTALL_DIR:-/ usr/ local/ bin} "
99
10- # Check dependencies
11- for cmd in curl; do
12- if ! command -v $cmd > /dev/null 2>&1 ; then
13- echo " Error: $cmd is required"
14- exit 1
15- fi
16- done
10+ # Check dependency
11+ if ! command -v curl > /dev/null 2>&1 ; then
12+ echo " Error: curl is required"
13+ exit 1
14+ fi
1715
18- # Get version (allow override via VERSION env var )
16+ # Get version (allow override)
1917VERSION=" ${1:- } "
2018if [ -z " $VERSION " ]; then
2119 echo " Fetching latest version..."
22- VERSION=$( curl -s https://api.github.com/repos/$REPO /releases/latest | grep -o ' "tag_name":" [^"]*' | cut -d ' " ' -f4 )
20+ VERSION=$( curl -s https://api.github.com/repos/$REPO /releases/latest | sed -n ' s/.* "tag_name": *"\( [^"]*\)".*/\1/p ' )
2321fi
2422
2523if [ -z " $VERSION " ]; then
2927
3028echo " Version: $VERSION "
3129
32- # Detect OS and Architecture
30+ # Detect OS and architecture
3331OS=" $( uname -s) "
3432ARCH=" $( uname -m) "
3533
3634case " $OS " in
37- Linux)
35+ Linux)
3836 case " $ARCH " in
3937 x86_64) FILE=" nimbus-linux-amd64-$VERSION " ;;
4038 aarch64) FILE=" nimbus-linux-arm64-$VERSION " ;;
5755URL=" https://github.com/$REPO /releases/download/$VERSION /$FILE "
5856TMPFILE=$( mktemp)
5957
60- # Download with cleanup on error
6158trap " rm -f $TMPFILE " EXIT
6259
63- echo " Downloading binary from $URL ..."
64- if ! curl -fL --progress-bar -o " $TMPFILE " " $URL " ; then
65- echo " Error: Failed to download"
66- exit 1
67- fi
60+ echo " Downloading binary..."
61+ curl -fL --progress-bar -o " $TMPFILE " " $URL "
6862
6963chmod +x " $TMPFILE "
7064
71- # Verify directory and permissions
7265if [ ! -d " $INSTALL_DIR " ]; then
7366 echo " Error: Install directory $INSTALL_DIR does not exist"
7467 exit 1
7568fi
7669
77- # Install
7870echo " Installing to $INSTALL_DIR ..."
7971
80- if ! sudo mv " $TMPFILE " " $INSTALL_DIR /nimbus" 2> /dev/null; then
81- if [ " $EUID " -ne 0 ]; then
82- echo " Error: Insufficient permissions. Try running with sudo or as root."
83- exit 1
84- fi
85- echo " Error: Failed to move binary"
86- exit 1
72+ if [ " $EUID " -ne 0 ]; then
73+ sudo mv " $TMPFILE " " $INSTALL_DIR /nimbus"
74+ else
75+ mv " $TMPFILE " " $INSTALL_DIR /nimbus"
8776fi
8877
89- echo " ✓ Installation complete"
90- echo " Run: nimbus --help"
78+ echo " Installation complete"
79+ echo " Run: nimbus --help"
80+
81+ # PATH warning
82+ if ! command -v nimbus > /dev/null 2>&1 ; then
83+ echo " Warning: $INSTALL_DIR is not in your PATH"
84+ echo " Add it using:"
85+ echo " export PATH=\$ PATH:$INSTALL_DIR "
86+ fi
0 commit comments