[IMP] hw_posbox_upgrade: new upgrading process for v13 posbox
This calls ~/posbox_update.sh, which will simple do a git pull followed by a reboot.
This commit is contained in:
parent
5fa75bded1
commit
fa279c3206
|
@ -36,16 +36,16 @@ index_template = """
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
For more information on how to setup the Point of Sale with
|
For more information on how to setup the Point of Sale with
|
||||||
the PosBox, please refer to <a href='/hw_proxy/static/doc/manual.pdf'>the manual</a>
|
the PosBox, please refer to <a href='/hw_proxy/static/doc/manual.pdf'>the manual</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
To see the status of the connected hardware, please refer
|
To see the status of the connected hardware, please refer
|
||||||
to the <a href='/hw_proxy/status'>hardware status page</a>
|
to the <a href='/hw_proxy/status'>hardware status page</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The PosBox software installed on this posbox is <b>version 13</b>,
|
The PosBox software installed on this posbox is <b>version 13</b>,
|
||||||
the posbox version number is independent from Odoo. You can upgrade
|
the posbox version number is independent from Odoo. You can upgrade
|
||||||
the software on the <a href='/hw_proxy/upgrade/'>upgrade page</a>
|
the software on the <a href='/hw_proxy/upgrade/'>upgrade page</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>For any other question, please contact the Odoo support at <a href='mailto:support@odoo.com'>support@odoo.com</a>
|
<p>For any other question, please contact the Odoo support at <a href='mailto:support@odoo.com'>support@odoo.com</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -29,17 +29,8 @@ upgrade_template = """
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url:'/hw_proxy/perform_upgrade/'
|
url:'/hw_proxy/perform_upgrade/'
|
||||||
}).then(function(status){
|
}).then(function(status){
|
||||||
$('#upgrade').html('Upgrade Successful<br \\>Click to Restart the PosBox');
|
$('#upgrade').html('Upgrade successful, restarting the posbox...');
|
||||||
$('#upgrade').off('click');
|
$('#upgrade').off('click');
|
||||||
$('#upgrade').click(function(){
|
|
||||||
$.ajax({ url:'/hw_proxy/perform_restart' })
|
|
||||||
$('#upgrade').text('Restarting');
|
|
||||||
$('#upgrade').off('click');
|
|
||||||
setTimeout(function(){
|
|
||||||
window.location = '/'
|
|
||||||
},30*1000);
|
|
||||||
});
|
|
||||||
|
|
||||||
},function(){
|
},function(){
|
||||||
$('#upgrade').text('Upgrade Failed');
|
$('#upgrade').text('Upgrade Failed');
|
||||||
});
|
});
|
||||||
|
@ -95,7 +86,6 @@ class PosboxUpgrader(hw_proxy.Proxy):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(PosboxUpgrader,self).__init__()
|
super(PosboxUpgrader,self).__init__()
|
||||||
self.upgrading = threading.Lock()
|
self.upgrading = threading.Lock()
|
||||||
self.last_upgrade = 0
|
|
||||||
|
|
||||||
@http.route('/hw_proxy/upgrade', type='http', auth='none', )
|
@http.route('/hw_proxy/upgrade', type='http', auth='none', )
|
||||||
def upgrade(self):
|
def upgrade(self):
|
||||||
|
@ -104,25 +94,8 @@ class PosboxUpgrader(hw_proxy.Proxy):
|
||||||
@http.route('/hw_proxy/perform_upgrade', type='http', auth='none')
|
@http.route('/hw_proxy/perform_upgrade', type='http', auth='none')
|
||||||
def perform_upgrade(self):
|
def perform_upgrade(self):
|
||||||
self.upgrading.acquire()
|
self.upgrading.acquire()
|
||||||
if time.time() - self.last_upgrade < 30:
|
|
||||||
self.upgrading.release()
|
|
||||||
return 'UPTODATE'
|
|
||||||
else:
|
|
||||||
os.system('/bin/bash /home/pi/odoo/posbox/update.sh')
|
|
||||||
self.last_upgrade = time.time()
|
|
||||||
self.upgrading.release()
|
|
||||||
return 'SUCCESS'
|
|
||||||
|
|
||||||
@http.route('/hw_proxy/perform_restart', type='http', auth='none')
|
|
||||||
def perform_restart(self):
|
|
||||||
self.upgrading.acquire()
|
|
||||||
if time.time() - self.last_upgrade < 30:
|
|
||||||
self.upgrading.release()
|
|
||||||
return 'RESTARTED'
|
|
||||||
else:
|
|
||||||
os.system('/bin/bash /home/pi/odoo/posbox/restart.sh')
|
|
||||||
self.last_upgrade = time.time()
|
|
||||||
self.upgrading.release()
|
|
||||||
return 'SUCCESS'
|
|
||||||
|
|
||||||
|
os.system('/home/pi/posbox_update.sh')
|
||||||
|
|
||||||
|
self.upgrading.release()
|
||||||
|
return 'SUCCESS'
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
sudo mount -o remount,rw /
|
||||||
|
sudo git --work-tree=/home/pi/odoo/ --git-dir=/home/pi/odoo/.git pull
|
||||||
|
sudo mount -o remount,ro /
|
||||||
|
(sleep 5 && sudo reboot) &
|
Loading…
Reference in New Issue