2019-07-27 03:12:28 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-08-11 16:58:07 +03:00
|
|
|
echo "${_GREEN}BUILD STARTED${_RESET}"
|
|
|
|
|
2019-07-27 03:12:28 +03:00
|
|
|
# Clone source
|
|
|
|
if [ -d "$_XMRIG_CLONE_LOCATION" ]; then
|
|
|
|
|
|
|
|
# Change to clone directory
|
|
|
|
cd $_XMRIG_CLONE
|
|
|
|
|
2019-07-31 00:50:36 +03:00
|
|
|
if git branch | grep -q -m1 "* $_XMRIG_BRANCH"; then
|
|
|
|
# Pull changes from source
|
|
|
|
git pull
|
2019-07-27 03:12:28 +03:00
|
|
|
|
2019-07-31 00:50:36 +03:00
|
|
|
# Call function
|
|
|
|
build_xmrig
|
2019-07-30 23:38:13 +03:00
|
|
|
|
2019-07-31 00:50:36 +03:00
|
|
|
else
|
|
|
|
# Switch to required branch
|
|
|
|
git checkout $_XMRIG_BRANCH
|
2019-07-30 23:38:13 +03:00
|
|
|
|
2019-07-31 00:50:36 +03:00
|
|
|
# Pull changes from source
|
|
|
|
git pull
|
2019-07-27 03:12:28 +03:00
|
|
|
|
2019-07-31 00:50:36 +03:00
|
|
|
# Call function
|
|
|
|
build_xmrig
|
|
|
|
fi
|
2019-07-27 03:12:28 +03:00
|
|
|
else
|
|
|
|
# Clone the source
|
|
|
|
git clone $_XMRIG_REPO $_XMRIG_CLONE
|
|
|
|
|
|
|
|
# Change to clone directory
|
|
|
|
cd $_XMRIG_CLONE
|
|
|
|
|
|
|
|
# Fetch list of branches in origin
|
|
|
|
git branch -a
|
|
|
|
|
|
|
|
# Checkout required branch
|
|
|
|
git checkout $_XMRIG_BRANCH
|
|
|
|
|
|
|
|
# Call function
|
|
|
|
build_xmrig
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy binary to directory in env path
|
|
|
|
sudo cp $_XMRIG_BUILD_LOCATION/xmrig $_XMRIG_TARGET_LOCATION
|
|
|
|
|
|
|
|
cd $_WORK_DIR
|
|
|
|
|
2019-08-11 16:58:07 +03:00
|
|
|
echo "${_CYAN}BUILD STOPPED${_RESET}"
|
2019-07-27 03:12:28 +03:00
|
|
|
|