fiddle with DB->new parameters
[id3fs.git] / sbin / id3fsd
1 #!/usr/bin/perl -w
2 # Ian Beckwith <ianb@erislabs.net>
3 #
4
5 use lib '/home/ianb/projects/id3fs/id3fs/lib';
6 use strict;
7 use Getopt::Long qw(Configure);
8 use ID3FS::DB;
9 use ID3FS::Fuse;
10 use vars qw($me);
11 $me=($0=~/(?:.*\/)?(.*)/)[0];
12
13 my $verbose=0;
14 my $help=0;
15 my $dbpath=undef;
16
17 Configure(qw(bundling no_ignore_case));
18 my $optret=GetOptions(
19     "verbose|v"  => \$verbose,
20     "quiet|q"    => sub { $verbose=0; },
21     "help|h"     => \$help,
22     "database|db=s"  => \$dbpath,
23     );
24
25 usage() if(scalar(@ARGV) != 2 || !$optret || $help);
26
27 my $source=shift;
28 my $mountpoint=shift;
29
30 my $db=ID3FS::DB->new($me, $dbpath, $source);
31 my $fuse=ID3FS::Fuse->new($db, $source, $mountpoint, $verbose);
32 $fuse->run();
33
34 sub usage
35 {
36     die("Usage: $me [-v] [-q] [-h] [--] file...\n".
37         " -v\tVerbose\n".
38         " -q\tQuiet (default)\n".
39         " -h\tThis help\n".
40         " --\tEnd of options\n");
41 }
42
43 __END__
44
45 =head1 NAME
46
47 program - description
48
49 =head1 SYNOPSIS
50
51 B<> [I<-v>] [I<-q>] [I<-h>] [I<file>...]
52
53 =head1 DESCRIPTION
54
55 =head1 OPTIONS
56
57 =over 4
58
59 =item B<-v>
60
61 Enable verbose operation.
62
63 =item B<-q>
64
65 Quiet (no output). This is the default.
66
67 =item B<-h>
68
69 Show a short help message.
70
71 =item B<-->
72
73 End of options.
74
75 =back
76
77 =head1 FILES
78
79 =head1 ENVIRONMENT
80
81 =head1 DIAGNOSTICS
82
83 =head1 BUGS
84
85 None known. Please report any found to ianb@erislabs.net
86
87 =head1 SEE ALSO
88
89 =head1 AUTHOR
90
91 Ian Beckwith <ianb@erislabs.net>
92
93 =head1 AVAILABILITY
94
95 The latest version can be found at:
96
97 B<http://erislabs.net/ianb/projects/id3fs/>
98
99 =head1 COPYRIGHT
100
101 Copyright 2010 Ian Beckwith <ianb@erislabs.net>
102
103 This program is free software: you can redistribute it and/or modify
104 it under the terms of the GNU General Public License as published by
105 the Free Software Foundation; either version 3 of the License, or
106 (at your option) any later version.
107
108 This program is distributed in the hope that it will be useful,
109 but WITHOUT ANY WARRANTY; without even the implied warranty of
110 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
111 GNU General Public License for more details.
112
113 You should have received a copy of the GNU General Public License
114 along with this program.  If not, see <http://www.gnu.org/licenses/>.
115
116 =cut