New way to install packages!
Probably the fourth I ever created? Will this one last? I don't know! Doesn't have pip support for now, but probably something requirements.txt based will be a bit more proper
This commit is contained in:
parent
ccc330d795
commit
59aaf63d4a
16
config/automatrop/roles/software/handlers/main.yml
Normal file
16
config/automatrop/roles/software/handlers/main.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
- name: Create and install meta package for Arch Linux
|
||||||
|
block:
|
||||||
|
- name: Generate meta package PKGBUILD
|
||||||
|
template:
|
||||||
|
src: PKGBUILD.j2
|
||||||
|
dest: "{{ ansible_user_dir }}/.cache/automatrop/PKGBUILD"
|
||||||
|
listen: "software changed"
|
||||||
|
|
||||||
|
- name: Install meta package
|
||||||
|
aur:
|
||||||
|
name: "automatrop-packages-{{ inventory_hostname_short }}"
|
||||||
|
local_pkgbuild: "{{ ansible_user_dir }}/.cache/automatrop"
|
||||||
|
use: makepkg
|
||||||
|
state: latest
|
||||||
|
listen: "software changed"
|
||||||
|
when: arch_based
|
|
@ -1,55 +0,0 @@
|
||||||
- name: Install base shell packages (Pacman)
|
|
||||||
pacman:
|
|
||||||
name:
|
|
||||||
- base
|
|
||||||
- coreutils
|
|
||||||
- bash
|
|
||||||
- grep
|
|
||||||
- sed
|
|
||||||
- tar
|
|
||||||
- openssl # Used for machines script
|
|
||||||
when: arch
|
|
||||||
|
|
||||||
- name: Install base shell packages (Apt)
|
|
||||||
apt:
|
|
||||||
name:
|
|
||||||
- coreutils
|
|
||||||
- bash
|
|
||||||
- grep
|
|
||||||
- sed
|
|
||||||
- tar
|
|
||||||
- openssl
|
|
||||||
when: apt
|
|
||||||
|
|
||||||
- name: Install extended shell packages (Pacman)
|
|
||||||
pacman:
|
|
||||||
name:
|
|
||||||
- moreutils
|
|
||||||
- tmux
|
|
||||||
- bash-completion
|
|
||||||
- fzf
|
|
||||||
- highlight
|
|
||||||
- powerline-go-bin
|
|
||||||
when: arch
|
|
||||||
|
|
||||||
- name: Install extended shell packages (Debian)
|
|
||||||
pacman:
|
|
||||||
name:
|
|
||||||
- moreutils
|
|
||||||
- tmux
|
|
||||||
- bash-completion
|
|
||||||
- fzf
|
|
||||||
- highlight
|
|
||||||
- powerline-go
|
|
||||||
when: debian
|
|
||||||
|
|
||||||
- name: Install extended shell packages (Termux)
|
|
||||||
pacman:
|
|
||||||
name:
|
|
||||||
- moreutils
|
|
||||||
- tmux
|
|
||||||
- bash-completion
|
|
||||||
- fzf
|
|
||||||
# - highlight
|
|
||||||
# - powerline-go
|
|
||||||
when: termux
|
|
|
@ -1,16 +1,24 @@
|
||||||
- name: Set variables
|
- name: Set variables
|
||||||
set_fact:
|
set_fact:
|
||||||
arch: "{{ ansible_distribution == 'Archlinux' }}"
|
arch_based: "{{ ansible_distribution == 'Archlinux' }}"
|
||||||
|
arch: "{{ ansible_lsb.id == 'Arch' }}"
|
||||||
|
manjaro: "{{ ansible_lsb.id == 'Manjaro' or ansible_lsb.id == 'Manjaro-ARM' }}"
|
||||||
termux: "{{ ansible_distribution == 'OtherLinux' and ansible_python.executable == '/data/data/com.termux/files/usr/bin/python' }}"
|
termux: "{{ ansible_distribution == 'OtherLinux' and ansible_python.executable == '/data/data/com.termux/files/usr/bin/python' }}"
|
||||||
debian: "{{ ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' }}"
|
debian_based: "{{ ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' }}"
|
||||||
|
debian: "{{ ansible_distribution == 'Debian' }}"
|
||||||
|
ubuntu: "{{ ansible_distribution == 'Ubuntu' }}"
|
||||||
|
tags: softwarelist
|
||||||
|
|
||||||
|
# TODO Is this used?
|
||||||
- name: Set secondary variables
|
- name: Set secondary variables
|
||||||
set_fact:
|
set_fact:
|
||||||
pacman: "{{ arch }}"
|
pacman: "{{ arch_based }}"
|
||||||
apt: "{{ termux or debian }}"
|
apt: "{{ termux or debian }}"
|
||||||
sudo: "{{ not termux }}"
|
sudo: "{{ not termux }}"
|
||||||
|
|
||||||
# TODO Install python if not done
|
# TODO Install python if not done
|
||||||
|
# Or maybe not, it requires a lot of automation for something that can be done
|
||||||
|
# very quickly manually and is usually uneccessary
|
||||||
|
|
||||||
- name: Install python-apt dependency for Termux
|
- name: Install python-apt dependency for Termux
|
||||||
block:
|
block:
|
||||||
|
@ -67,30 +75,52 @@
|
||||||
# You should consider upgrading via the '/data/data/com.termux/files/usr/bin/python3 -m pip install --upgrade pip' command.
|
# You should consider upgrading via the '/data/data/com.termux/files/usr/bin/python3 -m pip install --upgrade pip' command.
|
||||||
|
|
||||||
# Install alternative package managers
|
# Install alternative package managers
|
||||||
- name: Install AUR package manager
|
- name: Install dependencies for AUR helpers
|
||||||
|
pacman:
|
||||||
|
name:
|
||||||
|
- fakeroot
|
||||||
|
- base-devel
|
||||||
|
when: arch_based
|
||||||
|
become: "{{ sudo }}"
|
||||||
|
|
||||||
|
- name: Install AUR package manager (Arch)
|
||||||
aur:
|
aur:
|
||||||
name: yay-bin
|
name: yay-bin
|
||||||
when: arch
|
when: arch
|
||||||
|
|
||||||
- name: Install python pip (Pacman)
|
- name: Install AUR package manager (Manjaro)
|
||||||
pacman:
|
pacman:
|
||||||
name: python-pip
|
name: yay
|
||||||
when: arch
|
when: manjaro
|
||||||
become: "{{ sudo }}"
|
# Not sure if regular Manjaro has yay in its community packages,
|
||||||
become_user: root
|
# but Manjaro-ARM sure does
|
||||||
|
|
||||||
- name: Install python pip (Debian)
|
- name: Create cache folder
|
||||||
apt:
|
file:
|
||||||
name: python3-pip
|
state: directory
|
||||||
when: debian
|
mode: "u=rwx,g=rx,o=rx"
|
||||||
become: "{{ sudo }}"
|
path: "{{ ansible_user_dir }}/.cache/automatrop"
|
||||||
become_user: root
|
|
||||||
|
|
||||||
# Termux: pip is included with Python
|
- name: Generate list of packages for package manager
|
||||||
|
set_fact:
|
||||||
|
packages: "{{ query('template', 'package_manager.j2')[0].split('\n')[:-1]|sort }}"
|
||||||
|
tags: softwarelist
|
||||||
|
|
||||||
|
- name: Install packages (Arch-based)
|
||||||
|
aur:
|
||||||
|
name: "{{ packages }}"
|
||||||
|
extra_args: "--asdeps"
|
||||||
|
# Nothing is set as installed manually so it can
|
||||||
|
# be removed by dependency check.
|
||||||
|
# Current packages will be kept by the meta package
|
||||||
|
use: yay
|
||||||
|
when: arch_based
|
||||||
|
tags: softwarelist
|
||||||
|
|
||||||
|
- name: Check if list of packages changed
|
||||||
|
copy:
|
||||||
|
content: "{% for package in packages %}{{ package }}\n{% endfor %}"
|
||||||
|
dest: "{{ ansible_user_dir }}/.cache/automatrop/package_manager"
|
||||||
|
notify: "software changed"
|
||||||
|
tags: softwarelist
|
||||||
|
|
||||||
- name: Install base packages
|
|
||||||
include_tasks:
|
|
||||||
file: base.yml
|
|
||||||
apply:
|
|
||||||
become: "{{ sudo }}"
|
|
||||||
become_user: root
|
|
||||||
|
|
14
config/automatrop/roles/software/templates/PKGBUILD.j2
Normal file
14
config/automatrop/roles/software/templates/PKGBUILD.j2
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Maintainer: Geoffrey Frogeye
|
||||||
|
|
||||||
|
pkgname=automatrop-packages-{{ inventory_hostname_short }}
|
||||||
|
pkgver={{ ansible_date_time.iso8601_basic_short }}
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc='Metapackage for packages wanted by Geoffrey via automatrop for {{ inventory_hostname }}'
|
||||||
|
url='https://git.frogeye.fr/geoffrey/dotfiles/src/branch/master/config/automatrop'
|
||||||
|
arch=('any')
|
||||||
|
license=('GPL')
|
||||||
|
depends=(
|
||||||
|
{% for package in packages %}
|
||||||
|
'{{ package }}'
|
||||||
|
{% endfor %}
|
||||||
|
)
|
|
@ -0,0 +1,26 @@
|
||||||
|
{# Base shell packages #}
|
||||||
|
coreutils
|
||||||
|
bash
|
||||||
|
grep
|
||||||
|
sed
|
||||||
|
tar
|
||||||
|
openssl
|
||||||
|
{% if debian_based %}
|
||||||
|
python3-pip
|
||||||
|
{% elsif termux %}
|
||||||
|
python
|
||||||
|
{% else %}
|
||||||
|
python-pip
|
||||||
|
{% endif %}
|
||||||
|
{# Extended shell packages #}
|
||||||
|
moreutils
|
||||||
|
tmux
|
||||||
|
bash-completion
|
||||||
|
fzf
|
||||||
|
highlight
|
||||||
|
{% if arch_based %}
|
||||||
|
powerline-go-bin
|
||||||
|
{% else %}
|
||||||
|
powerline-go
|
||||||
|
{% endif %}
|
||||||
|
zsh
|
Loading…
Reference in a new issue