Mail archive
alpine-devel

Re: [alpine-devel] [PATCH] Add btrfs-progs to init_progs(). Use "-q" only when the tool supports this switch.

From: Natanael Copa <ncopa_at_alpinelinux.org>
Date: Fri, 1 Aug 2014 11:25:01 +0200

On Fri, 1 Aug 2014 02:39:35 +0200
Juan Francisco Cantero Hurtado <iam_at_juanfra.info> wrote:

So as i understand this adds support for btrfs to setup-disk?

> ---
> setup-disk.in | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/setup-disk.in b/setup-disk.in
> index c20c619..f41a464 100644
> --- a/setup-disk.in
> +++ b/setup-disk.in
> _at_@ -424,7 +424,7 @@ stop_all_raid() {
> init_progs() {
> local raidpkg=
> [ -n "$USE_RAID" ] && raidpkg="mdadm"
> - apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $_at_
> + apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux btrfs-progs $_at_
> }

If we are going to do this, how about soemthing like:

        case $ROOTFS in
        ext*) fstools=e2fsprogs; mkfs_args="-q";;
        xfs) fstools=xfsprogs; mkfs_args="-q";;
        btrfs) fstools=btrs-progs; mkfs_args="";;
        esac
        apk add --quiet $fstools ....

That way we dont install btrfs-tools unless actually needed and we
avoid specialhandling for future filesystems.


>
> show_disk_info() {
> _at_@ -519,7 +519,11 @@ setup_boot_dev() {
> --metadata=0.90 --quiet --run $_at_ $missing || return 1
> bootdev=/dev/md0
> fi
> - mkfs.$BOOTFS -q $bootdev
> + local mkfs_args=
> + if [ "$BOOTFS" != "btrfs" ]; then
> + mkfs_args="-q"
> + fi
> + mkfs.$BOOTFS $mkfs_args $bootdev
> BOOT_DEV="$bootdev"
> }

btw.. does exlinux support booting from btrfs?

>
> _at_@ -614,7 +618,7 @@ setup_var() {
> local var_dev="$1"
> local varfs=${VARFS}
> echo "Creating file systems..."
> - mkfs.$varfs -q $var_dev >/dev/null || return 1
> + mkfs.$varfs $var_dev >/dev/null || return 1
> sed -i -e '/[[:space:]]\/var[[:space:]]/d' /etc/fstab
> echo -e "${var_dev}\t/var\t\t${varfs}\tdefaults 1 2" >> /etc/fstab
>
> _at_@ -710,7 +714,11 @@ data_only_disk_install() {
> # setup
> setup_root() {
> local root_dev="$1" boot_dev="$2"
> - mkfs.$ROOTFS -q "$root_dev"
> + local mkfs_args=
> + if [ "$ROOTFS" != "btrfs" ]; then
> + mkfs_args="-q"
> + fi
> + mkfs.$ROOTFS $mkfs_args "$root_dev"
> mkdir -p "$SYSROOT"
> mount -t $ROOTFS $root_dev "$SYSROOT" || return 1
> if [ -n "$boot_dev" ]; then

-nc


---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Fri Aug 01 2014 - 11:25:01 UTC