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