-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add reboot script for post-v7.4.9 upgrade
- Loading branch information
1 parent
b2c5991
commit 496d1ac
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
SUB_DIR=reboot-749 | ||
SCRIPT_DIR=$(dirname $0) | ||
|
||
EXPORT_ROOT=${1-$LAMASSU_EXPORT} | ||
|
||
if [ -z "$EXPORT_ROOT" ] | ||
then | ||
echo "Builds an update package file for rebooting l-m and browser across aaeon-acp and ssuboard." | ||
echo -e "\nUsage:" | ||
echo -e "build <target directory>\n" | ||
exit 1 | ||
fi | ||
|
||
MACHINE_DIR=$SCRIPT_DIR/../.. | ||
EXPORT_BASE=$EXPORT_ROOT/$SUB_DIR | ||
EXPORT_DIR=$EXPORT_BASE/package | ||
UPDATESCRIPT=$SCRIPT_DIR/updatescript.js | ||
rm -rf $EXPORT_DIR | ||
mkdir -p $EXPORT_DIR | ||
|
||
# Needed for update script on target device | ||
cp $MACHINE_DIR/node_modules/async/lib/async.js $EXPORT_DIR | ||
cp $SCRIPT_DIR/../report.js $EXPORT_DIR | ||
cp $UPDATESCRIPT $EXPORT_DIR | ||
|
||
echo "Building..." | ||
node $SCRIPT_DIR/../build.js $EXPORT_BASE | ||
rm -rf $EXPORT_DIR | ||
echo "Complete." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
var cp = require('child_process'); | ||
var async = require('./async'); | ||
var report = require('./report').report; | ||
|
||
const hardwareCode = process.argv[2].toLowerCase(); | ||
var TIMEOUT = 10000; | ||
|
||
let restartCommand = null | ||
if (hardwareCode === 'aaeon') | ||
restartCommand = 'restart lamassu-machine; killall chromium-browser; killall start-chrome' | ||
else if (hardwareCode === 'ssuboard' || hardwareCode === 'upboard') | ||
restartCommand = 'supervisorctl restart lamassu-machine lamassu-browser' | ||
else restartCommand = '' | ||
|
||
function command(cmd, cb) { | ||
cp.exec(cmd, {timeout: TIMEOUT}, function(err) { | ||
cb(err); | ||
}); | ||
} | ||
|
||
async.series([ | ||
|
||
async.apply(command, restartCommand), | ||
async.apply(report, null, 'finished.') | ||
], function(err) { | ||
if (err) throw err; | ||
}); |