add dd and ping git.wit.com
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
35a077bff1
commit
8f7a25d9c8
|
@ -34,7 +34,7 @@ func main() {
|
|||
|
||||
for {
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
ping := shell.Run("ping -c 1 localhost")
|
||||
ping := shell.Run("ping -c 1 git.wit.com")
|
||||
log.Println("ping returned ", ping)
|
||||
if (ping == 0) {
|
||||
break
|
||||
|
|
|
@ -8,6 +8,8 @@ import "github.com/gookit/config"
|
|||
import "github.com/andlabs/ui"
|
||||
import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
import "git.wit.com/jcarr/shell"
|
||||
|
||||
var mainwin *ui.Window
|
||||
var mydrive string
|
||||
|
||||
|
@ -27,6 +29,33 @@ func rsync(mybut *ui.Button) {
|
|||
}
|
||||
}
|
||||
|
||||
func dd(mybut *ui.Button) int {
|
||||
if _, err := os.Stat("/mnt/factory-image/lost+found/"); os.IsNotExist(err) {
|
||||
shell.Run("mkdir /mnt/factory-image/")
|
||||
shell.Run("mount /dev/sdb2 /mnt/factory-image/")
|
||||
}
|
||||
if _, err := os.Stat("/mnt/factory-image/lost+found/"); os.IsNotExist(err) {
|
||||
log.Println("partition is not mounted")
|
||||
ui.MsgBoxError(mainwin, "The partition is not mounted at /mnt/sdcard", "")
|
||||
return -1
|
||||
}
|
||||
|
||||
|
||||
script("dd if=/home/pinebook/factory/factory-pine14inch of=/dev/sdb status=progress bs=1M oflag=sync count=300");
|
||||
|
||||
log.Println("run rsync here")
|
||||
script(`
|
||||
rsync -av --progress --inplace /home/pinebook/factory/FACTORY-IMAGER-ROOTFS/ /mnt/sdcard/
|
||||
umount /mnt/sdcard
|
||||
`)
|
||||
ui.MsgBox(mainwin, "The sdcard is finished", "")
|
||||
} else {
|
||||
log.Println("partition is not mounted")
|
||||
ui.MsgBoxError(mainwin, "The partition is not mounted at /mnt/sdcard", "")
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// select the dev entry to partition and format
|
||||
// for example: /dev/mtdblock0 or /dev/sdc
|
||||
func selectDrive(mybox *ui.Combobox) {
|
||||
|
@ -105,6 +134,7 @@ func makeBurnSDcardPage() *ui.Box {
|
|||
|
||||
addButton(vbox2, "Partition and Format", format)
|
||||
addButton(vbox2, "rsync filesystem", rsync)
|
||||
addButton(vbox2, "dd image", dd)
|
||||
|
||||
return hbox
|
||||
}
|
||||
|
@ -133,7 +163,5 @@ func setupUI() {
|
|||
func main() {
|
||||
parseConfig()
|
||||
|
||||
// script("dd if=/home/pinebook/factory/factory-pine14inch of=/dev/sdb status=progress bs=1M oflag=sync count=300");
|
||||
|
||||
ui.Main(setupUI)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue