@@ -13,47 +13,57 @@ os=$(
13
13
)
14
14
15
15
arch=$(
16
- case $( uname -m) in x86_64) echo -n amd64 ;; aarch64) echo -n arm64 ;; * ) echo -n $( uname -m ) ;; esac
16
+ uname -m
17
17
)
18
18
19
19
latest_package_urls () {
20
20
curl -s https://api.github.com/repos/crowdstrike/gofalcon/releases/latest | grep ' "browser_download_url":' | sed ' s/"$//g ; s/^.*browser_download_url": "//g'
21
21
}
22
22
23
- package_discriminator=$(
24
- case " ${os} " in
25
- darwin)
26
- if [ " $arch " = " amd64" ]; then
27
- echo " macOS"
23
+ case " ${os} " in
24
+ darwin)
25
+ if [ " ${arch} " = " amd64" ]; then
26
+ package_discriminator=" Darwin_x86_64"
27
+ elif [ " ${arch} " = " arm64" ]; then
28
+ package_discriminator=" Darwin_arm64"
29
+ else
30
+ die " Unsupported architecture for MacOS"
31
+ fi
32
+ ;;
33
+ linux)
34
+ pkg_arch=$(
35
+ if [ " ${arch} " = " x86_64" ] || [ " ${arch} " = " aarch64" ]; then
36
+ echo " ${arch} "
28
37
else
29
- die " Unsupported architecture"
38
+ die " Unsupported architecture for Linux "
30
39
fi
31
- ;;
32
- linux)
33
- pkg_arch=$(
34
- echo " $arch " | sed s/amd64/x86_64/g
35
- )
40
+ )
41
+
42
+ if type rpm > /dev/null 2>&1 ; then
43
+ package_discriminator=" ${pkg_arch} .rpm"
44
+ elif type dpkg > /dev/null 2>&1 ; then
45
+ package_discriminator=" ${pkg_arch} .deb"
46
+ else
47
+ die " Unsupported packaging system"
48
+ fi
49
+ ;;
50
+ * )
51
+ die " Unsupported OS"
52
+ ;;
53
+ esac
36
54
37
- if type rpm > /dev/null 2>&1 ; then
38
- echo " ${pkg_arch} .rpm"
39
- elif type dpkg > /dev/null 2>&1 ; then
40
- echo " ${pkg_arch} .deb"
41
- else
42
- die " Unsupported packaging system"
43
- fi
44
- ;;
45
- * )
46
- die " Unsupported OS"
47
- ;;
48
- esac
49
- )
50
55
package_url=$(
51
56
latest_package_urls | grep " $package_discriminator "
52
57
)
53
58
54
59
package_install () {
55
60
pkg=$1
56
- if type dnf > /dev/null 2>&1 ; then
61
+ if [ " $os " = " darwin" ]; then
62
+ file=$( basename " $pkg " )
63
+ curl -LO " $pkg "
64
+ tar -xzf " $file " -C /usr/local/bin/
65
+ rm " $file "
66
+ elif type dnf > /dev/null 2>&1 ; then
57
67
dnf install -q -y " $pkg " || rpm -ivh --nodeps " $pkg "
58
68
elif type yum > /dev/null 2>&1 ; then
59
69
yum install -q -y " $pkg " || rpm -ivh --nodeps " $pkg "
0 commit comments