Skip to content

Commit

Permalink
Port root authentication from AppImage/AppImageKit#364
Browse files Browse the repository at this point in the history
Thanks @abhay44
  • Loading branch information
probonopd committed Mar 8, 2017
1 parent b465227 commit 1ffe5aa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ static HeaderBar header_bar; // Too new to assume it is there?

static string selected_file;

static string root(){

var a = Posix.system("pkexec --disable-internal-agent echo hello to appimages");
if (a == 32256){
return "false";
}
else{
return "true";
}

}
static void root_run(){
if(root() == "false"){
Posix.exit(0);
}
}

/* Open file */
static void open_file(string filename) {
selected_file = filename;
Expand Down Expand Up @@ -46,6 +63,7 @@ static void on_about_clicked() {
}

static void main (string[] args) {
root_run();
init (ref args);
if(args.length > 1){
open_file(args[1]);
Expand Down

0 comments on commit 1ffe5aa

Please sign in to comment.