-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare.sh
33 lines (28 loc) · 881 Bytes
/
prepare.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
#!/bin/bash
# This script is used to obtain latest release of NodeBB
WORKDIR=$HOME/nodebb
API=https://api.github.com/repos/NodeBB/NodeBB/releases/latest
DEV_DEPS="wget unzip"
REMOTE=$(curl -s $API | grep zipball_url | cut -d '"' -f 4)
VERSION=$(curl -s $API | grep tag_name | cut -d '"' -f 4)
# Show some useful information
echo "----------------------------------------"
echo "NodeBB version: $VERSION"
echo "Working directory: $WORKDIR"
echo "Remote URL: $REMOTE"
echo "----------------------------------------"
# Create working directory
rm -rf $WORKDIR
mkdir -p $WORKDIR
cd $WORKDIR
# Install dependencies, skip if SKIP_DEV_DEPS is set to 1
if [ $SKIP_DEV_DEPS -eq 0 ]; then
sudo apt-get update
sudo apt-get install -y $DEV_DEPS
fi
# Obtain latest release
wget $REMOTE -O nodebb.zip
unzip -qq nodebb.zip
rm nodebb.zip
mv NodeBB-NodeBB-*/* .
rm -rf NodeBB-NodeBB-*