Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dag7dev committed Sep 24, 2023
0 parents commit c215156
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 0 deletions.
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Ansible role: DevkitPro
=========

An Ansible Role that installs Devkitpro and devkit tools on Debian/Ubuntu/Pop_Os!.

Requirements
------------

None.

Role Variables
--------------

Available variables are listed below, along with default values (see defaults/main.yml):

```
platforms_enabled:
- gp2x
# - gp32
# - gba
# - nds
# - 3ds
# - gamecube
# - wii
# - wiiu
# - switch
```
Depending on the devkit you'd like to install, add or remove lines containing your desired platforms without the suffix "-dev".

See [on the official doc](https://devkitpro.org/wiki/devkitPro_pacman#Using_Pacman) which platforms are supported.


Dependencies
------------

None.


Example Playbook
----------------

```
- hosts: all
vars_files:
- vars/main.yml
roles:
- { role: dag7dev.devkitpro }
```

Inside vars/main.yml:
```
platforms_enabled:
- gba
- nds
```


License
-------

MIT / BSD


Author Information
------------------

This role was created in 2023 by Damiano Gualandri, author of [awesome stuff](github.com/dag7dev).
12 changes: 12 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# defaults file for devkitpro-nds
platforms_enabled:
- gp2x
# - gp32
# - gba
# - nds
# - 3ds
# - gamecube
# - wii
# - wiiu
# - switch
2 changes: 2 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for devkitpro
27 changes: 27 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
galaxy_info:
author: dag7
company: "Dag7 Inc."
description: Devkitpro for Linux.
role_name: devkitpro
license: license (BSD, MIT)

min_ansible_version: 2.10
platforms:
- name: Amazon
versions:
- all
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- bionic
- jammy


galaxy_tags:
- devkit
- homebrew
- console

allow_duplicates: true
67 changes: 67 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# tasks file for devkitpro
- name: Install ca-certificates
apt:
update_cache: yes
state: latest
name:
- "ca-certificates"

- name: Check if pip3 command exists
command: "which pip3"
register: pip3_command_check
ignore_errors: true

- name: Install pip
apt:
name:
- python3-pip
when: pip3_command_check.rc != 0

- name: Install pexpect
pip:
name: pexpect

- name: Print devkit platforms enabled
ansible.builtin.debug:
msg: Platforms enabled {{ platforms_enabled }}

- name: Check if dkp-pacman command exists
command: "which dkp-pacman"
register: command_check
ignore_errors: true

- name: Create /tmp directory
file:
path: /tmp
state: directory
when: command_check.rc != 0

- name: Get installation script
get_url:
url: https://apt.devkitpro.org/install-devkitpro-pacman
dest: /tmp/install-devkitpro-pacman
mode: '+x'
when: command_check.rc != 0

- name: Install devkitpro-pacman
shell: yes | /tmp/install-devkitpro-pacman
when: command_check.rc != 0

- name: Check if dkp-pacman command exists
command: "which dkp-pacman"
register: command_check
ignore_errors: true

- name: Update dkp-pacman packages
shell: yes |
when: command_check.rc == 0

- name: Install specified platform devkit {{ item }}
expect:
command: dkp-pacman -S --noconfirm {{ item }}-dev
responses:
".*default*": "all\r"
".*[Y/n].*": "Y\r"
loop: "{{ platforms_enabled }}"
when: command_check.rc == 0
2 changes: 2 additions & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- devkitpro
2 changes: 2 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# vars file for devkitpro

0 comments on commit c215156

Please sign in to comment.