This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_nw_install
executable file
·104 lines (90 loc) · 2.63 KB
/
check_nw_install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
##############################################################################
# #
# File to check if node-webkit is installed. This is only needed for #
# development, as the final release package is a concatenated version of the #
# node-webkit binary and the app itself. #
# #
##############################################################################
test "." != "$(dirname $0)" && pushd $(dirname $0)
CHECK_WICH=$(which nw)
if [ ! -z $CHECK_NW ] || [ -f ./bin/nw ];
then
echo "node-webkit installed"
exit 0
fi
echo "node-webkit not installed."
# Determine OS type
case $OSTYPE in
linux-*)
# All linux systems
echo "Detected linux system"
OS="linux"
FT=".tar.gz"
;;
darwin*)
# All MacOS X releases
echo "Detected Mac OS X system"
OS="mac"
FT=".zip"
;;
cygwin)
# Cygwin / Windows
echo "Detected Cygwin / Windows OS"
OS="win32"
FT=".zip"
;;
*)
echo "Unsupported OS"
exit 255
;;
esac
ARCH_APPEND=""
# Only linux gets a different package for 64-bit architecture
if [ $OS == "linux" ]
then
ARCH=$(uname -i)
case $ARCH in
x86_64)
# 64-bit architecture
echo "Detected 64-bit processor architecture"
ARCH_APPEND="_x64"
;;
*86)
# 32-bit architecture
echo "Detected 32-bit processor architecture"
ARCH_APPEND="_x32"
;;
*)
echo "Unsupported architecture"
exit 255
;;
esac
fi
NW_DL_PATH="/tmp/nw${FT}"
DL_NAME="http://s3.amazonaws.com/node-webkit/nw_release_${OS}${ARCH_APPEND}${FT}"
echo "Getting node-webkit binary for $ARCH and $OSTYPE"
wget -O ${NW_DL_PATH} ${DL_NAME} \
|| $(echo "Could not retrieve node-webkit binary"; exit 255)
if [ ! -d ./bin/ ]
then
echo "No bin-directory in home folder, creating it"
mkdir ./bin
fi
if [ $FT == ".zip" ]
then
unzip $NW_DL_PATH -d ./bin/
elif [ $FT == ".tar.gz" ]
then
tar xfz $NW_DL_PATH -C ./bin/
fi
rm $NW_DL_PATH
mv ./bin/nw_release_${OS}${ARCH_APPEND}/* ./bin/
rmdir ./bin/nw_release_${OS}${ARCH_APPEND}
echo "node-webkit installed.";echo;echo;
echo "IMPORTANT: If ~/bin/ is not already in your PATH please add it, so you "
echo "can use the nw command without providing the path to the binary."
echo;echo;
echo "Press [ENTER] to continue."
read
test -z $pushed || popd