add ubuntu workaround

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2015-04-05 01:16:48 +03:00
parent 20416969bd
commit 616b356754

View File

@ -89,12 +89,29 @@ func ResizeRootFS() error {
return exec.Command("resize2fs", device+partition).Run() return exec.Command("resize2fs", device+partition).Run()
} }
} }
for _, name := range []string{"partprobe", "kpartx"} {
args := []string{}
for _, name := range []string{"partx", "partprobe", "kpartx"} {
if _, err = exec.LookPath(name); err == nil { if _, err = exec.LookPath(name); err == nil {
if err = exec.Command(name, device).Run(); err == nil { switch name {
return nil case "partx":
args = []string{"-u", device}
default:
args = []string{device}
} }
log.Printf("update partition table via %s %s", name, strings.Join(args, " "))
exec.Command(name, args...).Run()
}
}
log.Printf("resize filesystem via %s %s", "resize2fs", device+partition)
err = exec.Command("resize2fs", device+partition).Run()
if err != nil {
return err
}
for _, name := range []string{"grub-install", "grub2-install"} {
if _, err = exec.LookPath(name); err == nil {
log.Printf("reinstall grub %s %s", name, device)
exec.Command(name, device).Run()
} }
} }
return exec.Command("resize2fs", device+partition).Run()
} }