This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
2020-11-11 19:38:39 -05:00
|
|
|
(() => {
|
2020-11-11 21:02:58 -05:00
|
|
|
const log = require('signale');
|
2020-11-11 19:38:39 -05:00
|
|
|
const { execSync } = require('child_process');
|
|
|
|
|
const branch = 'master';
|
|
|
|
|
|
2020-11-11 21:02:58 -05:00
|
|
|
function update() {
|
|
|
|
|
const remoteHash = execSync('git ls-remote https://github.com/marcus13345/valnet.git').toString().split(/[\t\n]/g)[0].trim();
|
|
|
|
|
const localHash = execSync(`git rev-parse ${branch}`).toString().trim();
|
|
|
|
|
if(remoteHash !== localHash) {
|
|
|
|
|
log.info('remote hash:', remoteHash);
|
|
|
|
|
log.info('local hash: ', localHash);
|
2020-11-11 21:49:42 -05:00
|
|
|
log.info('attempting to fetch new version');
|
2020-11-11 21:42:23 -05:00
|
|
|
|
2020-11-11 21:49:42 -05:00
|
|
|
execSync(`git fetch`);
|
|
|
|
|
execSync(`git pull`);
|
|
|
|
|
log.info('restarting relay...');
|
2020-11-11 21:02:58 -05:00
|
|
|
process.exit(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-11 19:38:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-11 21:45:49 -05:00
|
|
|
require('./index.js');
|
2020-11-11 19:38:39 -05:00
|
|
|
|
2020-11-11 21:02:58 -05:00
|
|
|
setInterval(update, 5000);
|
2020-11-11 19:38:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})();
|