summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2010-04-19 09:59:24 (GMT)
committerChristian Pointner <equinox@helsinki.at>2010-04-19 09:59:24 (GMT)
commitde92273e6de01bf9bada5cb89d72118943d23b51 (patch)
treea1cf4f52b80177c42883ea77fa109466da5c6fee
parentf6bfa62369e2761cb7d1d924227b67352a34cdcc (diff)
check for key file before import
git-svn-id: https://svn.helsinki.at/rhimport/trunk@52 7c65635b-ec39-4f67-a626-873dbafdd612
-rwxr-xr-xrhimport13
-rw-r--r--rhimport.pm8
2 files changed, 20 insertions, 1 deletions
diff --git a/rhimport b/rhimport
index 2e4729e..8670f12 100755
--- a/rhimport
+++ b/rhimport
@@ -220,6 +220,15 @@ sub start_import_gui()
exit 2;
}
+ if(!rhimport::check_key_file()) {
+ my $parent_window = $guixml->get_widget('appwin');
+ my $dialog = Gtk2::MessageDialog->new ($parent_window, 'destroy-with-parent',
+ 'error', 'ok', "Es wurde kein Import Key gefunden.");
+ $dialog->run;
+ $dialog->destroy;
+ return 0;
+ }
+
my $l_status = $guixml->get_widget('l_status');
my $filechooser = $guixml->get_widget('filechooser');
@@ -368,7 +377,9 @@ my $cl_error_cb = sub {
$x =~ /^n/i;
};
-(-e "$FILE") or die "file '$FILE' not found";
+rhimport::check_key_file() or die "Import Key not found, use rhimport-create-id to create one\n";
+
+(-e "$FILE") or die "file '$FILE' not found\n";
if($POOL) {
print "will import from playlist $FILE, with user $user\n\n";
} else {
diff --git a/rhimport.pm b/rhimport.pm
index 7bc36cc..df67f74 100644
--- a/rhimport.pm
+++ b/rhimport.pm
@@ -35,6 +35,14 @@ my $ssh_key_file = "$ENV{'HOME'}/.rhimport/import.key";
my $ssh_dir = "/programm/.rhimport";
my $rdimport_wrapper = "/usr/local/bin/dropbox_newfile.pl";
+sub check_key_file
+{
+ if(-e "$ssh_key_file") {
+ return 1;
+ }
+ return 0;
+}
+
sub get_dropboxes
{
my ($dbh, $user) = @_;