Writes temp file to hosts file

stable
Justin Reichardt 2021-12-09 17:03:00 -06:00
parent f356390104
commit b42829d904
1 changed files with 23 additions and 0 deletions

View File

@ -43,6 +43,7 @@ func main() {
copystatichosts(tmpdir, hostsloc)
downloadcontent(downloads, tmpdir)
writesites(sites, tmpdir)
writetmp2hosts(hostsloc, tmpdir)
}
func sysdetect (tmpdir, hostsloc, cfgloc *string) {
@ -225,3 +226,25 @@ func writesites(sites []string, tmpdir string) error {
}
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
}