diff --git a/get-image/main.go b/get-image/main.go index 47f29ee..327e5ee 100644 --- a/get-image/main.go +++ b/get-image/main.go @@ -12,11 +12,14 @@ import "git.wit.com/jcarr/shell" func main() { parseConfig() - if _, err := os.Stat("/home/factory"); !os.IsNotExist(err) { - } else { + if _, err := os.Stat("/home/factory"); os.IsNotExist(err) { shell.Run("mkdir /home/factory") } + if _, err := os.Stat("/usr/bin/dialog"); os.IsNotExist(err) { + shell.Run("apt install dialog") + } + if _, err := os.Stat("/dev/mmcblk0p2"); !os.IsNotExist(err) { log.Println("device /dev/mmcblk0p2 exists") } else { @@ -38,7 +41,7 @@ func main() { if _, err := os.Stat(fullname); !os.IsNotExist(err) { log.Println("filename", fullname, "exists. dd here") - shell.Run("dd " + fullname + " of=/dev/mmcblk2 bs=1M status=progress oflag=sync") + shell.Run("dd if=" + fullname + " of=/dev/mmcblk2 bs=1M status=progress oflag=sync") succeeded() } else { log.Println("filename", fullname, "does not exist") @@ -78,8 +81,7 @@ func succeeded () { log.Println("") log.Println("") - // try executing this from golang to see what happens - // dialog --ascii-lines --msgbox "Flash Image Completed!" 10 70 + shell.Run("dialog --ascii-lines --msgbox 'Flash_Image_Completed' 10 70") os.Exit(0) } diff --git a/rc.local b/rc.local index 1db6525..ee0bc26 100755 --- a/rc.local +++ b/rc.local @@ -26,7 +26,7 @@ killall wpa_supplicant ifconfig wlan0 up sleep 10 ifconfig wlan0 up -wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant.conf & +nohup wpa_supplicant -D wext -i wlan0 -c /etc/wpa_supplicant.conf & #nmcli device wifi list #nmcli device wifi rescan #nmcli device wifi list @@ -48,5 +48,6 @@ git clone https://git.wit.com/wit/pinebook-image.git echo echo Launching script from git repository +cp /root/pinebook-image/rc.local /root/ /root/pinebook-image/run.sh