Go service (nasmon/) plus nfpm packaging (packaging/), carried over from the home_nas monorepo. Adds rpm packaging alongside the existing deb build (Fedora/RHEL/Rocky dependency names via nfpm overrides, per-format systemd unit path, dpkg+rpm-compatible maintainer scripts) and a Gitea Actions workflow that builds both formats on every push. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
21 lines
414 B
Go
21 lines
414 B
Go
//go:build linux
|
|
|
|
package collect
|
|
|
|
import "syscall"
|
|
|
|
type FSUsage struct {
|
|
Path string `json:"path"`
|
|
Total uint64 `json:"total"`
|
|
Free uint64 `json:"free"`
|
|
}
|
|
|
|
func ReadFS(path string) (FSUsage, error) {
|
|
var st syscall.Statfs_t
|
|
if err := syscall.Statfs(path, &st); err != nil {
|
|
return FSUsage{}, err
|
|
}
|
|
bs := uint64(st.Bsize)
|
|
return FSUsage{Path: path, Total: st.Blocks * bs, Free: st.Bavail * bs}, nil
|
|
}
|