@@ -11,58 +11,59 @@ REPO_OWNER="HexmosTech"
1111REPO_NAME_CORE=" Lama2"
1212REPO_NAME_EXTENSION=" Lama2Code"
1313
14- # Function to determine OS and architecture
15- get_platform () {
16- architecture=" "
14+ # Function to get system architecture
15+ get_architecture () {
1716 case $( uname -m) in
18- i386 | i686) architecture=" 386" ;;
19- x86_64) architecture=" amd64" ;;
20- arm) dpkg --print-architecture | grep -q " arm64" && architecture=" arm64" || architecture=" arm" ;;
21- arm64) architecture=" arm64" ;;
22- * ) echo -e " ${RED} Unsupported architecture: $( uname -m) ${NC} " ; exit 1 ;;
17+ i386) echo " 386" ;;
18+ i686) echo " 386" ;;
19+ x86_64) echo " amd64" ;;
20+ arm) dpkg --print-architecture | grep -q " arm64" && echo " arm64" || echo " arm" ;;
21+ arm64) echo " arm64" ;;
22+ * ) echo " unknown" && exit 1 ;;
2323 esac
2424}
2525
26+ # Function to get operating system
2627get_os () {
27- the_os=" "
28- case " $OSTYPE " in
29- linux-gnu* ) the_os=" linux" ;;
30- darwin* ) the_os=" darwin" ;;
31- cygwin | msys | win32 | freebsd* )
32- echo -e " ${RED} Installer not supported on this OS; please use release binary${NC} "
33- exit 1
34- ;;
35- * ) echo -e " ${RED} Unknown OS: $OSTYPE ${NC} " ; exit 1 ;;
36- esac
28+ if [[ " $OSTYPE " == " linux-gnu" * ]]; then
29+ echo " linux"
30+ elif [[ " $OSTYPE " == " darwin" * ]]; then
31+ echo " darwin"
32+ else
33+ echo " unsupported" && exit 1
34+ fi
3735}
3836
3937# Function to download and install the Lama2 binary
4038download_and_install_l2 () {
41- # Fetch the latest release information
42- echo -e " ${GREEN} Fetching latest release information...${NC} "
43- RELEASE_INFO=$( curl -s " https://api.github.com/repos/$REPO_OWNER /$REPO_NAME_CORE /releases/latest " )
39+ # Fetch the latest pre- release information
40+ echo -e " ${GREEN} Fetching latest pre- release information...${NC} "
41+ RELEASE_INFO=$( curl -s " https://api.github.com/repos/$REPO_OWNER /$REPO_NAME_CORE /releases" | jq ' [.[] | select(.prerelease == true)] | first ' )
4442
4543 if [ -z " $RELEASE_INFO " ] || [ " $RELEASE_INFO " = " null" ]; then
46- echo -e " ${RED} No release found${NC} "
44+ echo -e " ${RED} No pre- release found${NC} "
4745 exit 1
4846 fi
4947
50- # Determine platform
51- get_platform
52- get_os
48+ # Get system information
49+ ARCH= $( get_architecture )
50+ OS= $( get_os)
5351
54- # Extract the binary download URL for the specific platform
55- BINARY_URL=$( echo " $RELEASE_INFO " | jq -r --arg os " $the_os " --arg arch " $architecture " ' .assets[] | select(.name | endswith($os + "-" + $arch + ".tar.gz")) | .browser_download_url' )
52+ # Extract the binary download URL
53+ BINARY_URL=$( echo " $RELEASE_INFO " | jq -r --arg OS " $OS " --arg ARCH " $ARCH " ' .assets[] | select(.name | contains($OS) and contains($ARCH) and endswith(".tar.gz")) | .browser_download_url' )
54+ TAG_NAME=$( echo " $RELEASE_INFO " | jq -r ' .tag_name' )
5655
5756 if [ -z " $BINARY_URL " ] || [ " $BINARY_URL " = " null" ]; then
58- echo -e " ${RED} No binary file found for ${the_os} - ${architecture} in the latest release${NC} "
57+ echo -e " ${RED} No compatible binary file found in the latest pre- release${NC} "
5958 exit 1
6059 fi
6160
6261 echo -e " ${GREEN} Downloading l2 binary from $BINARY_URL ${NC} "
63- wget -O /tmp/l2_latest.tar.gz " $BINARY_URL "
62+ curl -L -o /tmp/l2_latest.tar.gz " $BINARY_URL "
63+
6464 tar -xvzf /tmp/l2_latest.tar.gz -C /tmp
65- sudo mv /tmp/l2 /usr/local/bin/l2
65+ sudo rm -f /usr/local/bin/l2 /usr/bin/l2
66+ sudo mv /tmp/l2 /usr/local/bin
6667 sudo chmod +x /usr/local/bin/l2
6768}
6869
@@ -116,7 +117,7 @@ command -v code >/dev/null 2>&1 || { echo -e >&2 "${RED}This script requires VS
116117download_and_install_l2
117118
118119if l2 --version > /dev/null 2>&1 ; then
119- echo -e " ${GREEN} Successfully installed Lama2 version; Type 'l2 <api_file>' to invoke Lama2${NC} "
120+ echo -e " ${GREEN} Successfully installed Lama2 beta version; Type 'l2 <api_file>' to invoke Lama2${NC} "
120121 echo -e " ${YELLOW} Installed version:${NC} "
121122 l2 --version
122123
0 commit comments