3 2

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

Juan Francisco Cantero Hurtado
Details
Message ID
<1406853575-30650-1-git-send-email-iam@juanfra.info>
Sender timestamp
1406853575
DKIM signature
missing
Download raw message
Patch: +12 -4
---
 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
@@ -424,7 +424,7 @@ stop_all_raid() {
 init_progs() {
 	local raidpkg=
 	[ -n "$USE_RAID" ] && raidpkg="mdadm"
-	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $@
+	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux btrfs-progs $@
 }
 
 show_disk_info() {
@@ -519,7 +519,11 @@ setup_boot_dev() {
 			--metadata=0.90 --quiet --run $@ $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"
 }
 
@@ -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
 
@@ -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
-- 
1.9.3



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20140801112501.6463d227@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1406853575-30650-1-git-send-email-iam@juanfra.info> (view parent)
Sender timestamp
1406885101
DKIM signature
missing
Download raw message
On Fri,  1 Aug 2014 02:39:35 +0200
Juan Francisco Cantero Hurtado <iam@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
> @@ -424,7 +424,7 @@ stop_all_raid() {
>  init_progs() {
>  	local raidpkg=
>  	[ -n "$USE_RAID" ] && raidpkg="mdadm"
> -	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $@
> +	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux btrfs-progs $@
>  }

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() {
> @@ -519,7 +519,11 @@ setup_boot_dev() {
>  			--metadata=0.90 --quiet --run $@ $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?

>
> @@ -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
>  
> @@ -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@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Juan Francisco Cantero Hurtado
Details
Message ID
<dKnNuYZV4Hc1soRs7aWbbobPvOUFtoNF@sobremesa.juanfra>
In-Reply-To
<20140801112501.6463d227@ncopa-desktop.alpinelinux.org> (view parent)
Sender timestamp
1406931451
DKIM signature
missing
Download raw message
Patch: +8 -3
On Friday 01 August 2014 11:25:01 you wrote:
> On Fri,  1 Aug 2014 02:39:35 +0200
> Juan Francisco Cantero Hurtado <iam@juanfra.info> wrote:
> 
> So as i understand this adds support for btrfs to setup-disk?

Yes. I tried to use ROOTFS=btrfs but failed because btrfs-progs
was not installed and the tools doesn't support "-q".

> 
> > ---
> > 
> >  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
> > @@ -424,7 +424,7 @@ stop_all_raid() {
> > 
> >  init_progs() {
> >  
> >  	local raidpkg=
> >  	[ -n "$USE_RAID" ] && raidpkg="mdadm"
> > 
> > -	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $@
> > +	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux
> > btrfs-progs $@> 
> >  }
> 
> 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() {
> > 
> > @@ -519,7 +519,11 @@ setup_boot_dev() {
> > 
> >  			--metadata=0.90 --quiet --run $@ $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?

I didn't test with BOOTFS. I only added that part because the wiki
says that BOOTFS supports also btrfs
http://wiki.alpinelinux.org/wiki/Alpine_setup_scripts#setup-disk .

> 
> > @@ -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
> > 
> > @@ -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


>From 87a2a3ca2f365df3c60d933b71d70333287e090f Mon Sep 17 00:00:00 2001
From: Juan Francisco Cantero Hurtado <iam@juanfra.info>
Date: Fri, 1 Aug 2014 23:47:50 +0200
Subject: [PATCH] Add support for btrfs to setup-disk.

---
 setup-disk.in | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/setup-disk.in b/setup-disk.in
index c20c619..bae373a 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -424,7 +424,12 @@ stop_all_raid() {
 init_progs() {
 	local raidpkg=
 	[ -n "$USE_RAID" ] && raidpkg="mdadm"
-	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $@
+	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 sfdisk e2fsprogs lvm2 $raidpkg syslinux $fstools $@
 }
 
 show_disk_info() {
@@ -614,7 +619,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
 
@@ -710,7 +715,7 @@ data_only_disk_install() {
 # setup
 setup_root() {
 	local root_dev="$1" boot_dev="$2"
-	mkfs.$ROOTFS -q "$root_dev"
+	mkfs.$ROOTFS $mkfs_args "$root_dev"
 	mkdir -p "$SYSROOT"
 	mount -t $ROOTFS $root_dev "$SYSROOT" || return 1
 	if [ -n "$boot_dev" ]; then
-- 
1.9.3




---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa
Details
Message ID
<20141104113322.7b294686@ncopa-desktop.alpinelinux.org>
In-Reply-To
<dKnNuYZV4Hc1soRs7aWbbobPvOUFtoNF@sobremesa.juanfra> (view parent)
Sender timestamp
1415097202
DKIM signature
missing
Download raw message
This was finally applied.

Sorry for the delay.

Thanks!

-nc

On Sat, 02 Aug 2014 00:17:31 +0200
Juan Francisco Cantero Hurtado <iam@juanfra.info> wrote:

> On Friday 01 August 2014 11:25:01 you wrote:
> > On Fri,  1 Aug 2014 02:39:35 +0200
> > Juan Francisco Cantero Hurtado <iam@juanfra.info> wrote:
> > 
> > So as i understand this adds support for btrfs to setup-disk?
> 
> Yes. I tried to use ROOTFS=btrfs but failed because btrfs-progs
> was not installed and the tools doesn't support "-q".
> 
> > 
> > > ---
> > > 
> > >  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
> > > @@ -424,7 +424,7 @@ stop_all_raid() {
> > > 
> > >  init_progs() {
> > >  
> > >  	local raidpkg=
> > >  	[ -n "$USE_RAID" ] && raidpkg="mdadm"
> > > 
> > > -	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $@
> > > +	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux
> > > btrfs-progs $@> 
> > >  }
> > 
> > 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() {
> > > 
> > > @@ -519,7 +519,11 @@ setup_boot_dev() {
> > > 
> > >  			--metadata=0.90 --quiet --run $@ $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?
> 
> I didn't test with BOOTFS. I only added that part because the wiki
> says that BOOTFS supports also btrfs
> http://wiki.alpinelinux.org/wiki/Alpine_setup_scripts#setup-disk .
> 
> > 
> > > @@ -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
> > > 
> > > @@ -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
> 
> 
> From 87a2a3ca2f365df3c60d933b71d70333287e090f Mon Sep 17 00:00:00 2001
> From: Juan Francisco Cantero Hurtado <iam@juanfra.info>
> Date: Fri, 1 Aug 2014 23:47:50 +0200
> Subject: [PATCH] Add support for btrfs to setup-disk.
> 
> ---
>  setup-disk.in | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/setup-disk.in b/setup-disk.in
> index c20c619..bae373a 100644
> --- a/setup-disk.in
> +++ b/setup-disk.in
> @@ -424,7 +424,12 @@ stop_all_raid() {
>  init_progs() {
>  	local raidpkg=
>  	[ -n "$USE_RAID" ] && raidpkg="mdadm"
> -	apk add --quiet sfdisk e2fsprogs lvm2 $raidpkg syslinux $@
> +	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 sfdisk e2fsprogs lvm2 $raidpkg syslinux $fstools $@
>  }
>  
>  show_disk_info() {
> @@ -614,7 +619,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
>  
> @@ -710,7 +715,7 @@ data_only_disk_install() {
>  # setup
>  setup_root() {
>  	local root_dev="$1" boot_dev="$2"
> -	mkfs.$ROOTFS -q "$root_dev"
> +	mkfs.$ROOTFS $mkfs_args "$root_dev"
>  	mkdir -p "$SYSROOT"
>  	mount -t $ROOTFS $root_dev "$SYSROOT" || return 1
>  	if [ -n "$boot_dev" ]; then



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---