2015-04-27 14:53:12 +00:00
|
|
|
// +build linux
|
|
|
|
|
2013-11-01 01:07:54 +00:00
|
|
|
package aufs
|
2013-03-21 05:41:03 +00:00
|
|
|
|
|
|
|
import (
|
2013-06-04 18:30:47 +00:00
|
|
|
"os/exec"
|
2013-03-21 05:41:03 +00:00
|
|
|
"syscall"
|
2014-07-24 20:37:44 +00:00
|
|
|
|
2015-03-26 22:22:04 +00:00
|
|
|
"github.com/Sirupsen/logrus"
|
2013-03-21 05:41:03 +00:00
|
|
|
)
|
|
|
|
|
2015-07-22 02:15:14 +00:00
|
|
|
// Unmount the target specified.
|
2013-03-21 05:41:03 +00:00
|
|
|
func Unmount(target string) error {
|
2013-06-04 18:30:47 +00:00
|
|
|
if err := exec.Command("auplink", target, "flush").Run(); err != nil {
|
2015-03-26 22:22:04 +00:00
|
|
|
logrus.Errorf("Couldn't run auplink before unmount: %s", err)
|
2013-06-04 18:30:47 +00:00
|
|
|
}
|
2013-03-21 05:41:03 +00:00
|
|
|
if err := syscall.Unmount(target, 0); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2013-11-08 18:17:51 +00:00
|
|
|
return nil
|
2013-03-21 05:41:03 +00:00
|
|
|
}
|