@@ -11,58 +11,59 @@ REPO_OWNER="HexmosTech"
11
11
REPO_NAME_CORE=" Lama2"
12
12
REPO_NAME_EXTENSION=" Lama2Code"
13
13
14
- # Function to determine OS and architecture
15
- get_platform () {
16
- architecture=" "
14
+ # Function to get system architecture
15
+ get_architecture () {
17
16
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 ;;
23
23
esac
24
24
}
25
25
26
+ # Function to get operating system
26
27
get_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
37
35
}
38
36
39
37
# Function to download and install the Lama2 binary
40
38
download_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 ' )
44
42
45
43
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} "
47
45
exit 1
48
46
fi
49
47
50
- # Determine platform
51
- get_platform
52
- get_os
48
+ # Get system information
49
+ ARCH= $( get_architecture )
50
+ OS= $( get_os)
53
51
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' )
56
55
57
56
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} "
59
58
exit 1
60
59
fi
61
60
62
61
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
+
64
64
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
66
67
sudo chmod +x /usr/local/bin/l2
67
68
}
68
69
@@ -116,7 +117,7 @@ command -v code >/dev/null 2>&1 || { echo -e >&2 "${RED}This script requires VS
116
117
download_and_install_l2
117
118
118
119
if 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} "
120
121
echo -e " ${YELLOW} Installed version:${NC} "
121
122
l2 --version
122
123
0 commit comments