This is something that really pisses me off: FireFox 3 makes downloaded files read-only because they’re saved in /tmp, and OpenOffice doesn’t let you manipulate a read-only file. Even for something stupid and simple, like changing page margins, you have to click the pencil icon in the toolbar, click OK to an error message, and click Yes to something else. FF says “it’s supposed to be read-only, have OO fix it” and OO says “it’s read-only, tell FF to make it not read-only” and lowly-user daresay “M$ Turd handles this gracefully” and “Hey, FF, if you had made this a user-configurable option in FF3 instead of doing a global search & replace, this wouldn’t be an issue!”
Well to hell with it. This script fixes the problem by watching /tmp for files ending in doc,csv,xls,odf (and some others) and makes them writable by using the inotifywait command, which is part of the inotify-tools package. I use openSUSE so it was easy to find in the Install Software applet.
I was going to make an init.d script out of it, but I am busy… It’s just running in a Konsole on Desktop 4 along with all the other out-of-the-way stuff.
#!/bin/bash
# author John Stanfield
# makes files in /tmp/ writable upon creation
# this is a workaround for the religious war between OpenOffice and Mozilla regarding read-only files
# it's intended for users who want to
# 1) download a file
# 2) make a small edit (e.g. page margin, white space, etc)
# 3) read it, print it, email it, etc
# 4) IMPORTANT!
# a) not be upset if the file is, accidentally or otherwise, deleted in the future
# or
# b) save the file elsewhere
inotifywait -m -e create --format %w%f /tmp/ | while read line
do
if (echo found file... ${line} | egrep "\.od[t|s|p|g|f]$|\.csv$|\.doc$|\.rtf$|\.xls$|\.ppt$"); then
chmod +w "${line}"
echo `date` made ${line} writable
fi
done
And unhighlighted:
#!/bin/bash
# author John Stanfield
# makes files in /tmp/ writable upon creation
# this is a workaround for the religious war between OpenOffice and Mozilla regarding read-only files
# it's intended for users who want to
# 1) download a file
# 2) make a small edit (e.g. page margin, white space, etc)
# 3) read it, print it, email it, etc
# 4) IMPORTANT!
# a) not be upset if the file is, accidentally or otherwise, deleted in the future
# or
# b) save the file elsewhere
inotifywait -m -e create --format %w%f /tmp/ | while read line
do
if (echo found file... ${line} | egrep "\.od[t|s|p|g|f]$|\.csv$|\.doc$|\.rtf$|\.xls$|\.ppt$"); then
chmod +w "${line}"
echo `date` made ${line} writable
fi
done