You've already forked STARK
mirror of
https://github.com/MarkParker5/STARK.git
synced 2025-07-12 22:50:22 +02:00
Rename RPi to Raspi, comment fuzz
This commit is contained in:
39
Raspi/gitpull.py
Normal file
39
Raspi/gitpull.py
Normal file
@ -0,0 +1,39 @@
|
||||
from .RPi import *
|
||||
import os
|
||||
from Command import Callback
|
||||
import config
|
||||
################################################################################
|
||||
def reboot(params):
|
||||
if params['bool']:
|
||||
os.system('sudo systemctl restart archie')
|
||||
return {
|
||||
'text': 'Хорошо',
|
||||
'voice': 'Хорошо',
|
||||
'type': 'simple',
|
||||
}
|
||||
|
||||
reboot_cb = Callback(['$bool',])
|
||||
reboot_cb.setStart(reboot)
|
||||
|
||||
@RPi.background(answer = 'Проверяю обновления...', voice = 'Проверяю обновления')
|
||||
def method(params, finish_event):
|
||||
os.system('git -C '+config.path+' remote update')
|
||||
if not 'git pull' in os.popen('git -C '+config.path+' status -uno').read():
|
||||
finish_event.set()
|
||||
return {
|
||||
'text': 'Установлена последняя версия',
|
||||
'voice': 'Установлена последняя версия',
|
||||
'type': 'simple',
|
||||
}
|
||||
os.system('git -C '+config.path+' pull')
|
||||
finish_event.set()
|
||||
return {
|
||||
'text': 'Обновления скачаны. Перезагрузиться?',
|
||||
'voice': 'Обновления скачаны. Перезагрузиться?',
|
||||
'type': 'question',
|
||||
'callback': reboot_cb,
|
||||
}
|
||||
|
||||
patterns = ['* обновись *', '* можешь обновиться *', '* обнови себя *', '* скачай обновлени* *', '* провер* обновлени* *']
|
||||
gitpull = RPi('git pull archie.git', [], patterns)
|
||||
gitpull.setStart(method)
|
Reference in New Issue
Block a user