-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·51 lines (46 loc) · 1.45 KB
/
build.sh
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
# Licensed under Apache Version 2.0
# Please see the LICENSE file in the root directory of the project for more
# information
#!/usr/bin/env bash
if [ "$(whoami)" != "root" ]
then
echo "The root user is required to install the packages required to build the application"
echo "Please enter your password to continue"
sudo -s
fi
if ! foobar_loc="$(type -p "npm")" || [[ -z $foobar_loc ]]; then
echo "Could not find npm, please install npm"
echo ""
else
echo "Installing the latest version(s) of the projects' dependencies..."
npm install --production> "/dev/null" 2>&1
while ! foobar_loc="$(type -p "pkg")" || [[ -z $foobar_loc ]]
do
read -p "Could not find pkg, which is reqiured to build GAM. Do you want to install pkg? (y/n)" choice
case "$choice" in
y|Y|yes|Yes ) sudo npm i -g pkg -s
echo "Installed pkg successfully";;
n|N|no|No ) echo "pkg is required to build, exiting program";;
* ) echo "Invalid response, please try again";;
esac
done
fi
echo ""
mkdir -p executables
echo "Creating executables..."
echo ""
pkg --out-path $PWD/executables $PWD/src/manager.js
echo ""
echo "Created executables successfully"
echo ""
while true
do
read -p "Do you want to uninstall pkg? (y/n)" choice
case "$choice" in
y|Y|yes|Yes ) sudo npm i -g pkg -s
echo "Uninstalled pkg successfully"
break;;
n|N|no|No ) break;;
* ) echo "Invalid response, please try again";;
esac
done