install (android): termux installer - #61

This commit is contained in:
Mickael Kerjean
2018-05-19 21:15:31 +10:00
committed by Mickael KERJEAN
parent 957e81ef0b
commit 192c81ab11
3 changed files with 72 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
const fs = require("fs"),
path = require("path");
const lines = fs.readFileSync(path.join(__dirname, "../../config_client.js"))
.toString()
.split("\n");
let isGitBlock = false;
for(let i=0, l=lines.length; i<l; i++){
let tmp;
if(lines[i].trim() === "git: {") isGitBlock = true;
else if(lines[i].trim() === "},") tmp = false;
if(isGitBlock === true) lines[i] = "//"+lines[i];
if(tmp === false) isGitBlock = false;
}
fs.writeFileSync(path.join(__dirname, "../../config_client.js"), lines.join("\n"));
+1
View File
@@ -0,0 +1 @@
module.exports = {};
+52
View File
@@ -0,0 +1,52 @@
#!/bin/bash
set -e
TERMUX_PATH=/data/data/com.termux/files
cd $TERMUX_PATH/usr/share
echo "======================="
echo "Nuage for Termux =="
echo "======================="
echo "> Install system dependencies"
apt install -y nodejs git g++ make
echo "> Install Nuage"
if [ ! -d "nuage" ]; then
git clone https://github.com/mickael-kerjean/nuage
cd nuage
else
cd nuage
git reset --hard
git pull origin master
fi
echo "> Configure Nuage for termux"
# get rid of nodegit until it's working (https://github.com/nodegit/nodegit/issues/1494)
cp .assets/scripts/git.js server/model/backend/git.js
sed -i '/nodegit/d' package.json
node .assets/scripts/configure_without_git.js
# setup node gyp for android build (node-sass compilation)
npm install node-gyp
node node_modules/node-gyp/bin/node-gyp.js configure > /dev/null 2>&1 || true # generate the "~/.node-gyp"
find ~/.node-gyp -name 'common.gypi' -exec sed -i "s/\-fPIE.*/\-fPIC' ],/g" {} \;
echo "> Installation"
npm install
npm run build
cat >> $TERMUX_PATH/usr/bin/nuage <<EOF
#!/bin/bash
node $TERMUX_PATH/usr/share/nuage/server/index.js &
EOF
chmod +x $TERMUX_PATH/usr/bin/nuage
echo "> Post install "
rm -rf ~/.node-gyp
echo "============================"
echo "COMPLETED"