FreeBSD has serious problems with focus, longevity, and lifecycle
A simple sollution (at least for a start), for backporting various bugfixes from STABLE to RELEASE. Currently we have /var/db/pkg 'db' for installed ports, where an installed port is like /var/db/pkg/portname-1.0 lets provide another one, /var/db/patch, a separated 'repository' that would list installed patches/backports from STABLE to RELEASE, for example: # pkg_info aspell-0.60.6.1 Spelling checker with better suggestion logic than ispell automake-1.11.1 GNU Standards-compliant Makefile generator (1.11) binutils-2.22 GNU binary tools bison-2.4.3,1 A parser generator from FSF, (mostly) compatible with Yacc blogbench-1.1 Performance Test of Filesystem I/O (...) # patch_into network-intel_drivers-em-1.0 Some fancy descritpion here usb-hubfix-3.0 Some other fancy descritpion Similar for patch_add(1)/patch_delete(1) etc. LOGIC/THEORY: Adding a PATCH network-intel_drivers-em-1.0 would first move all files that will be overwritten to /var/db/patch/files, for example /boot/kernel/if_em.ko to /var/db/patch/files/network-intel_drivers-em-1.0/boot/kernel/if_em.ko and then install the new backported/updatet files into the base system or should I say RELEASE. The only other thing needed to do is to make freebsd-update AWARE of the files that are under /var/db/patch/files/*/ to omit them when checking the checksums for updating process. I will not write that as I only know basics of C programming and creating this in SH and then porting it to C seems useless efort to me. Regards, vermaden ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
FreeBSD has serious problems with focus, longevity, and lifecycle
(This is my earlier 'rant' about current situation, it was not 'approved' to the freebsd-hackers ML because I was not subscribed to it (my bad), possible little too much personal and emotional, but who we are without emotions, machines.) This well known 'open secret' FreeBSD problem also hit me many times, but as experience tells me, all of us would chick-chat here a lot what can be done to make things better and in the end ... nothing will happen. Many of You say 'step-up' and help/do something, I am actually or tried to do that in the past. I submit PRs and try to help test them as some developer/commiter will pick up the PR, submit a patch to test, but it was MANY times that the response from developer/commiter was way too long that I even DID NOT HAVE THE HARDWARE anymore ... Long time ago I had a lot of fun with emulation/virtualization using QEMU on FreeBSD, so I decided to write a FreeBSD Handbook section that would cover what I already known and it will help a LOT of people that would also want to use it the same or similar way. Here is one of the messages that I sent by then to the mailing lists: http://lists.freebsd.org/pipermail/freebsd-doc/2007-May/012507.html ... and NOTHING HAPPENED, no one told me what to do next, should I sent a SGML version or anything ... or just GTFO. Maybe that is the reason why my HOWTO 'QEMU on FreeBSD' was so popular before VirtualBox 'happened' on FreeBSD. And these Handbook pages are still available on my site to this very day: http://strony.toya.net.pl/~vermaden/FreeBSD-Handbook-Virtualization.htm I have an issue with my Lenovo X300 laptop that the 'output jack' for headphone did not worked as advertised, I submitted a PR, some the developer/commiter helped me to make it work by adding some 'hacks' to /boot/loader.conf (and it worked), but IT WAS NOE FIXED, these changes was never added to any branch, not even CURRENT, whats the point of fixing something if it is not even commited to at least CURRENT so it will not hit anyone anymore? Lets talk about Ports maintainers for a while, ftp/vsftpd maintainer for example, one of the options of this port is to provide a RC script so one will be able to start this FTP server with /usr/local/etc/rc.d script, but ... ITS NOT ENABLED BY DEFAULT, wtf people? Now every person that wants to use vsftpd NORMALLY will have to compile it instead of adding a package, so whats the need for building all the packages if You provide such useless defaults? Another example, net/samba*, its WELL KNOWN that samba sucks on FreeBSD with current selected defaults for this port, the current defaults are to DISABLE AIO support, but You only get good performance with samba on FreeBSD when the AIO is enabled, so another bunch of useless prebuilt packages, You need to compile anyway. Its options for FreeBSD, not every other OS on the world, so why not enable it? FreeBSD Ports are not PKGSRC where many systems are supported, if some option is 'good for default' why keep it disabled? What I have done about these 'Ports issues'? I contacted these ports maintainers and said that both RC script and AIO support for samba should be enabled by default by linking to several threads at FreeBSD Forums that the problem is known and exists ... and I did not get ANY RESPONSE till this very day, not even a GTFO (which would probably be better then nothing). I got these maintainers email addresses from http://freshports.org page, are they up-to-date there? Maybe that is the problem and that my mails jest went to /dev/null ... Just checking for sure. Its not that people does not try to help, a lot tried (and I am still trying), but its VERY unpleasant to have awareness, that You dedicated your time, tried to help as much as possible, made some steps to achieve that ... and no one even cares about that. At least some should say 'You are doing it wrong' try this and that, understand that, that is the way it works etc. Just my $0.02 on that well known FreeBSD problem and 'crisis'. With kind regards, vermaden ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: FreeBSD has serious problems with focus, longevity, and lifecycle
"Mark Linimon" pisze: > On Thu, Jan 19, 2012 at 08:07:43AM +0100, vermaden wrote: > > I submit PRs and try to help test them as some developer/committer > > will pick up the PR, submit a patch to test, but it was MANY times > > that the response from developer/committer was way too long that > > I even DID NOT HAVE THE HARDWARE anymore ... > > I don't have a magic wand to solve this problem. I've spent a lot > of time thinking about it and it's just a hard problem to solve in > general. There are several aspects: > > - so many computers are very broken (specifically, horrible BIOS >bugs). > > - most committers only have one or two computers that they work with. > > - most committers have their own tasklist, and "support users" is >something they never have time to get around to. > > "support users" is, in general, something Open Source OSes do not > do very well (at least without a paid support staff, as is the case > in some of the Linux distros.) > > But what's discouraging for the people that try to clean up the stale > PRs is that they get yelled at when they try to do so. Thus, they > tend to get demotivated as well. > > Support/bug triage is hard and unrewarding work. People can tend to > feel that they're being blamed for bugs that they had nothing to do > with creating, and burn out. Hi, I do not have anything against You, or any other commiter/developer, maybe the answer to that PR should be 'I have checked that and that, but I do not have that hardware so no luck ...' It would be also great to have FreeBSD base system tool, that would collect all system data, dmesg, uname, hardware configuration, literally EVERYTHING, that would provide some useful input for a commiter/developer. It would also be good to have some wiki.freebsd.org page that would describe what information is needed to fill a good PR if such tool is not going to 'happen', I could write a simple SH script myself, that would collect dmesg/dmidecode/uname and more output from other commands, but I do not know what knowledge You need, so that simple program to get all that useful data can help a little, at least in theory. > > Here is one of the messages that I sent by then to the mailing lists: > > http://lists.freebsd.org/pipermail/freebsd-doc/2007-May/012507.html > > > > ... and NOTHING HAPPENED, no one told me what to do next, > > should I sent a SGML version or anything ... or just GTFO. > > I'm sorry that nothing happened, but unfortunately that's common. > Submitters sometimes have to be persistent, and maybe even catch > new committers when they sign up. Our documentation is certainly > in need of updating. I still was (or at least felt) that was a FreeBSD newbie that time, so I did not knew if my 'handbook part' was just rubbish, or stupid, or ... whatever, no one responded, so I assumed that its not needed/useless and moved along. It would be also good to have a wiki.freebsd.org page describing what is needed and in what format a user should send the documentation changes, currently its just wasting developers' time for asking them how to do that and that, what format, where to send it ... > > What I have done about these 'Ports issues'? I contacted these > > ports maintainers and said that both RC script and AIO support for > > samba should be enabled by default by linking to several threads > > at FreeBSD Forums that the problem is known and exists ... and I > > did not get ANY RESPONSE till this very day, not even a GTFO > > (which would probably be better then nothing). > > When you don't get a response from a maintainer, your best bet is to > file a PR against the port. If the maintainer doesn't respond, then > after 2 weeks any FreeBSD ports committer is free to work on the PR > and, if they agree with you, commit it via maintainer-timeout. > > We don't have a way to track emails that various users send to individual > maintainers. With a PR open, we have a way to do that. We also track > maintainer-timeouts, and these can eventually lead to a maintainer reset. I have now filled these PR's here: http://www.freebsd.org/cgi/query-pr.cgi?pr=164431 http://www.freebsd.org/cgi/query-pr.cgi?pr=164432 > > It's not that people does not try to help, a lot tried (and I am still > > trying), but its VERY unpleasant to have awareness, that you dedicated > > your time, tried to help as much as possible, made some steps to achieve > > that ... and no one even cares about that. > > I think it's not "don't care", I think it's that "unable to cope with > number of incoming PRs and other re
Re: FreeBSD has serious problems with focus, longevity, and lifecycle
> > It would also be good to have some wiki.freebsd.org page that > > would describe what information is needed to fill a good PR > > See: > > http://www.freebsd.org/doc/en_US.ISO8859-1/articles/problem-reports/ Thanks, I will read it. > > I have now filled these PR's here: > > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=164431 > > http://www.freebsd.org/cgi/query-pr.cgi?pr=164432 > > Thanks. This makes these issues visible. One of them is already closed ... with ZERO changes, the reason from the person that closed it: "This is intended, as vsftpd is started by inetd" ... great, but not ALL FreeBSD users want to use inetd, why force them to compile it, is that one file that big or painful that it can not be added to the port? > > So its time for another article/page on wiki.freebsd.org, how to become > > a committer and help to solve PRs' > > See: > > http://www.freebsd.org/doc/en_US.ISO8859-1/articles/contributing/ > http://wiki.freebsd.org/BecomingACommitter Thanks I did not knew them, seems that there are a lot of useful materials/articles that are mostly known by developers/commiters and not 'casual' users, maybe a 'The Wall' page on freebsd.org with all these useful articles/pages? Kind regards, vermaden ... ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: FreeBSD has serious problems with focus, longevity, and lifecycle
"Mike Meyer" pisze: > On Wed, 25 Jan 2012 00:05:55 +0100 > vermaden wrote: > > > > I have now filled these PR's here: > > > > http://www.freebsd.org/cgi/query-pr.cgi?pr=164432 > > > Thanks. This makes these issues visible. > > One of them is already closed ... with ZERO changes, > > the reason from the person that closed it: > > "This is intended, as vsftpd is started by inetd" > > ... great, but not ALL FreeBSD users want to use inetd, > > why force them to compile it, is that one file that big > > or painful that it can not be added to the port? > > I don't know why the PR was closed this way, but given that the bug > report is simply a statement of a fact, without saying why you > consider this fact to be a bug, or any other justification for wanting > the change, closing it as "works as intended" seems like a perfectly > reasonable response. > > If you had explained *why* you wanted that changed, and provide some > justification for doing so (i.e. - point out that no inetd compliant > program, so the default config of the port won't run on the default > config of FreeBSD), you might have gotten a different response. > > Of course, that kind of discussion isn't really appropriate for a PR, > since it's really a feature request. As such it deserves a bit of work > finding out why it's that way to begin with. All of is covered in the > problem-reports document already mentioned in this thread: > > http://www.freebsd.org/doc/en_US.ISO8859-1/articles/problem-reports/ I have sent this in reply to that cosed PR: --- ... and if someone DOES NOT WANT to run it by INETD? Why force people to (definitely needless) compile process while this little option/small fail can make like so much easier for everyone that do not use inetd? There are multiple threads at FreeBSD Forums that this script is missing from the package. Also I do not no ANY OTHER package for daemon that has RC_NG script as an option, all of them provide RC_NG script by default, so that is what a user/admin is expecting. Adding this file does not break INETD functionality and only adds a sollution to start it by RC_NG script. Its just one harmless file, why is it such a big problem? --- Regards, vermaden ... ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
devd based AUTOMOUNTER
Hi, I have finally made some effort on writing flexible yet very simple automounter for FreeBSD desktop. Feel free to submit me BUG reports ;) It currently supports these file formats: -- NTFS(rw) requires [port]sysutils/fusefs-ntfs[/port] -- FAT/FAT32 -- exFAT requires [port]sysutils/fusefs-exfat[/port] -- EXT2 -- EXT3 -- EXT4 requires [port]sysutils/fusefs-ext4fuse[/port] -- UFS (DOH!) It keeps state of the mounted devices at /var/run/automount.state and logs all activities to /var/log/automount.log file. The place for the script is at /usr/local/sbin/automount.sh executable. The only additional configuration it requires are those lines at the end of /etc/devd.conf file along with restarting /etc/rc.d/devd daemon. notify 200 { match "system" "DEVFS"; match "type" "CREATE"; match "cdev" "(da|mmcsd)[0-9]+"; action "/usr/local/sbin/automount.sh $cdev attach"; }; notify 200 { match "system" "DEVFS"; match "type" "DESTROY"; match "cdev" "(da|mmcsd)[0-9]+"; action "/usr/local/sbin/automount.sh $cdev detach"; }; The /usr/local/sbin/automount.sh executable is here: #! /bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin LOG="/var/log/automount.log" STATE="/var/run/automount.state" DATEFMT="%Y-%m-%d %H:%M:%S" __create_mount_point() { # /* 1=DEV */ MNT="/mnt/$( basename ${1} )" mkdir -p ${MNT} } __state_lock() { while [ -f ${STATE}.lock ]; do sleep 0.5; done :> ${STATE}.lock } __state_unlock() { rm ${STATE}.lock } __state_add() { # /* 1=DEV 2=PROVIDER 3=MNT */ __state_lock echo "${1} ${2} ${3}" >> ${STATE} __state_unlock } __state_remove() { # /* 1=MNT 2=STATE 3=LINE */ LINE=$( grep -n -E "${1}$" ${2} | cut -d : -f 1 ) sed -i '' ${3}d ${2} } __log() { # /* @=MESSAGE */ echo $( date +"${DATEFMT}" ) ${@} >> ${LOG} } case ${2} in (attach) for I in /dev/${1}* do case $( file -L -s ${I} ) in (*NTFS*) __create_mount_point ${I} ntfs-3g ${I} ${MNT} # /* sysutils/fusefs-ntfs */ __log "${I}:mount (ntfs)" ;; (*FAT*) __create_mount_point ${I} fsck_msdosfs -y ${I} mount_msdosfs -o large -o longnames -l -L pl_PL.ISO8859-2 -D cp852 ${I} ${MNT} __log "${I}:mount (fat)" ;; (*ext2*) __create_mount_point ${I} fsck.ext2 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext2)" ;; (*ext3*) __create_mount_point ${I} fsck.ext3 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext3)" ;; (*ext4*) __create_mount_point ${I} fsck.ext4 -y ${I} ext4fuse ${I} ${MNT} # /* sysutils/fusefs-ext4fuse */ __log "${I}:mount (ext4)" ;; (*Unix\ Fast\ File*) __create_mount_point ${I} fsck_ufs -y ${I} mount ${I} ${MNT} __log "${I}:mount (ufs)" ;; (*) case $( dd < ${O} count=1 | strings | head -1 ) in (EXFAT) __create_mount_point ${I} mount.exfat ${I} ${MNT} # /* sysutils/fusefs-exfat */ __log "${I}:mount (ufs)" ;; (*) continue ;; esac ;; esac __state_add ${I} $( mount | grep " ${MNT} " | awk '{printf $1}' ) ${MNT} done ;; (detach) MOUNTED=$( mount ) __state_lock while read DEV PROVIDER MNT do TARGET=$( echo "${MOUNTED}" | grep -E "^${PROVIDER} " | awk '{print $3}' ) [ -z ${TARGET} ] && { __state_remove ${MNT} ${STATE} ${LINE} continue } umount -f ${TARGET} & unset TARGET __state_remove ${MNT} ${STATE} ${LINE} __log "${DEV}:umount" done < ${STATE} __state_unlock __log "/dev/${1}:detach" ;; esac PS. Below are links for 'mirror' threads. http://forums.freebsd.org/showthread.php?t=29895 http://daemonforums.org/showthread.php?t=6838 Regards, vermaden --- ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
I already made some changes for the 'better' ... Here is the latest version: #! /bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin LOG="/var/log/automount.log" STATE="/var/run/automount.state" DATEFMT="%Y-%m-%d %H:%M:%S" __create_mount_point() { # /* 1=DEV */ MNT="/mnt/$( basename ${1} )" mkdir -p ${MNT} } __state_lock() { while [ -f ${STATE}.lock ]; do sleep 0.5; done :> ${STATE}.lock } __state_unlock() { rm ${STATE}.lock } __state_add() { # /* 1=DEV 2=PROVIDER 3=MNT */ __state_lock grep -E "${3}$" ${STATE} 1> /dev/null 2> /dev/null && { __log "${1}:duplicated '${STATE}'" return 1 } echo "${1} ${2} ${3}" >> ${STATE} __state_unlock } __state_remove() { # /* 1=MNT 2=STATE 3=LINE */ BSMNT=$( echo ${1} | sed 's/\//\\\//g' ) sed -i '' "/${BSMNT}\$/d" ${2} } __log() { # /* @=MESSAGE */ echo $( date +"${DATEFMT}" ) ${@} >> ${LOG} } case ${2} in (attach) for I in /dev/${1}* do case $( file -L -s ${I} ) in (*NTFS*) __create_mount_point ${I} ntfs-3g ${I} ${MNT} # /* sysutils/fusefs-ntfs */ __log "${I}:mount (ntfs)" ;; (*FAT*) __create_mount_point ${I} fsck_msdosfs -y ${I} mount_msdosfs -o large -o longnames -l -L pl_PL.ISO8859-2 -D cp852 ${I} ${MNT} __log "${I}:mount (fat)" ;; (*ext2*) __create_mount_point ${I} fsck.ext2 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext2)" ;; (*ext3*) __create_mount_point ${I} fsck.ext3 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext3)" ;; (*ext4*) __create_mount_point ${I} fsck.ext4 -y ${I} ext4fuse ${I} ${MNT} # /* sysutils/fusefs-ext4fuse */ __log "${I}:mount (ext4)" ;; (*Unix\ Fast\ File*) __create_mount_point ${I} fsck_ufs -y ${I} mount ${I} ${MNT} __log "${I}:mount (ufs)" ;; (*) case $( dd < ${O} count=1 | strings | head -1 ) in (EXFAT) __create_mount_point ${I} mount.exfat ${I} ${MNT} # /* sysutils/fusefs-exfat */ __log "${I}:mount (ufs)" ;; (*) continue ;; esac ;; esac __state_add ${I} $( mount | grep " ${MNT} " | awk '{printf $1}' ) ${MNT} || continue done ;; (detach) __state_lock grep ${1} ${STATE} \ | while read DEV PROVIDER MNT do TARGET=$( mount | grep -E "^${PROVIDER} " | awk '{print $3}' ) [ -z ${TARGET} ] && { __state_remove ${MNT} ${STATE} ${LINE} continue } umount -f ${TARGET} & unset TARGET __state_remove ${MNT} ${STATE} ${LINE} __log "${DEV}:umount" done __state_unlock __log "/dev/${1}:detach" ;; esac I have made tests with 3 different USB drives, with different and same failesystems, connecting them all at once, disconnecting all at once, random connect, disconnect etc. Currently it seems to work ok but suggestions are very welcome. > Some things to consider/test: > > How do I set custom flags, like nosuid,noatime,nodev,noexec,async (or > sync) for mounts? Currently You can add these options to filesystem specific mount command, but its definitely possible. > What if make a usb drive with an illegal name, existing name or other > dangerous values? The filesystem label is not used at all, I just use device names, which are reported by FreeBSD, so quite bulletproof here and then create appreciate /mnt/da0s1 directories. > Can I use the automounter to either mount over another mount to > impersonate it, or can I overwrite arbitrary files or directories? I have done everything to check that and to omit that, if not, then submit a BUG ;) Thanks for suggestions Matt. Regards, vermaden -- ... ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
... even newer version, seems to have all 'problems' fixed now ;) #! /bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin LOG="/var/log/automount.log" STATE="/var/run/automount.state" DATEFMT="%Y-%m-%d %H:%M:%S" __create_mount_point() { # /* 1=DEV */ MNT="/mnt/$( basename ${1} )" mkdir -p ${MNT} } __state_lock() { while [ -f ${STATE}.lock ]; do sleep 0.5; done :> ${STATE}.lock } __state_unlock() { rm ${STATE}.lock } __state_add() { # /* 1=DEV 2=PROVIDER 3=MNT */ __state_lock grep -E "${3}" ${STATE} 1> /dev/null 2> /dev/null && { __log "${1}:duplicated '${STATE}'" return 1 } echo "${1} ${2} ${3}" >> ${STATE} __state_unlock } __state_remove() { # /* 1=MNT 2=STATE 3=LINE */ BSMNT=$( echo ${1} | sed 's/\//\\\//g' ) sed -i '' "/${BSMNT}\$/d" ${2} } __log() { # /* @=MESSAGE */ echo $( date +"${DATEFMT}" ) ${@} >> ${LOG} } case ${2} in (attach) for I in /dev/${1}* do case $( file -L -s ${I} ) in (*NTFS*) __create_mount_point ${I} ntfs-3g ${I} ${MNT} # /* sysutils/fusefs-ntfs */ __log "${I}:mount (ntfs)" ;; (*FAT*) __create_mount_point ${I} fsck_msdosfs -y ${I} mount_msdosfs -o large -l -L pl_PL.ISO8859-2 -D cp852 ${I} ${MNT} __log "${I}:mount (fat)" ;; (*ext2*) __create_mount_point ${I} fsck.ext2 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext2)" ;; (*ext3*) __create_mount_point ${I} fsck.ext3 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext3)" ;; (*ext4*) __create_mount_point ${I} fsck.ext4 -y ${I} ext4fuse ${I} ${MNT} # /* sysutils/fusefs-ext4fuse */ __log "${I}:mount (ext4)" ;; (*Unix\ Fast\ File*) __create_mount_point ${I} fsck_ufs -y ${I} mount ${I} ${MNT} __log "${I}:mount (ufs)" ;; (*) case $( dd < ${O} count=1 | strings | head -1 ) in (EXFAT) __create_mount_point ${I} mount.exfat ${I} ${MNT} # /* sysutils/fusefs-exfat */ __log "${I}:mount (ufs)" ;; (*) continue ;; esac ;; esac __state_add ${I} $( mount | grep -m 1 " ${MNT} " | awk '{printf $1}' ) \ ${MNT} || continue done ;; (detach) MOUNT=$( mount ) __state_lock grep ${1} ${STATE} \ | while read DEV PROVIDER MNT do TARGET=$( echo "${MOUNT}" | grep -E "^${PROVIDER} " | awk '{print $3}' ) [ -z ${TARGET} ] && { __state_remove ${MNT} ${STATE} ${LINE} continue } umount -f ${TARGET} & unset TARGET __state_remove ${MNT} ${STATE} ${LINE} __log "${DEV}:umount" done __state_unlock __log "/dev/${1}:detach" ;; esac ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
Latest version with additional checks for NTFS and FAT32, to be precise, for NTFS filesystem with label "FAT" and for FAT filesystem with label "NTFS" ;) #! /bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin LOG="/var/log/automount.log" STATE="/var/run/automount.state" DATEFMT="%Y-%m-%d %H:%M:%S" __create_mount_point() { # /* 1=DEV */ MNT="/mnt/$( basename ${1} )" mkdir -p ${MNT} } __state_lock() { while [ -f ${STATE}.lock ]; do sleep 0.5; done :> ${STATE}.lock } __state_unlock() { rm ${STATE}.lock } __state_add() { # /* 1=DEV 2=PROVIDER 3=MNT */ __state_lock grep -E "${3}" ${STATE} 1> /dev/null 2> /dev/null && { __log "${1}:duplicated '${STATE}'" return 1 } echo "${1} ${2} ${3}" >> ${STATE} __state_unlock } __state_remove() { # /* 1=MNT 2=STATE 3=LINE */ BSMNT=$( echo ${1} | sed 's/\//\\\//g' ) sed -i '' "/${BSMNT}\$/d" ${2} } __log() { # /* @=MESSAGE */ echo $( date +"${DATEFMT}" ) ${@} >> ${LOG} } case ${2} in (attach) for I in /dev/${1}* do case $( file -L -s ${I} | sed -E 's/label:\ \".*\"//g' ) in (*NTFS*) dd < ${I} count=1 2> /dev/null \ | strings \ | head -1 \ | grep -q "NTFS" && { __create_mount_point ${I} ntfs-3g ${I} ${MNT} # /* sysutils/fusefs-ntfs */ __log "${I}:mount (ntfs)" } ;; (*FAT*) dd < ${I} count=1 2> /dev/null \ | strings \ | grep -q "FAT32" && { __create_mount_point ${I} fsck_msdosfs -y ${I} mount_msdosfs -o large -l -L pl_PL.ISO8859-2 -D cp852 ${I} ${MNT} __log "${I}:mount (fat)" } ;; (*ext2*) __create_mount_point ${I} fsck.ext2 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext2)" ;; (*ext3*) __create_mount_point ${I} fsck.ext3 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext3)" ;; (*ext4*) __create_mount_point ${I} fsck.ext4 -y ${I} ext4fuse ${I} ${MNT} # /* sysutils/fusefs-ext4fuse */ __log "${I}:mount (ext4)" ;; (*Unix\ Fast\ File*) __create_mount_point ${I} fsck_ufs -y ${I} mount ${I} ${MNT} __log "${I}:mount (ufs)" ;; (*) case $( dd < ${I} count=1 2> /dev/null | strings | head -1 ) in (EXFAT) __create_mount_point ${I} mount.exfat ${I} ${MNT} # /* sysutils/fusefs-exfat */ __log "${I}:mount (ufs)" ;; (*) continue ;; esac ;; esac __state_add ${I} $( mount | grep -m 1 " ${MNT} " | awk '{printf $1}' ) \ ${MNT} || continue done ;; (detach) MOUNT=$( mount ) __state_lock grep ${1} ${STATE} \ | while read DEV PROVIDER MNT do TARGET=$( echo "${MOUNT}" | grep -E "^${PROVIDER} " | awk '{print $3}' ) [ -z ${TARGET} ] && { __state_remove ${MNT} ${STATE} ${LINE} continue } umount -f ${TARGET} & unset TARGET __state_remove ${MNT} ${STATE} ${LINE} __log "${DEV}:umount" done __state_unlock __log "/dev/${1}:detach" ;; esac ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
Added a check if ntfs-3g is available, if not then mount_ntfs is used instead. Added deleting of empty directories at ${MNTPREFIX}. Added ${MNTPREFIX} to be set to /mnt or /media according to preference #! /bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin MNTPREFIX="/media" LOG="/var/log/automount.log" STATE="/var/run/automount.state" DATEFMT="%Y-%m-%d %H:%M:%S" __create_mount_point() { # /* 1=DEV */ MNT="${MNTPREFIX}/$( basename ${1} )" mkdir -p ${MNT} } __state_lock() { while [ -f ${STATE}.lock ]; do sleep 0.5; done :> ${STATE}.lock } __state_unlock() { rm ${STATE}.lock } __state_add() { # /* 1=DEV 2=PROVIDER 3=MNT */ __state_lock grep -E "${3}" ${STATE} 1> /dev/null 2> /dev/null && { __log "${1}:duplicated '${STATE}'" return 1 } echo "${1} ${2} ${3}" >> ${STATE} __state_unlock } __state_remove() { # /* 1=MNT 2=STATE 3=LINE */ BSMNT=$( echo ${1} | sed 's/\//\\\//g' ) sed -i '' "/${BSMNT}\$/d" ${2} } __log() { # /* @=MESSAGE */ echo $( date +"${DATEFMT}" ) ${@} >> ${LOG} } case ${2} in (attach) for I in /dev/${1}* do case $( file -L -s ${I} | sed -E 's/label:\ \".*\"//g' ) in (*NTFS*) dd < ${I} count=1 2> /dev/null \ | strings \ | head -1 \ | grep -q "NTFS" && { __create_mount_point ${I} which ntfs-3g 1> /dev/null 2> /dev/null && { ntfs-3g ${I} ${MNT} # /* sysutils/fusefs-ntfs */ } || { mount_ntfs ${I} ${MNT} } __log "${I}:mount (ntfs)" } ;; (*FAT*) dd < ${I} count=1 2> /dev/null \ | strings \ | grep -q "FAT32" && { __create_mount_point ${I} fsck_msdosfs -y ${I} mount_msdosfs -o large -l -L pl_PL.ISO8859-2 -D cp852 ${I} ${MNT} __log "${I}:mount (fat)" } ;; (*ext2*) __create_mount_point ${I} fsck.ext2 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext2)" ;; (*ext3*) __create_mount_point ${I} fsck.ext3 -y ${I} mount -t ext2fs ${I} ${MNT} __log "${I}:mount (ext3)" ;; (*ext4*) __create_mount_point ${I} fsck.ext4 -y ${I} ext4fuse ${I} ${MNT} # /* sysutils/fusefs-ext4fuse */ __log "${I}:mount (ext4)" ;; (*Unix\ Fast\ File*) __create_mount_point ${I} fsck_ufs -y ${I} mount ${I} ${MNT} __log "${I}:mount (ufs)" ;; (*) case $( dd < ${I} count=1 2> /dev/null | strings | head -1 ) in (EXFAT) __create_mount_point ${I} mount.exfat ${I} ${MNT} # /* sysutils/fusefs-exfat */ __log "${I}:mount (ufs)" ;; (*) continue ;; esac ;; esac __state_add ${I} $( mount | grep -m 1 " ${MNT} " | awk '{printf $1}' ) \ ${MNT} || continue done ;; (detach) MOUNT=$( mount ) __state_lock grep ${1} ${STATE} \ | while read DEV PROVIDER MNT do TARGET=$( echo "${MOUNT}" | grep -E "^${PROVIDER} " | awk '{print $3}' ) [ -z ${TARGET} ] && { __state_remove ${MNT} ${STATE} ${LINE} continue } umount -f ${TARGET} & unset TARGET __state_remove ${MNT} ${STATE} ${LINE} __log "${DEV}:umount" done __state_unlock __log "/dev/${1}:detach" find ${MNTPREFIX} -type d -empty -delete ;; esac > Not sure if you've looked at disktype in sysutils > but it may be useful to you. I will get look into that, thanks ;) > Neat scripts! > Matt Thanks mate. Regards, vermaden -- ... ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
Hi, sorry for late response, but I currently have quite a lot 'weekend activities' that are definitely not near a computer ;) written by Gleb Kurtsou ... >> __state_lock() { >> while [ -f ${STATE}.lock ]; do sleep 0.5; done >> :> ${STATE}.lock >> } > > Why not keep it stateless, unmounting by hand would kill integrity. The state file is needed for automatic umount of fuse-based mounts, the device that script would be triggered will be /dev/da0 for example while the 'virtual' device that was actually used for the mount was /dev/fuse0, that is why I need to track what is mounted and how. These functions are mostly to keep that 'state file' integral, to prevent two various event writing at the file simultanously, which would probable killed the information integrity. Unmounting the device does not kill integrity at all, I also thought about that, You may plug the device, do whatever You want, event change the filesystem there and mount it again, but when You umount it and unplug it, then the script will umount that device (yes pointless here at this moment) and remove the entry from state file. > Usage of `file` is a big security concern. Can You explain why? > I think geom config and list of mounted file systems should be > sufficient for collecting information at runtime. Although it may not be > that easy for disks without partitioning. geom config? I also make use of the list of mounted filesystems, but the problem with fuse-based devices remain as I stated earlier. > I'm using a python script for mounting/unmounting removable disks, > but having similar tool written in sh would be great. > > https://github.com/glk/mmount Thanks for sharing, maybe I will find some ideas there ;) written by Uffe Jakobsen ... > Nice, Thanks. > Instead of requiring modification to /etc/devd.conf why not just > put a "plugin" conf-file in /etc/devd/ - well even better put in > /usr/local/etc/devd/ - that way your devd.conf modifications are > not lost upon patching/updating base os. Great advice, I will do that in the next 'release' ;) > There is an existing port called "automounter" by Dominic Fandrey > which is much similar to your work. Yes but its amd based. > His "automounter" also works with disk labels > (as found in /dev/ufs/ and /dev/msdosfs/ etc) The labels are only 'an addition' to appearing device nodes at /dev, Yes it would be nice to see that /dev/msdosfs/BACKUP is mounted instead of /dev/da0s1, but I will have to make a lot of additional check to see if that new label is part of that or other device etc. > You should consider make a port out of your work. I probably will try to do that, but I think it stil needs polish ;) written by Lars Engels ... > And please don't hardcode polish locales in mount_msdosfs :-) I already changed that, I also plan to create simple config file, it was just not 'the most important thing' that I was dealing with at that time, its easy to move options into variables, its harder to make script work the way it should ;) But thanks for suggestion, good point. written by Joe Culler ... > Thanks for working on it. It works great for me, thanks! Thanks, good to know ;) > I have a question, could you export a fusefs-exfat or > fusefs-ntfs share directory over NFS? I can't get it work. > If you have a solution, please let me know, thanks. I will try to do that tomorrow ane let You know. Regards, vermaden --- ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
Hi, new version with new features (and BUGs ;p) Added check if ntfsfix from sysutils/ntfsprogs is available, if Yes then try to fix the NTFS filesystem before mouting it. Added GPL3 License ... just joking ;) ... added FreeBSD License to the file. Added 'noatime' as a default mount option when possible. Added TIMEOUT so when an 'orphan' STATE file lock remains, it will be deleted after a TIMEOUT. Added /usr/local/etc/devd/automount.devd file instead of messing with the base system config at /etc/devd.conf. Added config file to be used from /usr/local/etc/automount.conf file, possible options are (these are defaults): MNTPREFIX="/media" LOG="/var/log/automount.log" STATE="/var/run/automount.state" ENCODING="en_US.ISO8859-1" CODEPAGE="cp437" DATEFMT="%Y-%m-%d %H:%M:%S" USERUMOUNT="NO" Mine config currently has only these: ENCODING="pl_PL.ISO8859-2" CODEPAGE="cp852" USERUMOUNT="YES" The USERMOUNT otions if set to YES (default to NO) will 'chmod +s /sbin/umount', so You can click the ^ button on the devices list in NAUTILUS. These newly mounted devices appear on NAUTILUS sidebar (only with /media prefix). But THUNAR and PCMANFM does not do that, You know any other FMs that display mounted thumb drives/devices? EXAMPLE: http://i.imgur.com/qdKdl.png First BUG: (not fixed yet, but workaround already is working) TEST/BUG/CASE: Plug in FAT32 and NTFS drives at the same time, when FAT32 device will be detected first, it will get mounted and the NTFS drive will be mounted TWICE, so I added __check_already_mounted function to check if it is not already mounted. Below are current script and config files. /usr/local/etc/devd/automount.devd --- notify 0 { match "system" "DEVFS"; match "type" "CREATE"; match "cdev" "(da|mmcsd)[0-9]+"; action "/usr/local/sbin/automount.sh $cdev attach"; }; notify 0 { match "system" "DEVFS"; match "type" "DESTROY"; match "cdev" "(da|mmcsd)[0-9]+"; action "/usr/local/sbin/automount.sh $cdev detach"; }; --- /usr/local/etc/automout.conf (can be empty) --- MNTPREFIX="/media" LOG="/var/log/automount.log" STATE="/var/run/automount.state" ENCODING="en_US.ISO8859-1" CODEPAGE="cp437" DATEFMT="%Y-%m-%d %H:%M:%S" USERUMOUNT="NO" --- /usr/local/sbin/automount.sh --- #! /bin/sh # Copyright (c) 2011 Slawomir Wojciech Wojtczak (vermaden) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright #notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright #notice, this list of conditions and the following disclaimer in the #documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS 'AS IS' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin [ -f /usr/local/etc/automount.conf ] && . /usr/local/etc/automount.conf : ${MNTPREFIX="/media"} : ${LOG="/var/log/automount.log"} : ${STATE="/var/run/automount.state"} : ${ENCODING="en_US.ISO8859-1"} # /* US/Canada */ : ${CODEPAGE="cp437"} # /* US/Canada */ : ${DATEFMT="%Y-%m-%d %H:%M:%S"} # /* 2012-02-20 07:49:09 */ : ${USERUMOUNT="NO"} # /* when YES add suid bit to umount(8) */ [ "${USERUMOU
Re: devd based AUTOMOUNTER
written by ${ME} ... > First BUG: (not fixed yet, but workaround already is working) > > TEST/BUG/CASE: > Plug in FAT32 and NTFS drives at the same time, when FAT32 device > will be detected first, it will get mounted and the NTFS drive will be > mounted TWICE, so I added > __check_already_mounted function > to check if it is not already mounted. This BUG is fixed, I was in wrong assumption, that the script would be only executed for /dev/da0 but it was executed for every device/partition node that appeared separately, like /dev/da0, /dev/da0s1, /dev/da0s2 etc. Currently there is no knows bugs, but the prepared earlier 'workaround functions' remain just in case. As I written before its now available here: https://github.com/vermaden/automount Regards, vermaden --- ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
Hi, I removed the state_lock and stat_unlock mechanisms as they appeared to be not needed, I have shufled with 3 drives all the time and the 'integrity' has not been lost, at it was a lot faster, because the lock always had to wait for the 'slowest' drive (in term of initializing the device, like USB hard drive). I simplified the 'attach' section a lot, now each filesystem contains only check/fsck (if possible), mount and log info. I also simplified and improved the 'detach' section a little. I have added an option to automatically launch the set-up in config file manager (Yes, like in Windows ;p). These are options that I currently successfully use for NAUTILUS file manager, You need to set-up all three of them to make it work. | POPUP=YES | FM="nautilus --browser --no-desktop" | USER=vermaden My whole config looks like that now: | USERUMOUNT=YES | POPUP=YES | FM="nautilus --browser --no-desktop" | USER=vermaden | ENCODING=pl_PL.ISO8859-2 | CODEPAGE=cp852 All latest updates are available at GITHUB: https://github.com/vermaden/automount written by Freddie Cash ... > Konqueror (KDE 3.x and 4.x) and Dolphin (KDE 4.x mainly, but I > believe there's a KDE 3.x version) also show automatically > mounted and removable media in the sidebar. Works nicely > with HAL. Haven't tested your script yet, but am intrigued by it. > Will see if I can test it sometime this week. > > Native solutions are so much nicer than ported ones. :) Thanks, looking forward to hear some more input about it from You ;) written by Fernando ApesteguĂa ... > What a nice piece of work. Thanks mate. > I just downloaded it and try it on a FreeBSD 9.0-RELEASE with > custom kernel. It works like a charm. I tried three different > USB devices without noticing any problems (and I was very > impolite when I unplugged them). > > Thanks for this script. Good to know, try the latest new version from repo, should be even better ;) Regards, vermaden ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"
Re: devd based AUTOMOUNTER
Hi, I have created a PORT at last, its in the 'port' directory in the usual place: https://github.com/vermaden/automount/ Its my first PORT so feel free to bash me about my mistakes ;) After latest 'commits' I think that its ready for day-to-day use. To make 'full advantage' of *automount* install these ports: sysutils/ntfsprogs sysutils/fusefs-ntfs sysutils/fusefs-ext4fuse sysutils/fusefs-exfat I will try to add these ports as OPTIONS in the Makefile later. I will have to think about creating a man page through ... Feel free to submit Your propositions about next changes/development, because I think that I already created everything 'I' needed. Regards, vermaden --- ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"