Upgrade and restart as separate system file
This commit is contained in:
@ -513,10 +513,11 @@ class IrisCore(object):
|
||||
})
|
||||
|
||||
# Run the system task
|
||||
subprocess.Popen(["sudo /home/iris/system.sh upgrade"], shell=True)
|
||||
path = os.path.dirname(__file__)
|
||||
subprocess.Popen(["sudo "+path+"/system.sh upgrade"], shell=True)
|
||||
|
||||
response = {
|
||||
'message': "Upgrade completed, restarting..."
|
||||
'message': "Upgrade started, server will restart when completed"
|
||||
}
|
||||
if (callback):
|
||||
callback(response)
|
||||
@ -532,10 +533,10 @@ class IrisCore(object):
|
||||
'params': {}
|
||||
})
|
||||
|
||||
subprocess.Popen(["sudo /home/iris/system.sh restart"], shell=True)
|
||||
# Run the system task
|
||||
path = os.path.dirname(__file__)
|
||||
subprocess.Popen(["sudo "+path+"/system.sh restart"], shell=True)
|
||||
|
||||
# Send callback if we have one, otherwise don't bother. We can't return anything
|
||||
# when we're rebooting ourselves...
|
||||
response = {
|
||||
'message': "Restarting... please wait"
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -73,7 +73,7 @@
|
||||
|
||||
// Release details
|
||||
// These are automatically injected to built HTML
|
||||
var build = "1523743020";
|
||||
var build = "1523861573";
|
||||
var version = "3.16.3";
|
||||
|
||||
// Construct the script tag
|
||||
|
||||
@ -1,18 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
ACTION=$1
|
||||
|
||||
if [ $ACTION = "upgrade" ]; then
|
||||
if [ $1 = "upgrade" ]; then
|
||||
UPGRADE=$(pip install --upgrade mopidy-iris)
|
||||
echo -e "$UPGRADE"
|
||||
|
||||
RESTART=$(service mopidy restart)
|
||||
echo -e "$RESTART"
|
||||
|
||||
elif [ $ACTION = "restart" ]; then
|
||||
|
||||
elif [ $1 = "restart" ]; then
|
||||
RESTART=$(service mopidy restart)
|
||||
echo -e "$RESTART"
|
||||
|
||||
fi
|
||||
|
||||
@ -8,11 +8,14 @@ export default function reducer(mopidy = {}, action){
|
||||
case 'MOPIDY_CONNECTING':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: true });
|
||||
|
||||
case 'MOPIDY_RESTARTING':
|
||||
case 'PUSHER_RESTART_MOPIDY':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: true, restarting: true });
|
||||
|
||||
case 'PUSHER_START_UPGRADE':
|
||||
return Object.assign({}, mopidy, { upgrading: true });
|
||||
|
||||
case 'MOPIDY_CONNECTED':
|
||||
return Object.assign({}, mopidy, { connected: true, connecting: false, restarting: false });
|
||||
return Object.assign({}, mopidy, { connected: true, connecting: false, restarting: false, upgrading: false });
|
||||
|
||||
case 'MOPIDY_DISCONNECTED':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: false });
|
||||
|
||||
@ -473,19 +473,6 @@ const PusherMiddleware = (function(){
|
||||
store.dispatch(uiActions.createNotification(data));
|
||||
break
|
||||
|
||||
case 'PUSHER_START_UPGRADE':
|
||||
ReactGA.event({ category: 'Pusher', action: 'Upgrade', label: '' })
|
||||
request(store, 'start_upgrade')
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch(uiActions.createNotification({content: response.message}));
|
||||
},
|
||||
error => {
|
||||
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
|
||||
}
|
||||
);
|
||||
break;
|
||||
|
||||
case 'PUSHER_RESTART':
|
||||
// Hard reload. This doesn't strictly clear the cache, but our compiler's
|
||||
// cache buster should handle that
|
||||
@ -493,25 +480,39 @@ const PusherMiddleware = (function(){
|
||||
break
|
||||
|
||||
case 'PUSHER_RESTART_MOPIDY':
|
||||
store.dispatch({type: 'MOPIDY_RESTARTING'});
|
||||
request(store, 'restart')
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch(uiActions.createNotification({content: response.message}));
|
||||
// No notification required
|
||||
},
|
||||
error => {
|
||||
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
|
||||
}
|
||||
);
|
||||
next(action);
|
||||
break
|
||||
|
||||
case 'PUSHER_START_UPGRADE':
|
||||
ReactGA.event({ category: 'Pusher', action: 'Upgrade', label: '' });
|
||||
request(store, 'start_upgrade')
|
||||
.then(
|
||||
response => {
|
||||
// No notification required
|
||||
},
|
||||
error => {
|
||||
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
|
||||
}
|
||||
);
|
||||
next(action);
|
||||
break;
|
||||
|
||||
case 'PUSHER_VERSION':
|
||||
ReactGA.event({ category: 'Pusher', action: 'Version', label: action.version.current })
|
||||
|
||||
if (action.version.upgrade_available){
|
||||
store.dispatch(uiActions.createNotification({content: 'Version '+action.version.latest+' is available. See settings to upgrade.'}));
|
||||
}
|
||||
next(action )
|
||||
next(action);
|
||||
break
|
||||
|
||||
case 'PUSHER_CONFIG':
|
||||
|
||||
@ -144,6 +144,19 @@ class Settings extends React.Component {
|
||||
</span>
|
||||
)
|
||||
|
||||
|
||||
if (this.props.mopidy.upgrading){
|
||||
var upgrade_button = (
|
||||
<button className="alternative working">
|
||||
Upgrading...
|
||||
</button>
|
||||
);
|
||||
} else if (this.props.pusher.version.upgrade_available){
|
||||
var upgrade_button = <button className="alternative" onClick={() => this.props.pusherActions.startUpgrade()}>Upgrade to { this.props.pusher.version.latest }</button>
|
||||
} else {
|
||||
var upgrade_button = null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="view settings-view">
|
||||
<Header className="overlay" icon="cog" title="Settings" options={options} uiActions={this.props.uiActions} />
|
||||
@ -258,16 +271,16 @@ class Settings extends React.Component {
|
||||
<div className="field">
|
||||
<div className="name">Version</div>
|
||||
<div className="input">
|
||||
<VersionManager />
|
||||
<span className="text">
|
||||
{this.props.pusher.version.current} installed {this.props.pusher.version.upgrade_available ? <span className="flag blue">Upgrade available</span> : null}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="field">
|
||||
<div className="name">Reset</div>
|
||||
<div className="input">
|
||||
<ConfirmationButton className="destructive" content="Reset all settings" confirmingContent="Are you sure?" onConfirm={() => this.resetAllSettings()} />
|
||||
<ConfirmationButton className="destructive" content="Restart server" confirmingContent="Are you sure?" workingContent="Restarting" working={this.props.mopidy.restarting} onConfirm={() => this.props.pusherActions.restartMopidy()} />
|
||||
</div>
|
||||
{upgrade_button}
|
||||
<button className={"destructive"+(this.props.mopidy.restarting ? ' working' : '')} onClick={e => this.props.pusherActions.restartMopidy()}>{this.props.mopidy.restarting ? 'Restarting...' : 'Restart server'}</button>
|
||||
<ConfirmationButton className="destructive" content="Reset all settings" confirmingContent="Are you sure?" onConfirm={() => this.resetAllSettings()} />
|
||||
</div>
|
||||
|
||||
<h4 className="underline">About</h4>
|
||||
|
||||
Reference in New Issue
Block a user