LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 07-27-2009, 02:05 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 57
How to reproduce the knoppix Automount for Debian?


Hello,

Here I come up with the idea, to do like knoppix for debian.

example:
Quote:
fstab:
/proc /proc proc defaults 0 0
/sys /sys sysfs noauto 0 0
/dev/pts /dev/pts devpts mode=0622 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/hda1 /mnt/hda1 vfat noauto,users,exec,umask=000,uid=1001,gid=50 0 0
# Added by KNOPPIX
/dev/hda2 /mnt/hda2 auto noauto,users,exec 0 0
# Added by KNOPPIX
/dev/hda3 /mnt/hda3 ext2 noauto,users,exec 0 0
# Added by KNOPPIX
/dev/hda5 none swap defaults 0 0
# Added by KNOPPIX
/dev/hda6 /mnt/hda6 ext2 noauto,users,exec 0 0


So :

Code:
apt-get install udev autofs
then
Code:
mkdir /mnt/auto
then get this into the /etc/auto.master:
Code:
#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#/misc  /etc/auto.misc --timeout=60
#/smb   /etc/auto.smb
#/misc  /etc/auto.misc
#/net   /etc/auto.net
/mnt/auto       /etc/automount.sh       --timeout=2
and save this /etc/automount.sh
Code:
#!/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,

fstype(){
[ -n "$1" ] || return 1

while read device mountpoint filesystem relax; do
case "$device" in *$1*) echo "$filesystem"; return 0;; esac
done <<EOT
$(cat /proc/mounts)
EOT

dd if="$1" count=1 bs=1024 >/dev/null 2>&1 || return 2
FILE="$(LANG=C LC_ALL=C LC_MESSAGES=C file -Ls "$1")"
[ "$?" = "0" ] || return 2

FILESYSTEMS=""
case "$FILE" in
*[Ff][Aa][Tt]*|*[Xx]86*) FILESYSTEMS="vfat msdos ntfs";;
*[Rr][Ee][Ii][Ss][Ee][Rr]*)  echo "reiserfs"; return 0;;
*[Xx][Ff][Ss]*)  echo "xfs"; return 0;;
*[Ee][Xx][Tt]3*) echo "ext3"; return 0;;
*[Ee][Xx][Tt]2*) echo "ext2"; return 0;;
*[Ss][Ww][Aa][Pp]*) echo "swap"; return 0;;
esac
TMPDIR="/tmp/autmount.${1##*/}.$$.dir"
mkdir -p "$TMPDIR" || return 3
FS=""
read LOGLEVEL relax < /proc/sys/kernel/printk
echo "0" >/proc/sys/kernel/printk
for f in $FILESYSTEMS $(</etc/filesystems); do
mount -r -t "$f" "$1" "$TMPDIR" >/dev/null 2>&1 && { umount "$TMPDIR"; FS="$f"; break; }
umount -f "$TMPDIR" >/dev/null 2>&1
done
echo "$LOGLEVEL" >/proc/sys/kernel/printk
rmdir "$TMPDIR"
[ -n "$FS" ] && echo "$FS" || return 4
}

rw="rw"
device="/dev/${1##*/}"
case "$1" in
floppy)     [ -s /etc/sysconfig/floppy ] || exit 1; 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,users,exec,$options        :$device"

echo "$MNTLINE"

Last edited by frenchn00b; 07-27-2009 at 02:20 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I reproduce a WMAL file? iqbala Ubuntu 3 12-17-2008 05:03 PM
MP3 player that reproduce ogg rsottini Linux - Hardware 1 12-12-2008 11:32 AM
to reproduce the command killed with ctrl+u arunksit Linux - Newbie 2 05-28-2008 07:15 PM
Floppy disk automount in Debian Sid? kelforn Debian 1 07-16-2007 04:31 AM
Can you reproduce this? LQtoto Linux - Security 1 05-08-2004 04:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration