[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r140 - in GNUnet: contrib doc/man src/applications/fs/ecrs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r140 - in GNUnet: contrib doc/man src/applications/fs/ecrs src/applications/fs/tools |
Date: |
Mon, 31 Jan 2005 20:46:49 -0800 (PST) |
Author: grothoff
Date: 2005-01-31 20:46:49 -0800 (Mon, 31 Jan 2005)
New Revision: 140
Modified:
GNUnet/contrib/gnunet.user
GNUnet/doc/man/gnunet-insert.1
GNUnet/src/applications/fs/ecrs/upload.c
GNUnet/src/applications/fs/tools/gnunet-insert.c
Log:
updates to gnunet-insert
Modified: GNUnet/contrib/gnunet.user
===================================================================
--- GNUnet/contrib/gnunet.user 2005-02-01 03:54:32 UTC (rev 139)
+++ GNUnet/contrib/gnunet.user 2005-02-01 04:46:49 UTC (rev 140)
@@ -79,8 +79,19 @@
# Default is /tmp/gnunet-downloads/
DOWNLOADDIR = /tmp/gnunet-downloads/
-# Disable symlinking.
-DISABLE-SYMLINK = NO
+# Disable symlinking. When set to YES, GNUnet will always make
+# a copy of the file when files are indexed. The default is to
+# try to use a symbolic link (if possible).
+# Note that you should NEVER, NEVER simply delete the .gnunet
+# directory if this is set to 'NO', since all inserted files
+# will have been moved into that directory and replaced with
+# symbolic links. So if you were to remove ~/.gnunet, you will
+# loose those files unless you first run gnunet-delete to undo
+# the symlinking!
+# It is much more (space)-efficient to set this to NO,
+# but you need to know what you're doing. This is why the
+# default is 'YES'.
+DISABLE-SYMLINK = YES
#################################################
Modified: GNUnet/doc/man/gnunet-insert.1
===================================================================
--- GNUnet/doc/man/gnunet-insert.1 2005-02-01 03:54:32 UTC (rev 139)
+++ GNUnet/doc/man/gnunet-insert.1 2005-02-01 04:46:49 UTC (rev 140)
@@ -1,4 +1,4 @@
-.TH GNUNET-INSERT "1" "19 Sept 2004" "GNUnet"
+.TH GNUNET-INSERT "1" "31 Jan 2005" "GNUnet"
.SH NAME
gnunet-insert \- a command line interface for inserting new content into GNUnet
.SH SYNOPSIS
@@ -17,10 +17,9 @@
directories that can be browsed within GNUnet and publish file lists
in a namespace.
.PP
-If libextractor was available when GNUnet was compiled, gnunet-insert can
-automatically extract keywords from the files that are shared. Users that
+gnunet-insert can automatically extract keywords from the files that are
shared. Users that
want to download files from GNUnet use keywords to search for the appropriate
-content. You can disable keyword extraction with the \-x option. You can
+content. You can disable keyword extraction with the \-n option. You can
manually add keywords using the \-k and \-K options.
.PP
In addition to searching for files by keyword, GNUnet allows organizing
@@ -29,10 +28,9 @@
directory. Directories can contain pointers to other directories.
.PP
With gnunet\-insert, it is easy to create new directories simultaneously
-when adding the files. Simply add the option \-b to create a directory.
-With \-b alone, a directory containing all of the files listed at the command
-line is created. Together with the \-R (recursive) option, an entire directory
-tree can be added to GNUnet. The structure of the tree is preserved.
+when adding the files. Simply add the option \-R to recursively insert
+an entire directory and create the corresponding directory structure in
+GNUnet.
.PP
Since keywords can be spammed (any user can add any content under any
keyword), GNUnet supports namespaces. A namespace is a subset of the
@@ -59,25 +57,20 @@
to gnunet-insert with the \-i option. The \-S option is used to indicate
sporadically updated content. You can use the \-N option to specify the future
identifier of the update (only for the first update of periodically updated
-content). Without \-N, gnunet\-insert will select (and output) a random
-identifier that must be used for the update.
+content). Without \-N, gnunet\-insert will select (and output) a random
+identifier that must be used for the next update. You can use the option
+\-u to specify the identifier of the previous version of the content that
+you want to update.
.PP
-To update content in a namespace, gnunet-insert options \-e and \-o can be
used.
-On the first insert, \-o can be used to output the namespace block data into a
file.
-On subsequent updates, \-e can be used to read the previous block, which is
used
-to automatically calculate the information required for an update. Currently
-the most convenient way to make regular namespace updates efficiently
-remains a bit awkward. The trick is to insert a filesystem directory
-that instead of containing a possibly very large directory hierarchy,
-contains only the top level ".gnd" GNUnet directory files you have previously
-created or downloaded. That is, what is inserted is a flat directory,
-with time cost same as inserting the .gnd files, but the result
-will still be equal to a full-blown directory tree having
-actual files and further subdirectories.
-.PP
-You can use libextractor or command\-line options to specify a mimetype and a
-description for the files. The description and keywords are used to help
+You can use automatic meta-data extraction (based on libextractor)
+or the command\-line option \-m to specify meta-data. For the \-m
+option you need to use the form keyword-type:value. For example,
+use "\-m os:Linux" to specify that the operating system is Linux.
+Common meta-data types are "author", "title" , "mimetype", "filename",
+"language", "subject" and "keywords". A full list can be obtained from
+the extract tool using the option \-\-list. The meta-data is used to help
users in searching for files on the network. The keywords are case\-sensitive.
+.PP
GNUnet supports two styles of publishing files on the network. Inserting
a file means that a copy of the file is made in the local (!) database of
the node. Indexing a file means that an index is added to the local (!)
@@ -93,31 +86,30 @@
a file and then leave the network, it will almost always NOT be available
anymore.
-.TP
-\fB\-b\fR, \fB\-\-builddir\fR
-Build a directory. With this option, gnunet\-insert will create a directory
containing all the files specified at the command-line and insert that
directory into GNUnet. This allows grouping multiple files together. Together
with the \-R option, gnunet\-insert can be used to mirror an entire directory
tree in GNUnet. The directory structure is preserved (not all files are placed
at the top\-level directory).
-
-.TP
\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
Use alternate config file (if this option is not specified, the default is
~/.gnunet/gnunet.conf).
-.TP
-\fB\-e \fIFILENAME\fR, \fB\-\-sprev=\fIFILENAME\fR
-Specifies the previous SBlock file that contains the necessary information to
update a periodical SBlock. On the first time of inserting a periodical, use
\-o to create the file, without \-e. Filenames in \-o and \-e can be the same.
+\fB\-C\fR, \fB\-\-copy\fR
+Even if using links to the .gnunet directory is generally permitted, make a
copy of the file (disables symlinking even if it is possible). When indexing a
file, gnunet\-insert will create a copy of the file in the "share" directory of
gnunetd. If that directory happens to be on the local machine (i.e. gnunetd
runs on localhost) then gnunet\-insert can instead just use a link. This will
not work over the network, if the file\-permissions do not allow gnunetd to
read the file or if the file maybe changed afterwards. Hence the default is to
be inefficient and to make a copy. With this option you can force
gnunet\-insert to not make a link. gnunet\-insert will fall back to creating a
copy.
.TP
-\fB\-f \fINAME\fR, \fB\-\-name=\fINAME\fR
-Executive summary: You probably don't need it.
+\fB\-e\fR, \fB\-\-extract\fR
+Print the list of keywords that will be extracted. Do not perform any
indexing or insertion.
-If a single file is inserted with RBlocks or an SBlock, use NAME as the
published name for that file. If multiple files are specified and no directory
is created, NAME is again used for all of these files. In both cases, if this
option is not given, the default is to preserve the actual filenames without
the path.
-
-If a directory is created from multiple files mentioned on the command line,
NAME is used for the directory. The names for the individual files are still
the original filenames without path. If a directory is created recursively from
a single filename on the command line and if NAME is not specified, the last
component of the specified filename is used for the directory. If a directory
is created from multiple filenames specified on the command line, "not set" is
used for the name of the directory.
-
.TP
\fB\-h\fR, \fB\-\-help\fR
Print a brief help page with all the options.
.TP
+\fB\-i \fISECONDS\fR, \fB\-\-interval=\fISECONDS\fR
+Specifies the update frequency of the content in seconds. This option is only
valid together with the \-s option. If no current and next ID are specified,
the system picks some random start values for the sequence.
+
+Most recent update can be found by gnunet\-gtk automatically. gnunet\-search
will print all edition ids
+between the insertion time and the current time. A new search can be then
performed with one of the printed keys.
+Also, using gnunet\-insert for updating content is cumbersome, in the future
gnunet\-gtk will provide a more interactive
+way to manage content updates.
+
+.TP
\fB\-k \fIKEYWORD\fR, \fB\-\-key=KEYWORD\fR
additional key to index the content with (to add multiple keys, specify
multiple times). Each additional key is case-sensitive. Can be specified
multiple times. The keyword is only applied to the top\-level files or
directories.
@@ -130,67 +122,34 @@
Change the loglevel. Possible values for LOGLEVEL are NOTHING, FATAL, ERROR,
FAILURE, WARNING, MESSAGE, INFO, DEBUG, CRON and EVERYTHING.
.TP
-\fB\-v\fR, \fB\-\-version\fR
-Print the version number.
+\fB\-m \fITYPE:VALUE\fR, \fB\-\-meta=\fITYPE:VALUE\fR
+For the main file (or directory), set the meta-data of the given TYPE to the
given VALUE.
.TP
-\fB\-V\fR, \fB\-\-verbose\fR
-Be verbose. Using this option causes gnunet-insert to print progress
information and at the end the file identification that can be used to
download the file from GNUnet.
+\fB\-n\fR, \fB\-\-noindex\fR
+Executive summary: You probably don't need it.
-.TP
-\fB\-R\fR, \fB\-\-recursive\fR
-Process directories recursively. Without this option, directories are
ignored. With this option, gnunet-insert will process files in directories
recursively.
+Do not index, full insertion. Note that directories, RBlocks, SBlocks and
IBlocks are always inserted (even without this option). With this option,
every block of the actual files is stored in encrypted form in the block
database of the local peer. While this adds security if the local node is
compromised (the adversary snags your machine), it is significantly less
efficient compared to on\-demand encryption and is definitely not recommended
for large files.
.TP
-\fB\-E\fR, \fB\-\-extract\fR
-Print the list of keywords that will be extracted. Do not perform any
indexing or insertion.
-
-.TP
-\fB\-l\fR, \fB\-\-link\fR
-When indexing a file, gnunet\-insert will create a copy of the file in the
"share" directory of gnunetd. If that directory happens to be on the local
machine (i.e. gnunetd runs on localhost) then gnunet-insert can instead just
use a link. This will not work over the network, if the file-permissions do
not allow gnunetd to read the file or if the file maybe changed afterwards.
Hence the default is to be inefficient and to make a copy. With this option
you can cause gnunet\-insert to TRY to make a link. If the link does not work
for some reason that GNUnet can detect, gnunet-insert will fall back to
creating a copy.
-
-.TP
-\fB\-s \fINAME\fR, \fB\-\-pseudonym=\fINAME\fR
-For each file at the command line (or, if \-b is specified, for the top\-level
directory) create an SBlock that places the file into the namespace specified
by the pseudonym NAME.
-
-.TP
-\fB\-P \fIPASSWORD\fR, \fB\-\-pass=\fIPASSWORD\fR
-Specifies the password for the pseudonym (if needed). If the password is
invalid gnunet-insert aborts with an error. This option is only valid together
with the \-s option.
-
-.TP
-\fB\-t \fIID\fR, \fB\-\-this=\fIID\fR
-Specifies the ID of the SBlock. This option is only valid together with the\
-s option and together with either the option \-b or only a single filename on
the command-line.
-
-The ID can be given in HEX notation, otherwise the HEX code is derived by
hashing the given ID string
-which may be a natural language keyword.
-
-.TP
-\fB\-T \fITIME\fR, \fB\-\-time=\fITIME\fR
-Specifies the SBlock creation time. Requires format
-
-"DAY-MONTHNUMBER\-YEAR HOUR:MINUTE"
-
-for TIME. This option can be used to publish past and future periodical
-SBlocks. The option works best when used together with \-e. Default time is
the current time.
-
-.TP
\fB\-N \fIID\fR, \fB\-\-next=\fIID\fR
Specifies the next ID of a future version of the SBlock. This option is only
valid together with the \-s option and together with either the option -b or
only a single filename on the command\-line. This option can be used to
specify what the identifier of an updated version will look like. Without the
\-i option, a one\-shot update SBlock is used (a\-periodic). With the \-i
option, the difference between the current ID (this) and the next ID is used
to compute all future IDs. Note that specifying \-i and \-N without \-t hardly
ever makes sense.
The ID can be given in HEX notation, otherwise the HEX code is derived by
hashing the given ID string.
.TP
-\fB\-o \fIFILENAME\fR, \fB\-\-sout=\fIFILENAME\fR
-Write the created SBlock to a file. This is especially useful with periodical
updates done by a script. The SBlock file contains the necessary information to
update the periodical SBlock. Filenames in \-o and \-e can be the same.
+\fB\-p \fIPRIORITY\fR, \fB\-\-prio=\fIPRIORITY\fR
+Executive summary: You probably don't need it.
+Set the priority of the inserted content (default: 65535). If the local
database is full, GNUnet will discard the content with the lowest ranking.
Note that ranks change over time depending on popularity. The default should
be high enough to preserve the locally inserted content in favor of content
that migrates from other peers.
+
.TP
-\fB\-i \fISECONDS\fR, \fB\-\-interval=\fISECONDS\fR
-Specifies the update frequency of the content in seconds. This option is only
valid together with the \-s option. If no current and next ID are specified,
the system picks some random start values for the sequence.
+\fB\-P \fINAME\fR, \fB\-\-pseudonym=\fINAME\fR
+For the top\-level directory or file, create an SBlock that places the file
into the namespace specified by the pseudonym NAME.
-Most recent update can be found by gnunet\-gtk automatically. gnunet\-search
will print all edition ids
-between the insertion time and the current time. A new search can be then
performed with one of the printed keys.
-Also, using gnunet\-insert for updating content is cumbersome, in the future
gnunet\-gtk will provide a more interactive
-way to manage content updates.
+.TP
+\fB\-R\fR, \fB\-\-recursive\fR
+Process directories recursively. Without this option, directories are
ignored. With this option, gnunet-insert will process files in directories
recursively.
.TP
\fB\-S\fR, \fB\-\-sporadic\fR
@@ -199,38 +158,28 @@
If you use \-s but not \-S, \-N or \-i, the content will not be updateable.
.TP
-\fB\-m \fIMIMETYPE\fR, \fB\-\-mime=\fIMIMETYPE\fR
-Set the mime\-type of all (!) files to be MIMETYPE. This option has no effect
on directories (option \-b). If not supplied and the option \-x is not
specified, gnunet\-insert will attempt to determine the mime\-type using
libextractor and otherwise use "unknown".
+\fB\-t \fIID\fR, \fB\-\-this=\fIID\fR
+Specifies the ID of the SBlock. This option is only valid together with the\
-s option and together with either the option \-b or only a single filename on
the command-line.
-.TP
-\fB\-p \fIPRIORITY\fR, \fB\-\-prio=\fIPRIORITY\fR
-Executive summary: You probably don't need it.
+The ID can be given in HEX notation, otherwise the HEX code is derived by
hashing the given ID string
+which may be a natural language keyword.
-Set the priority of the inserted content (default: 65535). If the local
database is full, GNUnet will discard the content with the lowest ranking.
Note that ranks change over time depending on popularity. The default should
be high enough to preserve the locally inserted content in favor of content
that migrates from other peers.
-
.TP
-\fB\-n\fR, \fB\-\-noindex\fR
-Executive summary: You probably don't need it.
+\fB\-T \fITIME\fR, \fB\-\-time=\fITIME\fR
+Specifies the SBlock creation time. The required format depends on your
locale.
-Do not index, full insertion. Note that directories, RBlocks, SBlocks and
IBlocks are always inserted (even without this option). With this option,
every block of the actual files is stored in encrypted form in the block
database of the local peer. While this adds security if the local node is
compromised (the adversary snags your machine), it is significantly less
efficient compared to on\-demand encryption and is definitely not recommended
for large files.
+for TIME. This option can be used to publish past and future periodical
+SBlocks. The option works best when used together with \-e. Default time is
the current time.
.TP
-\fB\-x\fR, \fB\-\-extraction\fR
-Executive summary: You probably don't need it.
+\fB\-v\fR, \fB\-\-version\fR
+Print the version number.
-Disable automatic keyword extraction. This option is only available if you
compiled GNUnet with libextractor. With this option, you can disable the use
of libextractor to obtain meta\-data (mime\-type, description, keywords) from
the files being processed. In this case, you probably want to manually supply
a list of keywords and a description on the command line. Note that if you
process multiple files or do recursive processing, the description, mime\-type
and keywords will be used for all files (and directories).
-
-\-x implies \-X.
-
-
-
.TP
-\fB\-X\fR, \fB\-\-nodirectindex\fR
-Executive summary: You probably don't need it.
+\fB\-V\fR, \fB\-\-verbose\fR
+Be verbose. Using this option causes gnunet-insert to print progress
information and at the end the file identification that can be used to
download the file from GNUnet.
-With this option, gnunet\-insert will not create individual RBlocks for all
files except for keywords specified with the \-K option. With \-X,
gnunet\-insert will create an RBlock for each keyword infered from the files.
It does not disable the use of libextractor for finding the description and
mime\-types for these files.
-
.SH EXAMPLES
.PP
@@ -250,7 +199,7 @@
Index a file COPYING with description "GNU License", mime-type "text/plain"
and keywords \fBgpl\fR and \fBtest\fR:
-# gnunet\-insert \-D "GNU License" \-k gpl \-k test -m "text/plain" COPYING
+# gnunet\-insert \-m "description:GNU License" \-k gpl \-k test -m
"mimetype:text/plain" COPYING
\fBUsing directories\fR
@@ -262,10 +211,10 @@
Neatly publish an image gallery in \fBkittendir/\fR and its
subdirs with keyword \fBkittens\fR for the directory but no
-keywords for the individual files or subdirs (\-brX).
+keywords for the individual files or subdirs (\-Rn).
Force description for all files:
-# gnunet\-insert \-bRX \-D "Kitten collection" \-k kittens kittendir
+# gnunet\-insert \-Rn \-m "description:Kitten collection" \-k kittens kittendir
\fBSecure publishing with namespaces\fR
@@ -274,34 +223,33 @@
# gnunet\-insert \-s RIAA \-P MPAA \-t gpl COPYING
-Recursively (\-R) index /home/ogg and build a matching directory structure
(\-b).
+Recursively (\-R) index /home/ogg and build a matching directory structure.
Insert the top\-level directory into the namespace under the pseudonym
RIAA (\-s) with password MPAA (\-P) under identifier MUSIC (\-t) and
promise to provide an update with identifier VIDEOS (\-N) at an
arbitrary point in the future (\-S is implied by lack of \-i
and presence of \-N):
-# gnunet\-insert \-Rb \-s RIAA \-P MPAA \-t MUSIC \-N VIDEOS /home/ogg
+# gnunet\-insert \-R \-s RIAA \-P MPAA \-t MUSIC \-N VIDEOS /home/ogg
Recursively (\-R) insert (\-n) /var/lib/mysql and build a matching directory
-structure (\-b) but disable the use of libextractor to extract keywords
-(\-X) while allowing the use of libextractor to provide descriptions (lack
-of \-x). Print the file identifiers (\-V) that can be used to retrieve
+structure, but disable the use of libextractor to extract keywords
+(\-n). Print the file identifiers (\-V) that can be used to retrieve
the files. This will store a copy of the MySQL database in GNUnet but
without adding any keywords to search for it. Thus only people that
have been told the secret file identifiers printed with the \-V option
can retrieve the (secret?) files:
-# gnunet\-insert \-RnbXV /var/lib/mysql
+# gnunet\-insert \-RnV /var/lib/mysql
-Create a periodical SBlock with 24h update interval
-and store the created block to a file sblock.dat (unencrypted):
+Create a periodical SBlock with a sporadic update interval and announce
+that the next update will be called 'next':
-# gnunet\-insert \-s RIAA \-P MPAA \-o sblock.dat \-i 86400 \-D "My noisy
file" \-t noise noise.mp3
+# gnunet\-insert \-P MPAA \-N next \-S noise.mp3
Update the periodical SBlock using settings from a previous time:
-# gnunet\-insert \-s RIAA \-P MPAA \-e sblock.dat \-o sblock.dat \-D "My
updated noisy file" noise_updated.mp3
+# gnunet\-insert \-P MPAA \-t next -N nextnext noise_updated.mp3
.SH FILES
Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c 2005-02-01 03:54:32 UTC (rev
139)
+++ GNUnet/src/applications/fs/ecrs/upload.c 2005-02-01 04:46:49 UTC (rev
140)
@@ -101,7 +101,7 @@
char * tmpName;
HashCode160 serverFileId;
- if (testConfigurationString("AFS",
+ if (testConfigurationString("FS",
"DISABLE-SYMLINKING",
"YES"))
return;
Modified: GNUnet/src/applications/fs/tools/gnunet-insert.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-insert.c 2005-02-01 03:54:32 UTC
(rev 139)
+++ GNUnet/src/applications/fs/tools/gnunet-insert.c 2005-02-01 04:46:49 UTC
(rev 140)
@@ -25,13 +25,6 @@
* @author Krista Bennett
* @author James Blackwell
* @author Igor Wronsky
- *
- *
- * Todo:
- * - implement namespace insertion
- * - check that the various options still work
- * - allow any kind of meta-data attribute (currently only
- * description, filename and mime-type can be specified)
*/
#include "platform.h"
@@ -39,7 +32,6 @@
#include <langinfo.h>
-
/* hmm. Man says time.h, but that doesn't yield the
prototype. Strange... */
extern char *strptime(const char *s,
@@ -57,9 +49,9 @@
static struct FSUI_Context * ctx;
-
static char ** topKeywords = NULL;
int topKeywordCnt = 0;
+
static char ** gloKeywords = NULL;
int gloKeywordCnt = 0;
@@ -85,7 +77,8 @@
"PSEUDONYM");
if (pname == NULL)
return;
- pid = NULL; /* FIXME */
+ pid = getConfigurationString("GNUNET-INSERT",
+ "PREVHASH");
if (pid != NULL)
enc2hash(pid, &prevId);
tid = getConfigurationString("GNUNET-INSERT",
@@ -119,14 +112,14 @@
FREE(pname);
}
-
/**
* Print progess message.
*/
static void printstatus(int * verboselevel,
const FSUI_Event * event) {
unsigned long long delta;
-
+ char * fstring;
+
switch(event->type) {
case upload_progress:
if (*verboselevel == YES) {
@@ -149,16 +142,11 @@
? (double) (-1.0)
: (double) (event->data.UploadProgress.main_total / 1024.0 *
cronSECONDS / delta));
}
- if (testConfigurationString("GNUNET-INSERT",
- "PRINTURL",
- "YES")) {
- char * fstring;
- fstring = ECRS_uriToString(event->data.UploadComplete.uri);
- printf(_("File '%s' has URI: %s\n"),
- event->data.UploadComplete.filename,
- fstring);
- FREE(fstring);
- }
+ fstring = ECRS_uriToString(event->data.UploadComplete.uri);
+ printf(_("File '%s' has URI: %s\n"),
+ event->data.UploadComplete.filename,
+ fstring);
+ FREE(fstring);
if (0 == strcmp(event->data.DownloadProgress.main_filename,
event->data.DownloadProgress.filename)) {
postProcess(event->data.DownloadProgress.main_uri);
@@ -185,12 +173,11 @@
static void printhelp() {
static Help help[] = {
HELP_CONFIG,
- { 'D', "desc", gettext_noop("DESCRIPTION"),
- gettext_noop("set description for all files") },
- { 'E', "extract", NULL,
+ { 'C', "copy", NULL,
+ gettext_noop("even if gnunetd is running on the local machine, force the"
+ " creation of a copy instead of making a link to the GNUnet
share directory") },
+ { 'e', "extract", NULL,
gettext_noop("print list of extracted keywords that would be used, but
do not perform upload") },
- { 'f', "name", "NAME",
- gettext_noop("publish NAME as the name of the file or directory") },
HELP_HELP,
HELP_HOSTNAME,
{ 'i', "interval", "SECONDS",
@@ -202,22 +189,16 @@
{ 'K', "global-key", "KEYWORD",
gettext_noop("add an additional keyword for all files and directories"
" (this option can be specified multiple times)") },
- { 'l', "link", NULL,
- gettext_noop("if gnunetd is running on the local machine, create a"
- " link instead of making a copy in the GNUnet share
directory") },
HELP_LOGLEVEL,
- { 'm', "mime", "MIMETYPE",
- gettext_noop("set the mimetype for the file to be MIMETYPE") },
+ { 'm', "meta", "TYPE:VALUE",
+ gettext_noop("set the meta-data for the given TYPE to the given VALUE")
},
{ 'n', "noindex", NULL,
gettext_noop("do not index, perform full insertion (stores entire "
"file in encrypted form in GNUnet database)") },
{ 'N', "next", "ID",
gettext_noop("specify ID of an updated version to be published in the
future"
" (for namespace insertions only)") },
- { 'o', "out", "FILENAME",
- gettext_noop("write the created SBlock in plaintext to FILENAME"
- " (for namespace insertions only)") },
- { 'p', "prio", "PRIORITY",
+ { 'p', "priority", "PRIORITY",
gettext_noop("specify the priority of the content") },
{ 'P', "pseudonym", "NAME",
gettext_noop("publish the files under the pseudonym NAME (place file
into namespace)") },
@@ -231,10 +212,8 @@
" (for namespace insertions only)") },
{ 'T', "time", "TIME",
gettext_noop("specify creation time for SBlock (see man-page for
format)") },
- { 'u', "url", NULL,
- gettext_noop("print the GNUnet URL of the inserted file(s)") },
- { 'U', "update", "FILENAME",
- gettext_noop("filename of the SBlock of a previous version of the
content"
+ { 'u', "update", "ID",
+ gettext_noop("ID of the previous version of the content"
" (for namespace update only)") },
HELP_VERSION,
HELP_VERBOSE,
@@ -258,31 +237,27 @@
int option_index=0;
static struct GNoption long_options[] = {
LONG_DEFAULT_OPTIONS,
- { "desc", 1, 0, 'D' },
- { "name", 1, 0, 'f' },
- { "extract", 0, 0, 'E' },
+ { "copy", 0, 0, 'C' },
+ { "extract", 0, 0, 'e' },
{ "interval", 1, 0, 'i' },
{ "key", 1, 0, 'k' },
{ "global-key", 1, 0, 'K' },
- { "link", 0, 0, 'l' },
- { "mime", 1, 0, 'm' },
+ { "meta", 1, 0, 'm' },
{ "noindex", 0, 0, 'n' },
{ "next", 1, 0, 'N' },
- { "out", 1, 0, 'o' },
- { "prio", 1, 0, 'p' },
+ { "priority", 1, 0, 'p' },
{ "pseudonym", 1, 0, 'P' },
{ "recursive", 0, 0, 'R' },
{ "sporadic", 0, 0, 'S' },
{ "this", 1, 0, 't' },
{ "time", 1, 0, 'T' },
- { "url", 0, 0, 'u' },
- { "update", 1, 0, 'U' },
+ { "update", 1, 0, 'u' },
{ "verbose", 0, 0, 'V' },
{ 0,0,0,0 }
};
c = GNgetopt_long(argc,
argv,
- "c:dD:Ef:hH:i:lL:k:K:m:nN:o:p:Rs:St:T:uU:vV",
+ "c:CdehH:i:L:k:K:m:nN:p:P:RSt:T:u:vV",
long_options,
&option_index);
if (c == -1)
@@ -290,32 +265,14 @@
if (YES == parseDefaultOptions(c, GNoptarg))
continue;
switch(c) {
- case 'e':
- FREENONNULL(setConfigurationString("GNUNET-INSERT",
- "PREVIOUS_SBLOCK",
- GNoptarg));
+ case 'C':
+ FREENONNULL(setConfigurationString("FS",
+ "DISABLE-SYMLINKING",
+ "YES"));
break;
- case 'D':
- tmp = convertToUtf8(GNoptarg,
- strlen(GNoptarg),
- nl_langinfo(CODESET));
- ECRS_addToMetaData(meta,
- EXTRACTOR_DESCRIPTION,
- tmp);
- FREE(tmp);
- break;
- case 'E':
+ case 'e':
printAndReturn = YES;
break;
- case 'f':
- tmp = convertToUtf8(GNoptarg,
- strlen(GNoptarg),
- nl_langinfo(CODESET));
- ECRS_addToMetaData(meta,
- EXTRACTOR_FILENAME,
- tmp);
- FREE(tmp);
- break;
case 'h':
printhelp();
return SYSERR;
@@ -350,20 +307,41 @@
strlen(GNoptarg),
nl_langinfo(CODESET));
break;
- case 'l':
- FREENONNULL(setConfigurationString("GNUNET-INSERT",
- "LINK",
- "YES"));
- break;
- case 'm':
+ case 'm': {
+ EXTRACTOR_KeywordType type;
+ const char * typename;
+
tmp = convertToUtf8(GNoptarg,
strlen(GNoptarg),
nl_langinfo(CODESET));
- ECRS_addToMetaData(meta,
- EXTRACTOR_MIMETYPE,
- tmp);
- FREE(tmp);
+ type = EXTRACTOR_getHighestKeywordTypeNumber();
+ while (type > 0) {
+ type--;
+ typename = EXTRACTOR_getKeywordTypeAsString(type);
+ if (strlen(tmp) < strlen(typename)+1)
+ continue;
+ if ( (tmp[strlen(typename)] == ':') &&
+ (0 == strncmp(typename,
+ tmp,
+ strlen(typename))) ) {
+ ECRS_addToMetaData(meta,
+ type,
+ &tmp[strlen(typename)+1]);
+ FREE(tmp);
+ tmp = NULL;
+ break;
+ }
+ }
+ if (tmp != NULL) {
+ ECRS_addToMetaData(meta,
+ EXTRACTOR_UNKNOWN,
+ tmp);
+ FREE(tmp);
+ printf(("Unknown meta-data type in meta-data option '%s'. Using
unknown.\n"),
+ GNoptarg);
+ }
break;
+ }
case 'n':
FREENONNULL(setConfigurationString("GNUNET-INSERT",
"INDEX-CONTENT",
@@ -384,11 +362,6 @@
(char*)&enc));
break;
}
- case 'o':
- FREENONNULL(setConfigurationString("GNUNET-INSERT",
- "OUTPUT_SBLOCK",
- GNoptarg));
- break;
case 'p': {
unsigned int contentPriority;
@@ -400,8 +373,8 @@
"-p");
return SYSERR;
}
- setConfigurationInt("GNUNET-INSERT",
- "CONTENT-PRIORITY",
+ setConfigurationInt("FS",
+ "INSERT-PRIORITY",
contentPriority);
break;
}
@@ -440,11 +413,21 @@
"CREATION-TIME",
GNoptarg));
break;
- case 'u':
+ case 'u': {
+ EncName enc;
+ HashCode160 nextId;
+
+ if (enc2hash(GNoptarg,
+ &nextId) == SYSERR)
+ hash(GNoptarg,
+ strlen(GNoptarg),
+ &nextId);
+ hash2enc(&nextId, &enc);
FREENONNULL(setConfigurationString("GNUNET-INSERT",
- "PRINTURL",
- "YES"));
+ "PREVHASH",
+ (char*)&enc));
break;
+ }
case 'V':
FREENONNULL(setConfigurationString("GNUNET-INSERT",
"VERBOSE",
@@ -471,10 +454,8 @@
ex = getConfigurationString("GNUNET-INSERT",
"EXTRACTORS");
-#ifdef EXTRACTOR_DEFAULT_LIBRARIES
if (ex == NULL)
ex = STRDUP(EXTRACTOR_DEFAULT_LIBRARIES);
-#endif
if (ex == NULL)
l = NULL;
else
@@ -506,8 +487,6 @@
return OK;
}
-
-
/**
* The main function to insert files into GNUnet.
*
@@ -522,7 +501,6 @@
char * tmp;
int verbose;
char * timestr;
- char * prevname;
int doIndex;
int ret;
char * extractors;
@@ -563,42 +541,28 @@
}
FREE(timestr);
}
- prevname = getConfigurationString("GNUNET-INSERT",
- "PREVIOUS_SBLOCK");
- if (prevname != NULL) {
- /* FIXME: read SBlock & get options from the previous sblock */
-#if 0
- if (SYSERR == verifySBlock(&pb))
- errexit(_("Verification of SBlock in file '%s' failed\n"),
- prevname);
- /* check that it matches the selected pseudonym */
- if (OK != ECRS_testNamespaceExists(pname,
- &pb.subspace))
- errexit(_("The given SBlock does not belong to the namespace of the
selected pseudonym."));
- FREE(prevname);
- interval = ntohl(pb.updateInterval);
- if (interval == SBLOCK_UPDATE_NONE)
- errexit(_("Trying to update nonupdatable SBlock.\n"));
-#endif
- }
} else { /* ordinary insertion checks */
if (NULL != getConfigurationString("GNUNET-INSERT",
"NEXTHASH"))
errexit(_("Option '%s' makes no sense without option '%s'.\n"),
- "-N", "-s");
+ "-N", "-P");
if (NULL != getConfigurationString("GNUNET-INSERT",
+ "PREVHASH"))
+ errexit(_("Option '%s' makes no sense without option '%s'.\n"),
+ "-u", "-P");
+ if (NULL != getConfigurationString("GNUNET-INSERT",
"THISHASH"))
errexit(_("Option '%s' makes no sense without option '%s'.\n"),
- "-t", "-s");
+ "-t", "-P");
if (0 != getConfigurationInt("GNUNET-INSERT",
"INTERVAL"))
errexit(_("Option '%s' makes no sense without option '%s'.\n"),
- "-i", "-s");
+ "-i", "-P");
if (testConfigurationString("GNUNET-INSERT",
"SPORADIC",
"YES"))
errexit(_("Option '%s' makes no sense without option '%s'.\n"),
- "-S", "-s");
+ "-S", "-P");
}
exitSignal = SEMAPHORE_NEW(0);
@@ -619,10 +583,8 @@
doIndex = YES;
extractors = getConfigurationString("GNUNET-INSERT",
"EXTRACTORS");
-#ifdef EXTRACTOR_DEFAULT_LIBRARIES
if (extractors == NULL)
extractors = STRDUP(EXTRACTOR_DEFAULT_LIBRARIES);
-#endif
if (testConfigurationString("GNUNET-INSERT",
"RECURSIVE",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r140 - in GNUnet: contrib doc/man src/applications/fs/ecrs src/applications/fs/tools,
grothoff <=