davidfindley19

Aptitude Search and Install

Jul 24th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #We need verification that user is running this script as root.
  2. if [ "$USER" != "root" ]; then
  3. echo "You are attempting to execute this process as user $USER"
  4. echo "Please execute the script with elevated permissions."
  5. exit 1
  6. fi
  7.  
  8. #To ensure that all package lists are up to date. This is set to update the packages silenty unless there
  9. #are any errors.
  10. apt-get -qq -y update
  11.  
  12. #The script will now perform an aptitude search for the package(s) and install if not found.
  13. if (aptitude search '!~i chrpath'); then
  14. apt-get install chrpath
  15. if (aptitude search '~i chrpath'); then
  16. echo "CHRPATH INSTALLED CORRECTLY"
  17. else
  18. echo "CHRPATH DID NOT INSTALL CORRECTLY"
  19. fi
  20. else echo "chrpath is already installed"
  21. fi
Advertisement
Add Comment
Please, Sign In to add comment