[PATCH] partman mount.d scripts and mount options
I've been trying to work out why partman doesn't honour mount options
while mounting partitions during installation. I'm trying to write a
partman-loop udeb, and so having it honour -o loop would be rather
useful. The best explanation I've found is:
partman-basicfilesystems (4) never released; urgency=low
[...]
* Removed "-o $options" for the mount-command in mount.d/basic.
Otherwise the ro flag would mount read-only...
[...]
-- Anton Zinoviev <zinoviev@debian.org> Mon, 5 Jan 2004 22:56:41 +0200
I can't think of any other flags that might be harmful during
installation. What do folks think about the attached patch?
--
Colin Watson [cjwatson@debian.org]
Index: partman-basicfilesystems/mount.d/basic
===================================================================
--- partman-basicfilesystems/mount.d/basic (revision 47835)
+++ partman-basicfilesystems/mount.d/basic (working copy)
@@ -11,7 +11,7 @@ pass=$6
case $type in
ext2|vfat)
- mount $fs /target$mp || exit 1
+ mount ${options:+-o "$options"} $fs /target$mp || exit 1
echo "umount /target$mp"
exit 0
;;
Index: partman-ext2r0/mount.d/ext2r0
===================================================================
--- partman-ext2r0/mount.d/ext2r0 (revision 47835)
+++ partman-ext2r0/mount.d/ext2r0 (working copy)
@@ -11,7 +11,7 @@ pass=$6
case $type in
ext2r0)
- mount -t ext2 $fs /target$mp || exit 1
+ mount -t ext2 ${options:+-o "$options"} $fs /target$mp || exit 1
echo "umount /target$mp"
exit 0
;;
Index: partman-ext3/mount.d/ext3
===================================================================
--- partman-ext3/mount.d/ext3 (revision 47835)
+++ partman-ext3/mount.d/ext3 (working copy)
@@ -11,7 +11,7 @@ pass=$6
case $type in
ext3)
- mount -t ext3 $fs /target$mp || exit 1
+ mount -t ext3 ${options:+-o "$options"} $fs /target$mp || exit 1
echo "umount /target$mp"
exit 0
;;
Index: partman-jfs/mount.d/jfs
===================================================================
--- partman-jfs/mount.d/jfs (revision 47835)
+++ partman-jfs/mount.d/jfs (working copy)
@@ -11,7 +11,7 @@ pass=$6
case $type in
jfs)
- mount -t jfs $fs /target$mp || exit 1
+ mount -t jfs ${options:+-o "$options"} $fs /target$mp || exit 1
echo "umount /target$mp"
exit 0
;;
Index: partman-reiserfs/mount.d/reiserfs
===================================================================
--- partman-reiserfs/mount.d/reiserfs (revision 47835)
+++ partman-reiserfs/mount.d/reiserfs (working copy)
@@ -11,11 +11,7 @@ pass=$6
case $type in
reiserfs)
- if expr "$options" : '.*notail.*' >/dev/null; then
- mount -o notail $fs /target$mp || exit 1
- else
- mount $fs /target$mp || exit 1
- fi
+ mount ${options:+-o "$options"} $fs /target$mp || exit 1
echo "umount /target$mp"
exit 0
;;
Index: partman-xfs/mount.d/xfs
===================================================================
--- partman-xfs/mount.d/xfs (revision 47835)
+++ partman-xfs/mount.d/xfs (working copy)
@@ -11,7 +11,7 @@ pass=$6
case $type in
xfs)
- mount -t xfs $fs /target$mp || exit 1
+ mount -t xfs ${options:+-o "$options"} $fs /target$mp || exit 1
echo "umount /target$mp"
exit 0
;;
Index: partman-target/finish.d/mount_partitions
===================================================================
--- partman-target/finish.d/mount_partitions (revision 47835)
+++ partman-target/finish.d/mount_partitions (working copy)
@@ -23,7 +23,26 @@ fstab=$(
done |
sort |
while read mp fs type options dump pass; do
- echo $fs $mp $type $options $dump $pass
+ newoptions=
+ while [ "$options" ]; do
+ case $options in
+ (ro,*)
+ options="${options#ro,}"
+ ;;
+ (ro)
+ options=
+ ;;
+ (*,*)
+ newoptions="${newoptions:+$newoptions,}${options%%,*}"
+ options="${options#*,}"
+ ;;
+ (*)
+ newoptions="${newoptions:+$newoptions,}$options"
+ options=
+ ;;
+ esac
+ done
+ echo $fs $mp $type $newoptions $dump $pass
done
)
Reply to: