mirror of
				https://github.com/kewlfft/ansible-aur.git
				synced 2025-11-04 10:02:30 +03:00 
			
		
		
		
	add pikaur support
This commit is contained in:
		
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							@@ -2,17 +2,18 @@
 | 
			
		||||
Ansible module to use some AUR helpers as well as a simple internal implementation as a fallback. The following helpers are supported and automatically selected in the order they are listed:
 | 
			
		||||
- [pacaur](https://github.com/rmarquis/pacaur)
 | 
			
		||||
- [trizen](https://github.com/trizen/trizen)
 | 
			
		||||
- [pikaur](https://github.com/actionless/pikaur)
 | 
			
		||||
- [yaourt](https://github.com/archlinuxfr/yaourt)
 | 
			
		||||
- [yay](https://github.com/Jguer/yay)
 | 
			
		||||
- internal helper
 | 
			
		||||
 | 
			
		||||
## Options
 | 
			
		||||
|parameter      |required |default |choices                                      |comments|
 | 
			
		||||
|---            |---      |---     |---                                          |---|
 | 
			
		||||
|name           |no       |        |                                             |Name or list of names of the package(s) to install or upgrade.|
 | 
			
		||||
|upgrade        |no       |no      |yes, no                                      |Whether or not to upgrade whole system.|
 | 
			
		||||
|use            |no       |auto    |auto, pacaur, trizen, yaourt, yay, internal  |The helper to use, 'auto' uses the first known helper found, 'internal' uses the internal helper.|
 | 
			
		||||
|skip_installed |no       |no      |yes, no                                      |Skip operations if the package is present.|
 | 
			
		||||
|parameter      |required |default |choices                                              |comments|
 | 
			
		||||
|---            |---      |---     |---                                                  |---|
 | 
			
		||||
|name           |no       |        |                                                     |Name or list of names of the package(s) to install or upgrade.|
 | 
			
		||||
|upgrade        |no       |no      |yes, no                                              |Whether or not to upgrade whole system.|
 | 
			
		||||
|use            |no       |auto    |auto, pacaur, trizen, pikaur, yaourt, yay, internal  |The helper to use, 'auto' uses the first known helper found, 'internal' uses the internal helper.|
 | 
			
		||||
|skip_installed |no       |no      |yes, no                                              |Skip operations if the package is present.|
 | 
			
		||||
 | 
			
		||||
### Note
 | 
			
		||||
* Either *name* or *upgrade* is required, both cannot be used together.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								aur.py
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								aur.py
									
									
									
									
									
								
							@@ -8,12 +8,15 @@ import os
 | 
			
		||||
import os.path
 | 
			
		||||
import tempfile
 | 
			
		||||
 | 
			
		||||
def_lang = ['env', 'LC_ALL=C']
 | 
			
		||||
 | 
			
		||||
use_cmd = {
 | 
			
		||||
    'pacaur': ['env', 'LC_ALL=C', 'pacaur', '-S', '--noconfirm', '--noedit', '--needed', '--aur'],
 | 
			
		||||
    'trizen': ['env', 'LC_ALL=C', 'trizen', '-S', '--noconfirm', '--noedit', '--needed', '--aur'],
 | 
			
		||||
    'yaourt': ['env', 'LC_ALL=C', 'yaourt', '-S', '--noconfirm', '--needed'],
 | 
			
		||||
    'yay': ['env', 'LC_ALL=C', 'yay', '-S', '--noconfirm'],
 | 
			
		||||
    'internal': ['env', 'LC_ALL=C', 'makepkg', '--syncdeps', '--install', '--noconfirm', '--needed']
 | 
			
		||||
    'pacaur': ['pacaur', '-S', '--noconfirm', '--noedit', '--needed', '--aur'],
 | 
			
		||||
    'trizen': ['trizen', '-S', '--noconfirm', '--noedit', '--needed', '--aur'],
 | 
			
		||||
    'pikaur': ['pikaur', '-S', '--noconfirm', '--noedit', '--needed'],
 | 
			
		||||
    'yaourt': ['yaourt', '-S', '--noconfirm', '--needed'],
 | 
			
		||||
    'yay': ['yay', '-S', '--noconfirm'],
 | 
			
		||||
    'internal': ['makepkg', '--syncdeps', '--install', '--noconfirm', '--needed']
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -47,7 +50,7 @@ def install_internal(module, package):
 | 
			
		||||
def upgrade(module, use):
 | 
			
		||||
    assert use in use_cmd
 | 
			
		||||
 | 
			
		||||
    rc, out, err = module.run_command(use_cmd[use] + ['-u'], check_rc=True)
 | 
			
		||||
    rc, out, err = module.run_command(def_lang + use_cmd[use] + ['-u'], check_rc=True)
 | 
			
		||||
 | 
			
		||||
    module.exit_json(
 | 
			
		||||
        changed=not (out == '' or 'there is nothing to do' in out or 'No AUR updates found' in out),
 | 
			
		||||
@@ -69,7 +72,7 @@ def install_packages(module, packages, use, skip_installed):
 | 
			
		||||
        if use == 'internal':
 | 
			
		||||
            rc, out, err = install_internal(module, package)
 | 
			
		||||
        else:
 | 
			
		||||
            rc, out, err = module.run_command(use_cmd[use] + [package], check_rc=True)
 | 
			
		||||
            rc, out, err = module.run_command(def_lang + use_cmd[use] + [package], check_rc=True)
 | 
			
		||||
        changed_iter = changed_iter or not (out == '' or '-- skipping' in out or 'there is nothing to do' in out)
 | 
			
		||||
 | 
			
		||||
    module.exit_json(
 | 
			
		||||
@@ -92,7 +95,7 @@ def main():
 | 
			
		||||
            },
 | 
			
		||||
            'use': {
 | 
			
		||||
                'default': 'auto',
 | 
			
		||||
                'choices': ['auto', 'pacaur', 'trizen', 'yaourt', 'yay', 'internal'],
 | 
			
		||||
                'choices': ['auto', 'pacaur', 'trizen', 'pikaur', 'yaourt', 'yay', 'internal'],
 | 
			
		||||
            },
 | 
			
		||||
            'skip_installed': {
 | 
			
		||||
                'default': 'no',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user