Skip to content
Snippets Groups Projects
Commit 81202600 authored by Sean McArthur's avatar Sean McArthur
Browse files

remove symlinks, added postinstall script

- unix symlinks are incompatible with Windows
- postinstall now generates keys, and sets up files

fixes #2263
parent dbae839c
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@
/resources/static/build
/resources/static/production
/resources/static/i18n
/resources/static/common/js/lib/bidbundle.js
/resources/static/dialog/views/site
.DS_Store
Thumbs.db
/locale
......@@ -18,4 +20,4 @@ Thumbs.db
/automation-tests/credentials.yaml
/automation-tests/sauce.yaml
automation-tests/persona_server/results/*
/automation-tests/chromedriver.log
\ No newline at end of file
/automation-tests/chromedriver.log
......@@ -47,7 +47,7 @@
},
"scripts": {
"preinstall": "./scripts/lockdown",
"postinstall": "node ./scripts/generate_ephemeral_keys.js",
"postinstall": "node ./scripts/postinstall.js",
"test": "./scripts/test",
"start": "node ./scripts/run_locally.js"
},
......
../../../../../node_modules/jwcrypto/bidbundle.js
\ No newline at end of file
../../../views/
\ No newline at end of file
......@@ -2,7 +2,7 @@
if [ ! -f $HOME/var/root.cert ] ; then
echo ">> generating keypair"
scripts/generate_ephemeral_keys.js
scripts/postinstall.js
mv var/root.{cert,secretkey} $HOME/var
else
echo ">> no keypair needed. you gots one"
......
// make symlinks
var fs = require('fs');
var path = require('path');
var existsSync = fs.existsSync || path.existsSync;
// symlink'ed directories work fine in both *nix and Windows
function relativeLink(src, dest) {
src = path.join(__dirname, src);
dest = path.join(__dirname, dest);
var destParent = path.dirname(dest);
var cwd = process.cwd();
process.chdir(destParent);
if (existsSync(dest)) {
fs.unlinkSync(dest);
}
var relSrc = path.relative(destParent, src);
fs.symlinkSync(relSrc, dest, 'junction');
process.chdir(cwd);
}
// Windows requires Administrator cmd prompt to make file links,
// so just make a copy instead.
function copy(src, dest) {
src = path.join(__dirname, src);
dest = path.join(__dirname, dest);
fs.writeFileSync(dest, fs.readFileSync(src));
}
copy('../node_modules/jwcrypto/bidbundle.js', '../resources/static/common/js/lib/bidbundle.js');
relativeLink('../resources/views', '../resources/static/dialog/views/site');
// generate ephemeral keys
var child_process = require('child_process');
function node(script) {
var cp = child_process.spawn('node', [path.join(__dirname, script)]);
cp.stdout.pipe(process.stdout);
cp.stderr.pipe(process.stderr);
}
node('./generate_ephemeral_keys.js');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment