github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/vfs/vfsflags/vfsflags_unix.go (about) 1 //go:build linux || darwin || freebsd 2 3 package vfsflags 4 5 import ( 6 "github.com/rclone/rclone/fs/config/flags" 7 "github.com/spf13/pflag" 8 "golang.org/x/sys/unix" 9 ) 10 11 // add any extra platform specific flags 12 func platformFlags(flagSet *pflag.FlagSet) { 13 Opt.Umask = unix.Umask(0) // read the umask 14 unix.Umask(Opt.Umask) // set it back to what it was 15 flags.IntVarP(flagSet, &Opt.Umask, "umask", "", Opt.Umask, "Override the permission bits set by the filesystem (not supported on Windows)", "VFS") 16 Opt.UID = uint32(unix.Geteuid()) 17 Opt.GID = uint32(unix.Getegid()) 18 flags.Uint32VarP(flagSet, &Opt.UID, "uid", "", Opt.UID, "Override the uid field set by the filesystem (not supported on Windows)", "VFS") 19 flags.Uint32VarP(flagSet, &Opt.GID, "gid", "", Opt.GID, "Override the gid field set by the filesystem (not supported on Windows)", "VFS") 20 }