summaryrefslogtreecommitdiff
path: root/internal/file/regular_file.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/file/regular_file.go')
-rw-r--r--internal/file/regular_file.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/internal/file/regular_file.go b/internal/file/regular_file.go
deleted file mode 100644
index 7747b9e..0000000
--- a/internal/file/regular_file.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package file
-
-import (
- "crypto/sha256"
- "log"
-)
-
-// haveRegularFile writes content to f.path idempotently (via a checksum-guarded
-// temp file) and enforces mode/ownership.
-func (f *File) haveRegularFile(content []byte) error {
- log.Printf("processing file: %s", f.path)
- existingChecksum := getChecksum(f.path)
- newChecksum := sha256.Sum256(content)
- log.Printf("computed checksum for new content: %x", newChecksum)
-
- tmpPath := f.path + ".tmp"
- if err := writeTmpFile(tmpPath, content, f.mode); err != nil {
- return err
- }
-
- if err := updateFromTmp(tmpPath, f.path, existingChecksum != newChecksum); err != nil {
- return err
- }
-
- return f.applyAttributes()
-}