[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#595759: ZFS support (partman-zfs)



Package: debian-installer
Severity: wishlist
Tags: patch

This script converts partman-ufs into partman-zfs.

Patches for parted (#595007) and grub-installer (#595152) are
also required to build a working installer.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 8.1-1-amd64
Locale: LANG=ca_AD.UTF-8, LC_CTYPE=ca_AD.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
#!/bin/sh
set -ex
for t in d f ; do
  find . -type $t | grep ufs | while read i ; do mv $i $(echo $i | sed -e s/ufs/zfs/g) ; done
done
find . -type f | while read i ; do sed -i $i -e "s/ufs/zfs/g;s/UFS/ZFS/g" ; done
exec patch -p1 < $0

diff -x changelog -Nur partman-zfs.old/check.d/zfs_root partman-zfs/check.d/zfs_root
--- partman-zfs.old/check.d/zfs_root	2010-09-02 14:37:52.966988000 +0200
+++ partman-zfs/check.d/zfs_root	1970-01-01 01:00:00.000000000 +0100
@@ -1,44 +0,0 @@
-#!/bin/sh
-# Check that the root partition is of type ZFS.
-
-case "$(udpkg --print-os)" in
-	"kfreebsd")
-	;;
-	*)
-		exit 0
-	;;
-esac
-
-. /lib/partman/lib/base.sh
-
-for dev in $DEVICES/*; do
-	[ -d "$dev" ] || continue
-	cd $dev
-	open_dialog PARTITIONS
-	while { read_line num id size type fs path name; [ "$id" ]; }; do
-		[ "$fs" != free ] || continue
-		[ -f $id/method ] || continue
-		[ -f $id/acting_filesystem ] || continue
-		[ -f $id/mountpoint ] || continue
-		mountpoint=$(cat $id/mountpoint)
-		filesystem=$(cat $id/acting_filesystem)
-		if [ "$mountpoint" = / ]; then
-			root_fs=$filesystem
-			root_type=$type
-			root_path=$path
-		fi
-	done
-	close_dialog
-done
-
-# We need a root ZFS filesystem
-if [ "$root_fs" != zfs ]; then
-	db_set partman-zfs/root_not_zfs true
-	db_input critical partman-zfs/root_not_zfs || true
-	db_go || true
-	db_get partman-zfs/root_not_zfs
-	if [ "$RET" = true ]; then
-		exit 1
-	fi
-fi
-
diff -x changelog -Nur partman-zfs.old/commit.d/format_zfs partman-zfs/commit.d/format_zfs
--- partman-zfs.old/commit.d/format_zfs	2010-09-02 14:37:52.887885000 +0200
+++ partman-zfs/commit.d/format_zfs	2010-09-03 22:07:45.780579932 +0200
@@ -65,8 +65,7 @@
 			code=0
 			# Ensure label is quoted correctly
 			log-output -t partman --pass-stdout \
-				mkfs.zfs ${label:+-L "$label"} \
-					 ${reserved:+-m $reserved} \
+				zpool create -m none "$(hostname)-$(basename $device)" \
 					 $device >/dev/null || code=$?
 			sync
 			db_progress STOP
diff -x changelog -Nur partman-zfs.old/debian/control partman-zfs/debian/control
--- partman-zfs.old/debian/control	2010-09-02 14:37:53.748294000 +0200
+++ partman-zfs/debian/control	2010-09-03 22:07:45.787581939 +0200
@@ -9,6 +9,6 @@
 Package: partman-zfs
 XC-Package-Type: udeb
 Architecture: all
-Depends: ${misc:Depends}, zfsutils-udeb, zfs-modules, partman-basicfilesystems (>= 59), partman-base (>= 124)
+Depends: ${misc:Depends}, zfsutils-udeb (>= 8.1-4), zfs-modules, partman-basicfilesystems (>= 59), partman-base (>= 124)
 Provides: partman-filesystem
 Description: Add to partman support for ZFS
diff -x changelog -Nur partman-zfs.old/debian/partman-zfs.templates partman-zfs/debian/partman-zfs.templates
--- partman-zfs.old/debian/partman-zfs.templates	2010-09-02 14:37:53.509041000 +0200
+++ partman-zfs/debian/partman-zfs.templates	2010-09-03 22:07:45.793583540 +0200
@@ -4,18 +4,6 @@
 # File system name (untranslatable in many languages)
 _Description: zfs
 
-Template: partman/filesystem_long/freebsd-zfs
-Type: text
-# :sl3:
-# File system name
-_Description: ZFS file system
-
-Template: partman/filesystem_short/freebsd-zfs
-Type: text
-# :sl3:
-# Short file system name (untranslatable in many languages)
-_Description: zfs
-
 Template: partman/filesystem_short/zfs
 Type: text
 # :sl3:
@@ -27,15 +15,3 @@
 # :sl3:
 # File system name
 _Description: ZFS file system
-
-Template: partman-zfs/root_not_zfs
-Type: boolean
-# :sl3:
-_Description: Go back to the menu and correct this problem?
- Your root partition has not been configured with the ZFS file
- system. This is needed by your machine in order to boot. Please go
- back and use ZFS file system.
- .
- If you do not go back to the partitioning menu and correct this error,
- the partition will be used as is.  This means that you may not be able
- to boot from your hard disk.
diff -x changelog -Nur partman-zfs.old/fstab.d/zfs partman-zfs/fstab.d/zfs
--- partman-zfs.old/fstab.d/zfs	2010-09-02 14:37:53.074038000 +0200
+++ partman-zfs/fstab.d/zfs	2010-09-04 01:41:13.444628012 +0200
@@ -24,15 +24,7 @@
 			if [ "$options" = defaults ]; then
 				options="rw"
 			fi
-			if [ "$mountpoint" = / ]; then
-				if ! echo "$options" | grep -q '\(^\|,\)r\(o\|w\)\(,\|$\)' ; then
-					options="${options},rw"
-				fi
-				pass=1
-			else
-				pass=2
-			fi
-			echo "$path" "$mountpoint" zfs $options 0 $pass
+			echo "$(hostname)-$(basename $path)" "$mountpoint" zfs $options 0 0
 			;;
 		esac
 	done
diff -x changelog -Nur partman-zfs.old/mount.d/zfs partman-zfs/mount.d/zfs
--- partman-zfs.old/mount.d/zfs	2010-09-02 14:37:53.415994000 +0200
+++ partman-zfs/mount.d/zfs	2010-09-03 22:07:45.793583540 +0200
@@ -11,7 +11,7 @@
 
 case $type in
     zfs)
-	mount  ${type:+-t "$type"} ${options:+-o "$options"} $fs /target$mp || exit 1
+	zfs set mountpoint=/target${mp%/} $fs || exit 1
 	echo "umount /target$mp"
 	exit 0
 	;;
diff -x changelog -Nur partman-zfs.old/parted_names/zfs partman-zfs/parted_names/zfs
--- partman-zfs.old/parted_names/zfs	2010-09-02 14:37:52.795790000 +0200
+++ partman-zfs/parted_names/zfs	2010-09-03 22:07:45.793583540 +0200
@@ -1 +1 @@
-freebsd-zfs
+zfs
diff -x changelog -Nur partman-zfs.old/valid_filesystems/zfs partman-zfs/valid_filesystems/zfs
--- partman-zfs.old/valid_filesystems/zfs	2010-09-02 14:37:53.289811000 +0200
+++ partman-zfs/valid_filesystems/zfs	2010-09-03 22:07:45.793583540 +0200
@@ -15,7 +15,7 @@
 	fs=$(cat $id/detected_filesystem)
 
 	case "$fs" in
-	    freebsd-zfs|zfs)
+	    zfs)
 		echo zfs
 		;;
 	esac

Reply to: