fix: add apt.is_installed() function
				
					
				
			This commit is contained in:
		
							parent
							
								
									8bddce1329
								
							
						
					
					
						commit
						47ec0c67ca
					
				
					 1 changed files with 14 additions and 1 deletions
				
			
		|  | @ -2,7 +2,7 @@ | ||||||
| ################################################################################ | ################################################################################ | ||||||
| # | # | ||||||
| #  Rattail -- Retail Software Framework | #  Rattail -- Retail Software Framework | ||||||
| #  Copyright © 2010-2018 Lance Edgar | #  Copyright © 2010-2025 Lance Edgar | ||||||
| # | # | ||||||
| #  This file is part of Rattail. | #  This file is part of Rattail. | ||||||
| # | # | ||||||
|  | @ -44,6 +44,19 @@ def install(c, *packages, **kwargs): | ||||||
|         frontend, target, force_yes, ' '.join(packages)), **kwargs) |         frontend, target, force_yes, ' '.join(packages)), **kwargs) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def is_installed(c, package): | ||||||
|  |     """ | ||||||
|  |     Check if the given APT package is installed. | ||||||
|  | 
 | ||||||
|  |     :param c: Fabric connection. | ||||||
|  | 
 | ||||||
|  |     :param package: Name of package to be checked. | ||||||
|  | 
 | ||||||
|  |     :returns: ``True`` if package is installed, else ``False``. | ||||||
|  |     """ | ||||||
|  |     return c.run(f"dpkg-query -s {package}", warn=True).ok | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def purge(c, *packages): | def purge(c, *packages): | ||||||
|     """ |     """ | ||||||
|     Uninstall and purge config for given packages |     Uninstall and purge config for given packages | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue