diff --git a/changelog/0.8.3_2018-02-26/pull-1649 b/changelog/0.8.3_2018-02-26/pull-1649 new file mode 100644 index 000000000..db1cb2f1d --- /dev/null +++ b/changelog/0.8.3_2018-02-26/pull-1649 @@ -0,0 +1,3 @@ +Enhancement: Add illumos/Solaris support. + +https://github.com/restic/restic/pull/1649 diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 8bcc2d8bc..8e21ce203 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package main diff --git a/cmd/restic/integration_fuse_test.go b/cmd/restic/integration_fuse_test.go index d680dd2af..a341ff4e6 100644 --- a/cmd/restic/integration_fuse_test.go +++ b/cmd/restic/integration_fuse_test.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package main diff --git a/doc/050_restore.rst b/doc/050_restore.rst index 35976b09d..50c02c760 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -63,7 +63,8 @@ command to serve the repository with FUSE: Now serving /tmp/backup at /mnt/restic Don't forget to umount after quitting! -Mounting repositories via FUSE is not possible on Windows and OpenBSD. +Mounting repositories via FUSE is not possible on OpenBSD, Solaris/illumos +and Windows. Restic supports storage and preservation of hard links. However, since hard links exist in the scope of a filesystem by definition, restoring diff --git a/internal/backend/sftp/foreground_solaris.go b/internal/backend/sftp/foreground_solaris.go new file mode 100644 index 000000000..5114eb9ea --- /dev/null +++ b/internal/backend/sftp/foreground_solaris.go @@ -0,0 +1,25 @@ +package sftp + +import ( + "os/exec" + "syscall" + + "github.com/restic/restic/internal/errors" +) + +func startForeground(cmd *exec.Cmd) (bg func() error, err error) { + // run the command in it's own process group so that SIGINT + // is not sent to it. + cmd.SysProcAttr = &syscall.SysProcAttr{ + Setpgid: true, + } + + // start the process + err = cmd.Start() + if err != nil { + return nil, errors.Wrap(err, "cmd.Start") + } + + bg = func() error { return nil } + return bg, nil +} diff --git a/internal/backend/sftp/foreground_unix.go b/internal/backend/sftp/foreground_unix.go index ef55eaa7e..789cecb1c 100644 --- a/internal/backend/sftp/foreground_unix.go +++ b/internal/backend/sftp/foreground_unix.go @@ -1,3 +1,4 @@ +// +build !solaris // +build !windows package sftp diff --git a/internal/fuse/blob_size_cache.go b/internal/fuse/blob_size_cache.go index 4fbcaeba9..87b2016a1 100644 --- a/internal/fuse/blob_size_cache.go +++ b/internal/fuse/blob_size_cache.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/dir.go b/internal/fuse/dir.go index 927562bfe..654af21cf 100644 --- a/internal/fuse/dir.go +++ b/internal/fuse/dir.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/file.go b/internal/fuse/file.go index 80cdd59ad..ff74ec73c 100644 --- a/internal/fuse/file.go +++ b/internal/fuse/file.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/file_test.go b/internal/fuse/file_test.go index c59e731f9..7a1802f39 100644 --- a/internal/fuse/file_test.go +++ b/internal/fuse/file_test.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/link.go b/internal/fuse/link.go index b174f8430..334568904 100644 --- a/internal/fuse/link.go +++ b/internal/fuse/link.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/meta_dir.go b/internal/fuse/meta_dir.go index 47afaf780..e34aa77af 100644 --- a/internal/fuse/meta_dir.go +++ b/internal/fuse/meta_dir.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/other.go b/internal/fuse/other.go index 899e341ce..b0e368d87 100644 --- a/internal/fuse/other.go +++ b/internal/fuse/other.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/root.go b/internal/fuse/root.go index 98b04fa5d..27779a241 100644 --- a/internal/fuse/root.go +++ b/internal/fuse/root.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/fuse/snapshots_dir.go b/internal/fuse/snapshots_dir.go index 671a51ba2..f6fc42cad 100644 --- a/internal/fuse/snapshots_dir.go +++ b/internal/fuse/snapshots_dir.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package fuse diff --git a/internal/restic/node_solaris.go b/internal/restic/node_solaris.go new file mode 100644 index 000000000..8ca4f95b8 --- /dev/null +++ b/internal/restic/node_solaris.go @@ -0,0 +1,27 @@ +package restic + +import "syscall" + +func (node Node) restoreSymlinkTimestamps(path string, utimes [2]syscall.Timespec) error { + return nil +} + +func (s statUnix) atim() syscall.Timespec { return s.Atim } +func (s statUnix) mtim() syscall.Timespec { return s.Mtim } +func (s statUnix) ctim() syscall.Timespec { return s.Ctim } + +// Getxattr retrieves extended attribute data associated with path. +func Getxattr(path, name string) ([]byte, error) { + return nil, nil +} + +// Listxattr retrieves a list of names of extended attributes associated with the +// given path in the file system. +func Listxattr(path string) ([]string, error) { + return nil, nil +} + +// Setxattr associates name and data together as an attribute of path. +func Setxattr(path, name string, data []byte) error { + return nil +} diff --git a/internal/restic/node_xattr.go b/internal/restic/node_xattr.go index c81cee691..f6c95ac89 100644 --- a/internal/restic/node_xattr.go +++ b/internal/restic/node_xattr.go @@ -1,4 +1,5 @@ // +build !openbsd +// +build !solaris // +build !windows package restic diff --git a/internal/restic/progress_unix.go b/internal/restic/progress_unix.go index 6f9e9eea1..30954ed31 100644 --- a/internal/restic/progress_unix.go +++ b/internal/restic/progress_unix.go @@ -1,4 +1,4 @@ -// +build !windows,!darwin,!freebsd,!netbsd,!openbsd,!dragonfly +// +build !windows,!darwin,!freebsd,!netbsd,!openbsd,!dragonfly,!solaris package restic