Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #!/bin/perl -w
  2. use List::Util qw(first);
  3. my @KEYS=`ls /var/cache/apt/archives/`;
  4. foreach my $KEY(@KEYS)
  5. {
  6. $KEY=~s/_.*//p;
  7. my $verstr=$&;
  8. #print $verstr;
  9. $_=first{defined($_)}grep /$KEY/,`aptitude search $KEY`;
  10. print($_);
  11. if(m/^i/)
  12. {
  13. print("Package $KEY is installed.\n\r");
  14. }
  15.  
  16. if (m/^p/)
  17. {
  18. print("Package $KEY has no trace of the package exists on the system, it will be installed.\n\r" );
  19. }
  20. if (m/^c/)
  21. {
  22. print("Package $KEY was deleted but its configuration files remain on the system.\n\r" );
  23. }
  24. if (m/^v/)
  25. {
  26. print("Package $KEY is virtual\n\r" );
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement