-
Notifications
You must be signed in to change notification settings - Fork 46
/
main.go
50 lines (43 loc) · 854 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"log"
"net/http"
"io"
"os"
"os/exec"
)
/**
* Tunic Linux Installer
*
* This is just something to get us started with very minimal MVP.
* The MVP just downloads the old Tunic and runs it.
*/
func Download() error {
resp, err := http.Get("https://github.com/mikeslattery/tunic/releases/download/0.2.4/tunic.exe")
if err != nil {
return err
}
defer resp.Body.Close()
out, err := os.Create("tunic024.exe")
if err != nil {
return err
}
defer out.Close()
_, err = io.Copy(out, resp.Body)
return err
}
func Run() error {
cmd := exec.Command("tunic024.exe")
err := cmd.Run()
return err
}
func main() {
err := Download()
if err != nil {
err = Run()
}
if err != nil {
log.Fatal(err)
os.Exit(1)
}
}