func addDebBinary(arw *ar.Writer) error { header := &ar.Header{ Size: 4, Name: "debian-binary", ModTime: time.Now(), Mode: 0777, } if err := arw.WriteHeader(header); err != nil { if *verbose { fmt.Println("Failed to write header for debian-binary.") } return err } if _, err := arw.Write([]byte("2.0\n")); err != nil { if *verbose { fmt.Println("Failed to add debian-binary to deb file.") } return err } if *verbose { fmt.Println("Added debian-binary to deb file.") } return nil }
func addControlFiles(arw *ar.Writer, debSpec *DebSpec) error { if err := createControlTgz(debSpec); err != nil { return err } tmpConl := filepath.Join(tmpDir, ctrlTgz) info, err := os.Stat(tmpConl) if err != nil { return err } f, err := os.Open(tmpConl) if err != nil { return err } defer f.Close() hdr := &ar.Header{ Size: info.Size(), Name: ctrlTgz, ModTime: time.Now(), Mode: 0777, } if err := arw.WriteHeader(hdr); err != nil { if *verbose { fmt.Printf("Failed to write header for %s\n.", ctrlTgz) } return err } if _, err := io.Copy(arw, f); err != nil { if *verbose { fmt.Printf("Failed to copy %s to deb file.\n", ctrlTgz) } return err } fmt.Printf("Added %s to deb file.\n", ctrlTgz) return nil }