Writes temp file to hosts file
parent
f356390104
commit
b42829d904
|
|
@ -43,6 +43,7 @@ func main() {
|
||||||
copystatichosts(tmpdir, hostsloc)
|
copystatichosts(tmpdir, hostsloc)
|
||||||
downloadcontent(downloads, tmpdir)
|
downloadcontent(downloads, tmpdir)
|
||||||
writesites(sites, tmpdir)
|
writesites(sites, tmpdir)
|
||||||
|
writetmp2hosts(hostsloc, tmpdir)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sysdetect (tmpdir, hostsloc, cfgloc *string) {
|
func sysdetect (tmpdir, hostsloc, cfgloc *string) {
|
||||||
|
|
@ -225,3 +226,25 @@ func writesites(sites []string, tmpdir string) error {
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
func writetmp2hosts(hostsloc, tmpdir string) error {
|
||||||
|
var err error = nil
|
||||||
|
tmploc := tmpdir + "rhosts"
|
||||||
|
|
||||||
|
hosts, err := os.Create(hostsloc)
|
||||||
|
if (err != nil){
|
||||||
|
log.Print(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
tmp, err := os.Open(tmploc)
|
||||||
|
if (err != nil){
|
||||||
|
log.Print(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_,err = io.Copy(hosts,tmp)
|
||||||
|
if (err != nil){
|
||||||
|
log.Print(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue