| 1 | # | ||
| 2 | # $Id$ | ||
| 3 | # | ||
| 4 | # system::gphotofs Brik | ||
| 5 | # | ||
| 6 | package Metabrik::System::Gphotofs; | ||
| 7 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | ▶ | use base qw(Metabrik::Shell::Command Metabrik::System::Package); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | sub brik_properties { | ||
| 13 | return { | ||
| 14 | revision => '$Revision$', | ||
| 15 | tags => [ qw(unstable mtp mtpfs mount umount fs filesystem) ], | ||
| 16 | author => 'GomoR <GomoR[at]metabrik.org>', | ||
| 17 | license => 'http://opensource.org/licenses/BSD-3-Clause', | ||
| 18 | attributes => { | ||
| 19 | mount_point => [ qw(directory) ], | ||
| 20 | }, | ||
| 21 | attributes_default => { | ||
| 22 | }, | ||
| 23 | commands => { | ||
| 24 | install => [ ], # Inherited | ||
| 25 | mount => [ qw(mount_point|OPTIONAL) ], | ||
| 26 | umount => [ qw(mount_point|OPTIONAL) ], | ||
| 27 | }, | ||
| 28 | require_binaries => { | ||
| 29 | gphotofs => [ ], | ||
| 30 | fusermount => [ ], | ||
| 31 | }, | ||
| 32 | need_packages => { | ||
| 33 | ubuntu => [ qw(gphotofs fuse) ], | ||
| 34 | debian => [ qw(gphotofs fuse) ], | ||
| 35 | kali => [ qw(gphotofs fuse) ], | ||
| 36 | }, | ||
| 37 | }; | ||
| 38 | } | ||
| 39 | |||
| 40 | sub mount { | ||
| 41 | my $self = shift; | ||
| 42 | my ($mount_point) = @_; | ||
| 43 | |||
| 44 | $mount_point ||= $self->mount_point; | ||
| 45 | $self->brik_help_run_undef_arg('mount', $mount_point) or return; | ||
| 46 | $self->brik_help_run_directory_not_found('mount', $mount_point) or return; | ||
| 47 | |||
| 48 | my $cmd = 'gphotofs "'.$mount_point.'" -o allow_other'; | ||
| 49 | |||
| 50 | $self->use_sudo(1); | ||
| 51 | |||
| 52 | return $self->execute($cmd); | ||
| 53 | } | ||
| 54 | |||
| 55 | sub umount { | ||
| 56 | my $self = shift; | ||
| 57 | my ($mount_point) = @_; | ||
| 58 | |||
| 59 | $mount_point ||= $self->mount_point; | ||
| 60 | $self->brik_help_run_undef_arg('umount', $mount_point) or return; | ||
| 61 | $self->brik_help_run_directory_not_found('umount', $mount_point) or return; | ||
| 62 | |||
| 63 | my $cmd = 'fusermount -u "'.$mount_point.'"'; | ||
| 64 | |||
| 65 | $self->use_sudo(1); | ||
| 66 | |||
| 67 | return $self->execute($cmd); | ||
| 68 | } | ||
| 69 | |||
| 70 | 1; | ||
| 71 | |||
| 72 | __END__ | ||