Vitruvian Penguin
knoppix

[knoppix:0804] Knoppixのautomountについて(Re: ext2形式のフロッピーは簡単にはマウントできないのですか。)

Date: Mon, 20 Jan 2003 00:39:11 +0900
X-mailer: Sylpheed version 0.8.5 (GTK+ 1.2.10; i586-pc-linux-gnu)
柘植です。こんばんは。

お呼びたてしてすいませんでした^^;) > M.Kamatakiさん

> あんまり検証してませんが、ext2 の FD への saveconfig もうまくいきます
> 。もちろん DOS のFD もOK。長年の課題に解決方法が見えたような。

わたしもそうだなあと思って喜んでいたのですが、本家のKNOPPIX-CHANGELOG.txt
を眺めてたら、気になる箇所がありました。(ウムラウトは誤魔化してます)

* V2.2-10-05-2002
- umask=000 workaround fur autofs

* V2.2-12-05-2002 (Bugfix release)
- umask=000 wieder entfernt (geht nicht mit ext2/reiserfs)

* V3.1-31-07-2002
- umask=000 fur Disketten (Schreiben auf DOS-formatierte
  Floppies per Automounter wieder moglich)

ということは何らかの問題があってumask=000をつけたり取ったりした経緯があ
るということでしょうか。さらに、

* V3.1-12-08-2002
- Automounter mit Filesystemerkennung (ext2-Floppies)

が気になって本家EN版(KNOPPIX_V3.1-08-11-2002-EN.iso)を調べてみたら、
/etc/auto.masterには/etc/auto.mntのかわりに/etc/automount.shが記述して
あります。

$ cat /etc/auto.master
(略)
# KNOPPIX automounts for floppy and cdrom(s), see knoppix-autoconfig
# /mnt/auto     /etc/auto.mnt   --timeout=2
/mnt/auto       /etc/automount.sh       --timeout=2

/etc/automount.shはこんなファイルです。
-----ここから
#!/bin/bash
# Generate an automounter entry automatically
# for automount /mnt/auto program this_script
# (C) Klaus Knopper 2002
# WARNING: This script is used for removable media in KNOPPIX,
# therefore the mount is always read-write (except for cdroms
# and ntfs).

fstype(){
TMPDIR="/tmp/autmount.${1##*/}.$$.dir"
[ -n "$1" ] || return 1
# First, check if a device/medium is present at all
FILE="$(dd if="$1" count=1 bs=4096 2>/dev/null | file -)"
[ "$?" = "0" ] || return 2
# File systems to try first
FILESYSTEMS=""
case "$FILE" in
*[Ff][Aa][Tt]*|*[Xx]86*) FILESYSTEMS="vfat msdos";;
*[Xx][Ff][Ss]*) FILESYSTEMS="xfs";;
*[Ee][Xx][Tt]3*) FILESYSTEMS="ext3";;
*[Ee][Xx][Tt]2*) FILESYSTEMS="ext2";;
esac
# It seems that only reliable way to identify the filesystem is to attempt a 
mount
mkdir -p "$TMPDIR" || return 3
FS=""
for f in $FILESYSTEMS $(</etc/filesystems); do
mount -r -t "$f" "$1" "$TMPDIR" >/dev/null 2>&1 && { umount "$TMPDIR"; FS="$f"; 
break; }
done
rmdir "$TMPDIR"
[ -n "$FS" ] && echo "$FS" || return 4
}

# Defaults
rw="rw"
device="/dev/${1##*/}"
case "$1" in
floppy)     device="/dev/fd0";;
cdrom*)     rw="ro";;
dvd*)       rw="ro";;
esac

fs="$(fstype "$device")"

[ "$?" = "0" ] || exit 1

case "$fs" in
*fat|msdos) options="${rw},uid=knoppix,gid=knoppix,umask=000";;
ntfs)       options="ro,uid=knoppix,gid=knoppix,umask=0222";;
iso9660)    options="ro";;
*)          options="${rw}";;
esac

MNTLINE="-fstype=$fs,user,exec,$options :$device"

# Return line to the automounter
echo "$MNTLINE"
----ここまで

KNOPPIX_V3.1-08-11-2002-EN.isoを焼いたCDで起動したKnoppixでは、ext2フォ
ーマットのフロッピーにアクセスすると自動的にマウントしてくれます。
AIST版にこのスクリプトを引っ張ってきて動かしてみたんですがいまのところ
うまくいってません。

-- 
Tsuge Akihide
<Prev in Thread] Current Thread [Next in Thread>