an shell script I made for Ubuntu
netdur
durnet at menara.ma
Tue Oct 26 09:56:58 UTC 2004
Hey,
this script should be executed in every boot, it should detect
partitions and mount it, I think this script is better than edit fstab
statically... because may people re-partition HD or change file system
of an partition... also this can be helpful for none-technical users,
this is actually my first shell script I code, so don't laugh at me if
you find it poor code
#!/bin/bash
swap=$(egrep 'swap' /etc/fstab | awk '{ print $1 }')
root=$(awk '{ print $1 }' /proc/cmdline)
partitions=$(egrep 'hd..' /proc/partitions | awk '{ print $4 }')
for i in $partitions; do
if [[ "/dev/$i" != $swap && "root=/dev/$i" != $root ]]; then
mkdir /mnt/$i > /dev/null
filesystem=$(df -T /dev/$i | awk '/\//{print $2}')
case $filesystem in
ntfs) mount -t ntfs
auto,user,ro,exec,dmask=000,fmask=111 /dev/$i /tmp/$i > /dev/null;
vfat) mount -t vfat
auto,user,rw,exec,dmask=000,fmask=111 /dev/$i /tmp/$i > /dev/null;
*) mount -t auto /dev/$i /tmp/$i > /dev/null;
esac
fi
done
exit
I did not test yet, I will do later day... now I'm going to school
More information about the ubuntu-users
mailing list