1
0
mirror of https://github.com/rancher/os.git synced 2025-08-15 21:43:42 +00:00

Need to remove the immutable bit from ldlinux.sys so root can remove it

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit 2017-03-31 12:15:15 +00:00
parent e871741ec3
commit 62d8aaa58e
2 changed files with 17 additions and 4 deletions

View File

@ -841,9 +841,21 @@ func upgradeBootloader(device, baseName, bootDir, diskType string) error {
return err
}
backupSyslinuxDir := filepath.Join(baseName, bootDir+"syslinux_backup")
if err := os.RemoveAll(backupSyslinuxDir); err != nil {
log.Errorf("RemoveAll (%s): %s", backupSyslinuxDir, err)
return err
if _, err := os.Stat(backupSyslinuxDir); !os.IsNotExist(err) {
backupSyslinuxLdlinuxSys := filepath.Join(backupSyslinuxDir, "ldlinux.sys")
if _, err := os.Stat(backupSyslinuxLdlinuxSys); !os.IsNotExist(err) {
//need a privileged container that can chattr -i ldlinux.sys
cmd := exec.Command("chattr", "-i", backupSyslinuxLdlinuxSys)
if err := cmd.Run(); err != nil {
log.Errorf("%s", err)
return err
}
}
if err := os.RemoveAll(backupSyslinuxDir); err != nil {
log.Errorf("RemoveAll (%s): %s", backupSyslinuxDir, err)
return err
}
}
if err := os.Rename(grubDir, grubBackup); err != nil {

View File

@ -8,7 +8,8 @@ ENV KERNEL_VERSION=${KERNEL_VERSION}
# not installed atm udev, grub2, kexe-tools
# parted: partprobe, e2fsprogs: mkfs.ext4, syslinux: extlinux&syslinux
RUN apk --no-cache add syslinux parted e2fsprogs util-linux
# e2fsprogs-extra: chattr
RUN apk --no-cache add syslinux parted e2fsprogs e2fsprogs-extra util-linux
COPY conf /scripts/
COPY ./build/ros /bin/