Commit 8cb13cbc authored by frankiejol's avatar frankiejol
Browse files

refactor(install): lock while installing

parent 6b073c1f
......@@ -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;
......@@ -139,6 +140,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();
......@@ -146,6 +157,7 @@ sub _install($self) {
$self->_update_data();
$self->_init_user_daemon();
$self->_sql_insert_defaults();
$pid->release();
}
sub _init_user_daemon {
......
Supports Markdown
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