summaryrefslogtreecommitdiffstats
path: root/draklive-install.wrapper
blob: b4da951b88a59a4efb9d89f2c3e22598e52e1a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/perl
use Net::DBus;

if ($>) {
    if (system('ps -C xscreensaver') == 0) {
        # xscreensaver doesn't implement the freedesktop API, so we just have to kill it.
        # We expect the user to reboot after the install completes, so don't bother to
        # reenable it.
        system('xscreensaver-command -exit');
    } else {
        # If the ScreenSaver service isn't implemented, an exception will be thrown.
        eval {
            my $bus = Net::DBus->session;
            my $service = $bus->get_service('org.freedesktop.ScreenSaver');
            my $manager = $service->get_object('/ScreenSaver', 'org.freedesktop.ScreenSaver');
            my $cookie  = $manager->Inhibit('draklive-install', 'Install in progress');
            # The screensaver will be automatically uninhibited when this process exits.
        }
    }
    my $status = system("/usr/bin/pkexec /usr/sbin/draklive-install-lock-storage @ARGV");
    exit($status);
}
exec("/usr/sbin/draklive-install-lock-storage @ARGV");