Commit f25f31ac authored by frankiejol's avatar frankiejol Committed by Francesc Guasch
Browse files

refactor(install): lock while installing

parent 54f8d06b
......@@ -13,6 +13,7 @@ use Hash::Util qw(unlock_hash lock_hash);
use JSON::XS;
use Moose;
use POSIX qw(WNOHANG);
use Proc::PID::File;
use Time::HiRes qw(gettimeofday tv_interval);
use YAML;
use MIME::Base64;
......@@ -142,6 +143,16 @@ sub BUILD {
}
sub _install($self) {
my $pid = Proc::PID::File->new(name => "ravada_install");
if ( $pid->alive ) {
print "Waiting for install process to finish" if $ENV{TERM};
while ( $pid->alive ) {
sleep 1;
print "." if $ENV{TERM};
}
print "\n" if $ENV{TERM};
}
$pid->touch;
$self->_sql_create_tables();
$self->_create_tables();
$self->_upgrade_tables();
......@@ -150,6 +161,7 @@ sub _install($self) {
$self->_init_user_daemon();
$self->_sql_insert_defaults();
print "\n" if $FIRST_TIME_RUN;
$pid->release();
}
sub _init_user_daemon {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment