diff options
author | Mathieu Blondel <mathieu@mblondel.org> | 2007-05-22 16:45:14 +0000 |
---|---|---|
committer | Mathieu BlondelMathieu Blondel <mathieu@mblondel.orgmathieu@mblondel.org> | 2007-05-22 16:45:14 +0000 |
commit | 90a55111a243262cd214edf68625517d4d9d0f8e (patch) | |
tree | cd09aa594ecb39d65b43b7409323ad25b2a05d1f | |
parent | 881cfca0888997d57db8893ca6e1523a2fb1f5a7 (diff) | |
download | wikipediafs-90a55111a243262cd214edf68625517d4d9d0f8e.tar.gz |
- Updated README and manpage.
- Fixed mount from fstab.
git-svn-id: http://svn.code.sf.net/p/wikipediafs/code/trunk@44 59acd704-e115-0410-a914-e735a229ed7c
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | doc/mount.wikipediafs.sgml | 120 | ||||
-rwxr-xr-x | src/mount.wikipediafs | 33 |
4 files changed, 116 insertions, 52 deletions
@@ -1,3 +1,8 @@ +2007-05-22 Mathieu Blondel <mblondel@users.sourceforge.net> + +- Updated README and manpage. +- Fixed mount from fstab. + 2007-05-21 Mathieu Blondel <mblondel@users.sourceforge.net> - Introduced MetaDir (metadir.py). @@ -6,9 +6,9 @@ View and edit Wikipedia articles as if they were real files. Requirements ------------ -Python -Fuse -Python-Fuse +Python 2.4 http://www.python.org +Fuse 2.6.3 http://fuse.sourceforge.net +Fuse-python 0.2 http://fuse.sourceforge.net/wiki/index.php/FusePython Install ------- @@ -46,11 +46,11 @@ Try this: ** Other -The FAQ available on the official Fuse website is worth reading. +The FAQ available on the official Fuse website is probably worth reading. URL : http://fuse.sourceforge.net/ License ------- WikipediaFS is distributed under the terms of the GNU General Public -License. See the COPYING file for more information.
\ No newline at end of file +License. See the COPYING file for more information. diff --git a/doc/mount.wikipediafs.sgml b/doc/mount.wikipediafs.sgml index b9519f4..70c0237 100644 --- a/doc/mount.wikipediafs.sgml +++ b/doc/mount.wikipediafs.sgml @@ -33,7 +33,7 @@ manpage.1: manpage.sgml &mansurname; </author> <copyright> - <year>2004</year> + <year>2007</year> <holder>&manusername;</holder> </copyright> &mandate; @@ -47,7 +47,7 @@ manpage.1: manpage.sgml <refname>&manpackage;</refname> <refpurpose>A program to mount WikipediaFS, a filesystem that allows to view -and edit Wikipedia articles as if they were real files</refpurpose> +and edit Wikipedia articles as if they were real files.</refpurpose> </refnamediv> <refsynopsisdiv> <cmdsynopsis> @@ -65,8 +65,8 @@ they were real files. <command>&manpackage;</command> mounts a WikipediaFS filesystem. </para> - <para>To connect through an HTTP proxy, you can use the $http_proxy -environment variable.</para> + <para>To connect through an HTTP proxy, it possible to use +the $http_proxy environment variable.</para> </refsect1> @@ -74,23 +74,14 @@ environment variable.</para> <title>CONFIGURATION</title> <para>The first time WikipediaFS is run, an XML configuration file is - generated in ~/.wikipediafs/config.xml. You can then edit it to add - more Wikipedia or Mediawiki-based sites. Each site has a site entry - defined as follows: </para> - - <para> - <site> - <dirname>wikipedia-fr</dirname> - <host>fr.wikipedia.org</host> - <basename>/w/index.php</basename> - <username>Username</username> - <password>Password</password> - </site> - </para> + generated in ~/.wikipediafs/config.xml. It is possible to edit it + later to add more Wikipedia or Mediawiki-based sites. Each site + entry can define the following elements. Elements marked with an * are + mandatory.</para> <variablelist> <varlistentry> - <term>dirname</term> + <term>dirname*</term> <listitem> <para> Is the name of the directory through which you will access @@ -99,7 +90,7 @@ environment variable.</para> </listitem> </varlistentry> <varlistentry> - <term>host</term> + <term>host*</term> <listitem> <para> Is the host of the site. @@ -107,7 +98,7 @@ environment variable.</para> </listitem> </varlistentry> <varlistentry> - <term>basename</term> + <term>basename*</term> <listitem> <para> Is the base of urls used by the site. Most of the time, it @@ -120,11 +111,28 @@ environment variable.</para> <term>username and password</term> <listitem> <para> - Are optional and enable you to edit articles with your + Enables to edit articles with one's login. </para> </listitem> - </varlistentry> + </varlistentry> + <varlistentry> + <term>httpauth_username and httpauth_password</term> + <listitem> + <para> + Can be used for Mediawiki sites protected + with HTTP authentication (Apache's .htaccess). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term>https</term> + <listitem> + <para> + Use HTTPS instead of HTTP. + </para> + </listitem> + </varlistentry> </variablelist> </refsect1> @@ -151,6 +159,10 @@ into account.)</para> <title>UNMOUNT</title> <para><command>fusermount</command> -u mountpoint/</para> + + <para>or simply</para> + + <para><command>umount</command> mountpoint/</para> </refsect1> @@ -161,14 +173,20 @@ into account.)</para> <para>To do so, add this line to /etc/fstab:</para> - <para>none /mnt/wfs/ wikipediafs -noauto,nouser,home=/home/your_username/</para> + <para>none /mnt/wfs/ wikipediafs noauto,nouser</para> <para>Replace noauto by auto if you want WikipediaFS to be mounted at -boot. Replace nouser by user if you want to allow simple users to use -WikipediaFS. Replace /home/your_username/ by your home directory.</para> +boot. </para> + + <para>Replace nouser by user if you want to allow simple users to use +WikipediaFS.</para> + + <para>A symbolic link from /usr/bin/mount.wikipediafs to +/sbin/mount.wikipediafs is needed if WikipediaFS is mounted through +fstab.</para> -<para>Then, traditional mount and unmount can be used with WikipediaFS.</para> +<para>Then, traditional mount and unmount commands can be used with +WikipediaFS.</para> </refsect1> <refsect1> @@ -186,26 +204,36 @@ WikipediaFS is now mounted in /mnt/wfs/</para> We are now at the WikipediaFS root.</para> <para>$ ls -mblondel.org/ wikipedia-en/ + +mblondel.org/ + +This directory has been defined in the configuration file.</para> + +<para>$ mkdir wikipedia-en/ + +WikipediaFS recognizes the "site-lang" pattern for the sites from the Wikimedia +Foundation.</para> + +<para>$ ls -Those are directories which have been defined in my config file.</para> +mblondel.org/ wikipedia-en/</para> <para>$ ls wikipedia-en/ -Nothing is listed because we have not used any file yet. This is why most of -the time you will need a terminal to run the "your_favourite_editor file_name" -command.</para> +Nothing is listed because we have not used any file yet.</para> -<para>$ cat wikipedia-en/Japan | less +<para>$ cat wikipedia-en/Japan.mw | less -The Japan article is fetched on en.wikipedia.org and displayed.</para> +The Japan article is fetched on en.wikipedia.org and displayed. Note that +the .mw extension is required.</para> <para>$ ls wikipedia-en/ -Japan + +Japan.mw -Japan is now listed because it has been accessed once.</para> +Japan.mw is now listed because it has been accessed once.</para> -<para>$ vi mblondel.org/Test +<para>$ vi mblondel.org/Test.mw An article can be edited with a text editor. Looking at the article with a web browser, the changes have been performed correctly. @@ -213,18 +241,24 @@ browser, the changes have been performed correctly. To give a summary to your changes, use [[Summary: a sentence summary]] in the body of the article. It will be removed before the article is saved.</para> -<para>$ cp wikipedia-en/Japan ~/Desktop/ +<para>$ cp wikipedia-en/Japan.mw ~/Desktop/ -This backups the online article on the local disk.</para> +This backups the online article to the local disk.</para> -<para>$ cp wikipedia-en/Japan mblondel.org/ +<para>$ cp wikipedia-en/Japan.mw mblondel.org/ -This copies the wikipedia-en article on my personal mediawiki site.</para> +This copies the wikipedia-en article to the mblondel.org entry.</para> -<para>$ rm mblondel.org/Test +<para>$ rm mblondel.org/Test.mw This only removes the article from the directory, not from the site, hopefully.</para> + +<para>$ mkdir -p mblondel.org/Foo/Bar/</para> + +<para>$ vi mblondel.org/Foo/Bar/Code.mw + +Subpages are supported. You need to create the directories first.</para> </para> </refsect1> @@ -234,7 +268,7 @@ hopefully.</para> <para>This manual page was written by <author>&manfirstname; &mansurname;</author>. </para> - <para>This manual page is (c) 2006 of <author>&manfirstname; + <para>This manual page is (c) 2006-2007 of <author>&manfirstname; &mansurname;</author> and licensed under the terms of the GPLv2 or higher </para> diff --git a/src/mount.wikipediafs b/src/mount.wikipediafs index 4f8feb8..de4fbc6 100755 --- a/src/mount.wikipediafs +++ b/src/mount.wikipediafs @@ -18,6 +18,8 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import os +import sys from sys import exit try: @@ -26,15 +28,38 @@ except: print "The Python bindings for fuse do not seem to be installed." print "Please install the fuse-python package." exit(1) - + +# When WFS is mounted with fstab, HOME is not defined... +# We have to deal with this since we need HOME for the config and the log. +if not os.environ.has_key("HOME"): + last = len(sys.argv) - 1 + mountoptions = sys.argv[last] + arr = [] + home = None + for o in mountoptions.split(","): + if o[0:5] == "home=": + spl = o.split("=") + if len(spl) == 2: + home = spl[1] + elif o != "noauto" and o != "user" and o != "auto" and o != "nouser": + arr.append(o) + sys.argv[last] = ','.join(arr) + + if home: + os.environ["HOME"] = home + elif os.environ.has_key("USER"): + if os.environ["USER"] == "root": + os.environ["HOME"] = "/root/" + else: + os.environ["HOME"] = "/home/%s/" % os.environ["USER"] + from wikipediafs.fs import WikipediaFS try: from wikipediafs.version import VERSION except: VERSION = 'development version' - - + try: server = WikipediaFS(version="%prog " + VERSION, usage='%prog mountpoint', @@ -45,4 +70,4 @@ try: server.main() except FuseError, detail: print detail -
\ No newline at end of file + |