bind /boot if mounted

This commit is contained in:
Mikaël Cluseau 2020-11-19 17:04:45 +01:00
parent 9b87210b89
commit 1f022d9fba
2 changed files with 11 additions and 7 deletions

View File

@ -1,8 +1,8 @@
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
from mcluseau/golang-builder:1.14.0 as build from mcluseau/golang-builder:1.15.5 as build
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
from alpine:3.11.3 from alpine:3.12
env busybox_v=1.28.1-defconfig-multiarch \ env busybox_v=1.28.1-defconfig-multiarch \
arch=x86_64 arch=x86_64

14
main.go
View File

@ -138,11 +138,15 @@ func main() {
mount("overlay", "/system", "overlay", rootMountFlags, mount("overlay", "/system", "overlay", rootMountFlags,
"lowerdir="+strings.Join(lowers, ":")+",upperdir=/changes/upperdir,workdir=/changes/workdir") "lowerdir="+strings.Join(lowers, ":")+",upperdir=/changes/upperdir,workdir=/changes/workdir")
// mount("/boot", "/system/boot", "", syscall.MS_BIND, "") if bootMounted {
if layersInMemory && bootMounted { if layersInMemory {
if err := syscall.Unmount("/boot", 0); err != nil { if err := syscall.Unmount("/boot", 0); err != nil {
log.Print("WARNING: failed to unmount /boot: ", err) log.Print("WARNING: failed to unmount /boot: ", err)
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
}
} else {
mount("/boot", "/system/boot", "", syscall.MS_BIND, "")
} }
} }