summaryrefslogtreecommitdiffstats
path: root/draklive-install.wrapper
blob: 1da9f0e6ddbba9a1f68db10a694b4b2174b0fde6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/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 {
        my $bus = Net::DBus->session;
        my $service = $bus && $bus->get_service('org.freedesktop.ScreenSaver');
        my $manager = $service && $service->get_object('/ScreenSaver', 'org.freedesktop.ScreenSaver');
        my $cookie  = $manager && $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");