Last active
December 21, 2015 08:49
-
-
Save 0mark/6281084 to your computer and use it in GitHub Desktop.
Pacman thing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
if (not -e "pkglist") { | |
exec("pacman -Qqet > pkglist"); | |
} | |
my $param=shift(); | |
my @keep=split(/\n/,`cat pkglist | grep -v '^#'`); | |
my @try=split(/\n/,`pacman -Qqet`); | |
my $out=""; | |
foreach (@try) { | |
my $in=1; | |
my $x=$_; | |
$in=grep($x eq $_, @keep); | |
$out.=$_." " if ($in==0); | |
} | |
if ($param eq "new") { | |
open (FILE, '>>pkglist'); | |
$out =~ s/ /\n/g; | |
print FILE "---- NEW ----\n$out"; | |
close (FILE); | |
} elsif ($param eq "do") { | |
system("sudo pacman -Rns $out"); | |
exec('sudo pacman -Rsn $(pacman -Qdtq)'); | |
} else { | |
print "$out\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment