pmb.install: add support for creating btrfs root filesystem (MR 2155)
in preparation for reversible upgrades, this change adds the option of creating a btrfs root filesystem
This commit is contained in:
parent
9e63d5820c
commit
80c988236f
|
@ -164,7 +164,8 @@ locales = [
|
||||||
]
|
]
|
||||||
|
|
||||||
# Supported filesystems and their fstools packages
|
# Supported filesystems and their fstools packages
|
||||||
filesystems = {"ext2": "e2fsprogs",
|
filesystems = {"btrfs": "btrfs-progs",
|
||||||
|
"ext2": "e2fsprogs",
|
||||||
"ext4": "e2fsprogs",
|
"ext4": "e2fsprogs",
|
||||||
"f2fs": "f2fs-tools",
|
"f2fs": "f2fs-tools",
|
||||||
"fat16": "dosfstools",
|
"fat16": "dosfstools",
|
||||||
|
|
|
@ -35,6 +35,9 @@ def format_and_mount_boot(args, boot_label):
|
||||||
elif filesystem == "ext2":
|
elif filesystem == "ext2":
|
||||||
pmb.chroot.root(args, ["mkfs.ext2", "-F", "-q", "-L", boot_label,
|
pmb.chroot.root(args, ["mkfs.ext2", "-F", "-q", "-L", boot_label,
|
||||||
device])
|
device])
|
||||||
|
elif filesystem == "btrfs":
|
||||||
|
pmb.chroot.root(args, ["mkfs.btrfs", "-f", "-q", "-L", boot_label,
|
||||||
|
device])
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Filesystem " + filesystem + " is not supported!")
|
raise RuntimeError("Filesystem " + filesystem + " is not supported!")
|
||||||
pmb.chroot.root(args, ["mkdir", "-p", mountpoint])
|
pmb.chroot.root(args, ["mkdir", "-p", mountpoint])
|
||||||
|
@ -106,6 +109,8 @@ def format_and_mount_root(args, device, root_label, sdcard):
|
||||||
mkfs_root_args = mkfs_root_args + ["-N", "100000"]
|
mkfs_root_args = mkfs_root_args + ["-N", "100000"]
|
||||||
elif filesystem == "f2fs":
|
elif filesystem == "f2fs":
|
||||||
mkfs_root_args = ["mkfs.f2fs", "-f", "-l", root_label]
|
mkfs_root_args = ["mkfs.f2fs", "-f", "-l", root_label]
|
||||||
|
elif filesystem == "btrfs":
|
||||||
|
mkfs_root_args = ["mkfs.btrfs", "-f", "-L", root_label]
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(f"Don't know how to format {filesystem}!")
|
raise RuntimeError(f"Don't know how to format {filesystem}!")
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ def arguments_install(subparser):
|
||||||
# Other
|
# Other
|
||||||
group = ret.add_argument_group("other optional arguments")
|
group = ret.add_argument_group("other optional arguments")
|
||||||
group.add_argument("--filesystem", help="root filesystem type",
|
group.add_argument("--filesystem", help="root filesystem type",
|
||||||
choices=["ext4", "f2fs"])
|
choices=["ext4", "f2fs", "btrfs"])
|
||||||
|
|
||||||
|
|
||||||
def arguments_export(subparser):
|
def arguments_export(subparser):
|
||||||
|
|
Loading…
Reference in New Issue