aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-11-13 19:46:25 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-11-13 19:46:25 +0000
commit5709e009a6ca69fa9cb8963aeb26cae7403afd3c (patch)
tree761dcf325bd3f8897fa98d6290de8792b4c67df2
parent3cfabf4880b79b1b53b43c04910b77218ff8b44b (diff)
downloadqarepo-5709e009a6ca69fa9cb8963aeb26cae7403afd3c.tar
qarepo-5709e009a6ca69fa9cb8963aeb26cae7403afd3c.tar.gz
qarepo-5709e009a6ca69fa9cb8963aeb26cae7403afd3c.tar.bz2
qarepo-5709e009a6ca69fa9cb8963aeb26cae7403afd3c.tar.xz
qarepo-5709e009a6ca69fa9cb8963aeb26cae7403afd3c.zip
Use polkit for authentication instead of sudo.
-rw-r--r--qarepo.pl13
1 files changed, 8 insertions, 5 deletions
diff --git a/qarepo.pl b/qarepo.pl
index 5ce5714..6444253 100644
--- a/qarepo.pl
+++ b/qarepo.pl
@@ -46,8 +46,8 @@ my $state;
my $home = $ENV{HOME} || './';
-# Only use sudo if not run by root.
-my $sudo = $> ? 'sudo' : '';
+# Only use pkexec if not run by root.
+my $pkexec = $> ? 'pkexec' : '';
my %config;
@@ -426,7 +426,8 @@ sub get_existing_rpms {
}
sub disable_repo {
- if (system("$sudo urpmi.removemedia '$qa_repo_name'") == 0) {
+ my $arch_type = $arch eq 'x86_64' ? '64' : '32';
+ if (system("$pkexec /usr/libexec/qarepo-helper disable $arch_type") == 0) {
$active_qa_repo = '';
} else {
my $message = "couldn't disable the $qa_repo_name media";
@@ -436,7 +437,8 @@ sub disable_repo {
}
sub enable_repo {
- if (system("$sudo urpmi.addmedia --update '$qa_repo_name' $qa_repo/$arch") == 0) {
+ my $arch_type = $arch eq 'x86_64' ? '64' : '32';
+ if (system("$pkexec /usr/libexec/qarepo-helper enable $arch_type $qa_repo/$arch") == 0) {
$active_qa_repo = $qa_repo;
} else {
my $message = "couldn't enable the $qa_repo_name media";
@@ -447,7 +449,8 @@ sub enable_repo {
}
sub update_repo {
- if (system("$sudo urpmi.update '$qa_repo_name'") != 0) {
+ my $arch_type = $arch eq 'x86_64' ? '64' : '32';
+ if (system("$pkexec /usr/libexec/qarepo-helper update $arch_type") != 0) {
my $message = "couldn't update the $qa_repo_name media";
show_error_dialogue($message);
print_error($message);