add update.sh ,RUNSH

This commit is contained in:
cuu 2018-12-08 15:30:07 +08:00
parent 04f8f9096c
commit 748174b83a
5 changed files with 33 additions and 7 deletions

View File

@ -53,13 +53,8 @@ func (self *UpdateConfirmPage) KeyDown(ev *event.Event) {
if ev.Data["Key"] == UI.CurKeys["B"] { if ev.Data["Key"] == UI.CurKeys["B"] {
if self.GIT == true { if self.GIT == true {
cmdpath := fmt.Sprintf("feh --bg-center %s/sysgo/gameshell/wallpaper/updating.png; cd %s ;git pull; git reset --hard %s ; feh --bg-center %s/sysgo/gameshell/wallpaper/loading.png ", cmdpath := fmt.Sprintf("update.sh %s ",self.Version)
launchergo_path, event.Post(UI.RUNSH,cmdpath)
launchergo_path,
self.Version,
launchergo_path )
event.Post(UI.RUNEVT,cmdpath)
return return
} }
} }

20
main.go
View File

@ -264,6 +264,7 @@ func run() int {
//fmt.Println(main_screen) //fmt.Println(main_screen)
event.AddCustomEvent(UI.RUNEVT) event.AddCustomEvent(UI.RUNEVT)
event.AddCustomEvent(UI.RUNSH)
go FlashLed1(main_screen) go FlashLed1(main_screen)
go InspectionTeam(main_screen) go InspectionTeam(main_screen)
@ -300,6 +301,25 @@ func run() int {
fmt.Println(err) fmt.Println(err)
} }
os.Exit(0) os.Exit(0)
case UI.RUNSH:
main_screen.OnExitCb()
gogame.Quit()
fmt.Println("RUNSH")
exec_app_cmd := ev.Data["Msg"]
fmt.Println(exec_app_cmd)
cmd := exec.Command("/bin/sh",exec_app_cmd)
err := cmd.Start()
if err != nil {
fmt.Println(err)
}
err = cmd.Process.Release()
if err != nil {
fmt.Println(err)
}
os.Exit(0)
} }

View File

@ -4,4 +4,5 @@ package UI
const ( const (
RUNEVT=1 RUNEVT=1
RESTARTUI=2 RESTARTUI=2
RUNSH=3
) )

View File

@ -148,6 +148,7 @@ func (self *TitleBar) RoundRobinCheck() {
self.CheckBatteryStat() self.CheckBatteryStat()
///self.CheckBluetooth() ///self.CheckBluetooth()
self.UpdateWifiStrength() self.UpdateWifiStrength()
SwapAndShow()
}else if self.InLowBackLight >= 0 { }else if self.InLowBackLight >= 0 {
self.InLowBackLight +=1 self.InLowBackLight +=1

9
update.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
feh --bg-center /home/cpi/launchergo/sysgo/gameshell/wallpaper/updating.png
cd /home/cpi/launchergo
git pull
git reset --hard $1
feh --bg-center /home/cpi/launchergo/sysgo/gameshell/wallpaper/loading.png
./load.sh