Support config directories

This commit is contained in:
David Baker 2019-12-13 11:13:44 +00:00
parent 98fa34f56f
commit e214c0f19f
3 changed files with 39 additions and 4 deletions

20
README
View file

@ -14,7 +14,8 @@ so the first step is to get a working copy of Riot. There are a few ways of doin
``` ```
# Fetch the prebuilt release Riot package from the riot.im GitHub releases page. The version # Fetch the prebuilt release Riot package from the riot.im GitHub releases page. The version
# fetched will be the same as the local riot-desktop package. # fetched will be the same as the local riot-desktop package.
yarn run fetch --noverify # We're explicitly asking for no config, so the package Riot will have no config.json.
yarn run fetch --noverify --cfgdir ''
``` ```
...or if you'd like to use GPG to verify the downloaded package: ...or if you'd like to use GPG to verify the downloaded package:
@ -24,14 +25,14 @@ yarn run fetch --noverify
# once. # once.
yarn run fetch --importkey yarn run fetch --importkey
# Fetch the package and verify the signature # Fetch the package and verify the signature
yarn run fetch yarn run fetch --cfgdir ''
``` ```
...or either of the above, but fetching a specific version of Riot: ...or either of the above, but fetching a specific version of Riot:
``` ```
# Fetch the prebuilt release Riot package from the riot.im GitHub releases page. The version # Fetch the prebuilt release Riot package from the riot.im GitHub releases page. The version
# fetched will be the same as the local riot-desktop package. # fetched will be the same as the local riot-desktop package.
yarn run fetch --noverify v1.5.6 yarn run fetch --noverify --cfgdir '' v1.5.6
``` ```
If you only want to run the app locally and don't need to build packages, you can If you only want to run the app locally and don't need to build packages, you can
@ -74,3 +75,16 @@ If you'd just like to run the electron app locally for development:
yarn add electron yarn add electron
yarn start yarn start
``` ```
Config
======
If you'd like the packaged Riot to have a configuration file, you can create a
config directory and place `config.json` in there, then specify this directory
with the `--cfgdir` option to `yarn run fetch`, eg:
```
mkdir myconfig
cp /path/to/my/config.json myconfig/
yarn run fetch --cfgdir myconfig
```
The config dir for the official Riot.im app is in `riot.im`. Ifb you use this,
your app will auto-update itself using builds from Riot.im.

View file

@ -1 +0,0 @@
export OSSLSIGNCODE_SIGNARGS='-pkcs11module /Library/Frameworks/eToken.framework/Versions/Current/libeToken.dylib -pkcs11engine /usr/local/lib/engines/engine_pkcs11.so -certs electron_app/riot.im/New_Vector_Ltd.pem -key 0a3271cbc1ec0fd8afb37f6bbe0cd65ba08d3b4d -t http://timestamp.comodoca.com -verbose'

View file

@ -58,6 +58,7 @@ async function main() {
let importkey = false; let importkey = false;
let pkgDir = 'packages'; let pkgDir = 'packages';
let deployDir = 'deploys'; let deployDir = 'deploys';
let cfgDir;
let targetVersion; let targetVersion;
while (process.argv.length > 2) { while (process.argv.length > 2) {
@ -76,6 +77,11 @@ async function main() {
process.argv.shift(); process.argv.shift();
deployDir = process.argv[2]; deployDir = process.argv[2];
break; break;
case '--cfgdir':
case '-d':
process.argv.shift();
cfgDir = process.argv[2];
break;
default: default:
targetVersion = process.argv[2]; targetVersion = process.argv[2];
} }
@ -119,6 +125,13 @@ async function main() {
return 0; return 0;
} }
if (cfgDir === undefined) {
console.log("No config directory set");
console.log("Specify a config directory with --cfgdir or -d");
console.log("To build with no config (and no auto-update), pass the empty string (-d '')");
return 1;
}
if (verify && !haveGpg) { if (verify && !haveGpg) {
console.log("No working GPG binary: install GPG or pass --noverify to skip verification"); console.log("No working GPG binary: install GPG or pass --noverify to skip verification");
return 1; return 1;
@ -186,6 +199,15 @@ async function main() {
} catch (e) { } catch (e) {
} }
if (cfgDir.length) {
const configJsonSource = path.join(cfgDir, 'config.json');
const configJsonDest = path.join(expectedDeployDir, 'config.json');
console.log(configJsonSource + ' -> ' + configJsonDest);
await fsPromises.copyFile(configJsonSource, configJsonDest);
} else {
console.log("Skipping config file");
}
console.log("Pack " + expectedDeployDir + " -> " + ASAR_PATH); console.log("Pack " + expectedDeployDir + " -> " + ASAR_PATH);
await asar.createPackage(expectedDeployDir, ASAR_PATH); await asar.createPackage(expectedDeployDir, ASAR_PATH);
console.log("Done!"); console.log("Done!");