mirror of
https://github.com/kewlfft/ansible-aur.git
synced 2025-09-17 08:30:39 +03:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
60c02a6652 | ||
![]() |
6f5df32b4b | ||
![]() |
93230880db | ||
![]() |
813cbadc18 | ||
![]() |
dc101ae394 | ||
![]() |
706b236058 | ||
![]() |
e8655fcf1c | ||
![]() |
d05e0bc979 | ||
![]() |
bff54cb367 | ||
![]() |
652b11fd76 | ||
![]() |
5d5cc1e20d | ||
![]() |
95aa8f3047 |
@@ -3,6 +3,7 @@ Ansible module to use some Arch User Repository (AUR) helpers as well as makepkg
|
||||
|
||||
The following helpers are supported and automatically selected, if present, in the order listed below:
|
||||
- [yay](https://github.com/Jguer/yay)
|
||||
- [paru](https://github.com/Morganamilo/paru)
|
||||
- [pacaur](https://github.com/E5ten/pacaur)
|
||||
- [trizen](https://github.com/trizen/trizen)
|
||||
- [pikaur](https://github.com/actionless/pikaur)
|
||||
@@ -17,7 +18,7 @@ The following helpers are supported and automatically selected, if present, in t
|
||||
|name | |Name or list of names of the package(s) to install or upgrade.|
|
||||
|state |**present**, latest |Desired state of the package, 'present' skips operations if the package is already installed.|
|
||||
|upgrade |yes, **no** |Whether or not to upgrade whole system.|
|
||||
|use |**auto**, yay, pacaur, trizen, pikaur, aurman, makepkg |The tool to use, 'auto' uses the first known helper found and makepkg as a fallback.|
|
||||
|use |**auto**, yay, paru, pacaur, trizen, pikaur, aurman, makepkg |The tool to use, 'auto' uses the first known helper found and makepkg as a fallback.|
|
||||
|extra_args |**null** |A list of additional arguments to pass directly to the tool. Cannot be used in 'auto' mode.|
|
||||
|aur_only |yes, **no** |Limit helper operation to the AUR.|
|
||||
|local_pkgbuild |Local directory with PKGBUILD, **null** |Only valid with makepkg or pikaur. Don't download the package from AUR. Build the package using a local PKGBUILD and the other build files.|
|
||||
@@ -80,6 +81,7 @@ This user can be created in an Ansible task with the following actions:
|
||||
```
|
||||
- user:
|
||||
name: aur_builder
|
||||
create_home: no
|
||||
group: wheel
|
||||
- lineinfile:
|
||||
path: /etc/sudoers.d/11-install-aur_builder
|
||||
|
@@ -43,7 +43,7 @@ options:
|
||||
description:
|
||||
- The tool to use, 'auto' uses the first known helper found and makepkg as a fallback.
|
||||
default: auto
|
||||
choices: [ auto, yay, pacaur, trizen, pikaur, aurman, makepkg ]
|
||||
choices: [ auto, yay, paru, pacaur, trizen, pikaur, aurman, makepkg ]
|
||||
|
||||
extra_args:
|
||||
description:
|
||||
@@ -90,7 +90,7 @@ RETURN = '''
|
||||
msg:
|
||||
description: action that has been taken
|
||||
helper:
|
||||
the helper that was actually used
|
||||
description: the helper that was actually used
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
@@ -100,10 +100,11 @@ EXAMPLES = '''
|
||||
become_user: aur_builder
|
||||
'''
|
||||
|
||||
def_lang = ['env', 'LC_ALL=C']
|
||||
def_lang = ['env', 'LC_ALL=C', 'LANGUAGE=C']
|
||||
|
||||
use_cmd = {
|
||||
'yay': ['yay', '-S', '--noconfirm', '--needed', '--cleanafter'],
|
||||
'paru': ['paru', '-S', '--noconfirm', '--needed', '--cleanafter'],
|
||||
'pacaur': ['pacaur', '-S', '--noconfirm', '--noedit', '--needed'],
|
||||
'trizen': ['trizen', '-S', '--noconfirm', '--noedit', '--needed'],
|
||||
'pikaur': ['pikaur', '-S', '--noconfirm', '--noedit', '--needed'],
|
||||
@@ -116,7 +117,7 @@ use_cmd_local_pkgbuild = {
|
||||
'makepkg': ['makepkg', '--syncdeps', '--install', '--noconfirm', '--needed']
|
||||
}
|
||||
|
||||
has_aur_option = ['yay', 'pacaur', 'trizen', 'pikaur', 'aurman']
|
||||
has_aur_option = ['yay', 'paru', 'pacaur', 'trizen', 'pikaur', 'aurman']
|
||||
|
||||
|
||||
def package_installed(module, package):
|
||||
@@ -243,7 +244,7 @@ def upgrade(module, use, extra_args, aur_only):
|
||||
rc, out, err = module.run_command(command, check_rc=True)
|
||||
|
||||
module.exit_json(
|
||||
changed=not (out == '' or 'nothing to do' in out or 'No AUR updates found' in out),
|
||||
changed=not (out == '' or 'nothing to do' in out.lower() or 'No AUR updates found' in out),
|
||||
msg='upgraded system',
|
||||
helper=use,
|
||||
)
|
||||
@@ -274,7 +275,7 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
|
||||
command.append(package)
|
||||
rc, out, err = module.run_command(command, check_rc=True)
|
||||
|
||||
changed_iter = changed_iter or not (out == '' or '-- skipping' in out or 'nothing to do' in out)
|
||||
changed_iter = changed_iter or not (out == '' or '-- skipping' in out or 'nothing to do' in out.lower())
|
||||
|
||||
message = 'installed package(s)' if changed_iter else 'package(s) already installed'
|
||||
|
||||
@@ -333,6 +334,9 @@ def make_module():
|
||||
|
||||
use = params['use']
|
||||
|
||||
if params['name'] == []:
|
||||
module.fail_json(msg="'name' cannot be empty.")
|
||||
|
||||
if use == 'auto':
|
||||
if params['extra_args'] is not None:
|
||||
module.fail_json(msg="'extra_args' cannot be used with 'auto', a tool must be specified.")
|
||||
|
Reference in New Issue
Block a user