Example #1
0
func doUmount(c *cli.Context) error {
	rootDir := c.String("root")
	if rootDir == "" {
		cli.ShowCommandHelp(c, "umount")
		return errors.New("--root option required")
	}

	if !osutil.ExistsDir(rootDir) {
		return fmt.Errorf("No such directory %s", rootDir)
	}

	return osutil.UmountRoot(rootDir)
}
Example #2
0
File: rm.go Project: varung/droot
func doRm(c *cli.Context) error {
	rootDir := c.String("root")
	if rootDir == "" {
		cli.ShowCommandHelp(c, "run")
		return errors.New("--root option required")
	}

	if !osutil.ExistsDir(rootDir) {
		return fmt.Errorf("No such directory %s", rootDir)
	}

	if err := osutil.UmountRoot(rootDir); err != nil {
		return err
	}
	return osutil.RunCmd("rm", "-fr", rootDir)
}