-
Notifications
You must be signed in to change notification settings - Fork 0
/
gi.go
83 lines (64 loc) · 1.71 KB
/
gi.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package main
import (
"flag"
"fmt"
"main/config"
"main/network"
"main/storage"
)
func main() {
var installConfigFile = flag.String("c", "configure.yaml", "Path to install config file (default: configure.yaml)")
flag.Parse()
cfg, err := config.InstallConfigLoad(*installConfigFile)
if err != nil {
fmt.Errorf("Error: ", err)
return
}
fmt.Println(cfg)
storage.EraseDiskAndCreateParts()
//fmt.Println(cfg.Storage.Device)
// fmt.Println(cfg.Install.TimeZone)
//fmt.Println(cfg)
//gcfg := InitGlobalConfig()
//ConfigFile(".bashrc", gcfg)
// isOk := getConnectionStatus()
// if isOk != true {
// return
//}
//////////////////////////////////////////////////////////////
url := "https://mirror.yandex.ru/gentoo-distfiles/releases/amd64/autobuilds/current-stage3-amd64-openrc/"
names, err := network.GetLatestStage3(url)
if err != nil {
panic(err)
}
fmt.Println("names:")
for _, name := range names {
fmt.Println(name)
}
newURL := url + names[0]
outputFileName := "latest-stage3.tar.xz"
if !FileExists(outputFileName) {
err = network.DownloadFile(outputFileName, newURL)
if err != nil {
panic(err)
}
fmt.Println("\ndownloaded succesfully")
} else {
fmt.Println("\nalready downloaded")
}
//////////////////////////////////////////////////////////////
// // checking file on disk
// if !fileExists(name) {
// newURL := "https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64/" + name
// err := downloadFile(name, newURL)
// if err != nil {
// panic(err)
// }
// fmt.Println("\ndownloaded: " + name)
// } else {
// fmt.Println("already downloaded: " + name)
// }
// testName := "test.tar.xz"
// unpack(testName)
// fmt.Println("unpack: " + name)
}