add symlink helper
- symlinking is done often enough that it makes sense to have a helper for it - move appimage and archive helpers to use symlink helper - fix formatting of air and alacritty
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
backup: false
|
||||
|
||||
- name: Link appimage to bin
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
src: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
|
||||
path: "{{ path_bin }}/{{ appimage.name }}"
|
||||
vars:
|
||||
links:
|
||||
- from: "{{ path_appimage }}/{{ appimage.name }}/{{ appimage.filename }}"
|
||||
to: "{{ path_bin }}/{{ appimage.name }}"
|
||||
ansible.builtin.include_tasks: helpers/symlink.yml
|
||||
|
||||
@@ -37,16 +37,9 @@
|
||||
exclude: "{{ archive.exclude | default(omit) }}"
|
||||
|
||||
- name: Symlink archive files
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
when:
|
||||
- archive.links is defined
|
||||
- archive.links | length > 0
|
||||
loop: "{{ archive.links }}"
|
||||
loop_control:
|
||||
loop_var: lnk
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
path: "{{ lnk.to }}"
|
||||
src: "{{ lnk.from }}"
|
||||
force: "{{ lnk.force | default(omit) }}"
|
||||
vars:
|
||||
links: "{{ archive.links }}"
|
||||
ansible.builtin.include_tasks: helpers/symlink.yml
|
||||
|
||||
20
tasks/helpers/symlink.yml
Normal file
20
tasks/helpers/symlink.yml
Normal file
@@ -0,0 +1,20 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
#
|
||||
## Helper: symlink.yml
|
||||
## Description: symlink source to target
|
||||
## Variables:
|
||||
## - from: the source of the symlink
|
||||
## - to: path of the symlink
|
||||
## - force: _optional_, force create the symlink
|
||||
---
|
||||
- name: Create symlinks
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
loop: "{{ links }}"
|
||||
loop_control:
|
||||
loop_var: link
|
||||
ansible.builtin.file:
|
||||
state: link
|
||||
path: "{{ link.to }}"
|
||||
src: "{{ link.from }}"
|
||||
force: "{{ link.force | default(omit) }}"
|
||||
@@ -17,7 +17,7 @@
|
||||
ansible.builtin.set_fact:
|
||||
air_install_method: "{{ install_method if install_method in air_install_methods else air_install_methods[0] }}"
|
||||
|
||||
- name: Configure air source install
|
||||
- name: Set air build facts
|
||||
when:
|
||||
- air_install_method == 'source'
|
||||
block:
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
# Helpers:
|
||||
# - cargo_build
|
||||
---
|
||||
# {{{ pre install configuration
|
||||
- name: Configure alacritty
|
||||
# {{{ Configure alacritty
|
||||
- name: Start alacritty configuration
|
||||
when:
|
||||
- "'alacritty' not in __configured"
|
||||
block:
|
||||
@@ -17,44 +17,45 @@
|
||||
when:
|
||||
- alacritty_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_install_method: "{% if default_install_method in alacritty_install_methods %}{{ default_install_method }}{% else %}{{ alacritty_install_methods[0] }}{% endif %}"
|
||||
alacritty_install_method: "{{ install_method if install_method in alacritty_install_methods else alacritty_install_methods[0] }}"
|
||||
|
||||
- name: Configure alacritty source install
|
||||
when:
|
||||
- alacritty_install_method == "source"
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps[ansible_os_family] }}"
|
||||
alacritty_src_install:
|
||||
build_flags: "{{ alacritty_cargo_build_flags }}"
|
||||
name: "{{ alacritty_pkgname }}"
|
||||
repo: "{{ alacritty_git_repo }}"
|
||||
version: "{{ alacritty_version }}"
|
||||
files:
|
||||
- from: target/release/alacritty
|
||||
to: bin/alacritty
|
||||
mode: '0755'
|
||||
- from: extra/logo/alacritty-term.svg
|
||||
to: share/pixmaps/Alacritty.svg
|
||||
- from: extra/linux/Alacritty.desktop
|
||||
to: share/applications/Alacritty.desktop
|
||||
|
||||
- name: Set alacritty install extra build deps
|
||||
when:
|
||||
- alacritty_install_method == "source"
|
||||
- ansible_os_family == "RedHat"
|
||||
- ansible_os_major_version < 9
|
||||
block:
|
||||
- name: Add extra dependencies for EL7
|
||||
when:
|
||||
- ansible_distribution_major_version == 7
|
||||
- name: Set alacritty build facts
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['xcb-util-devel', '@Development Tools'] }}"
|
||||
alacritty_build_deps: "{{ alacritty_build_deps[ansible_os_family] }}"
|
||||
alacritty_src_install:
|
||||
build_flags: "{{ alacritty_cargo_build_flags }}"
|
||||
name: "{{ alacritty_pkgname }}"
|
||||
repo: "{{ alacritty_git_repo }}"
|
||||
version: "{{ alacritty_version }}"
|
||||
files:
|
||||
- from: target/release/alacritty
|
||||
to: bin/alacritty
|
||||
mode: '0755'
|
||||
- from: extra/logo/alacritty-term.svg
|
||||
to: share/pixmaps/Alacritty.svg
|
||||
- from: extra/linux/Alacritty.desktop
|
||||
to: share/applications/Alacritty.desktop
|
||||
|
||||
- name: Add extra dependencies for EL8
|
||||
- name: Set alacritty install extra build deps
|
||||
when:
|
||||
- ansible_distribution_major_version == 8
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['@Development Tools'] }}"
|
||||
- ansible_os_family == "RedHat"
|
||||
- ansible_os_major_version < 9
|
||||
block:
|
||||
- name: Add extra dependencies for EL7
|
||||
when:
|
||||
- ansible_distribution_major_version == 7
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['xcb-util-devel', '@Development Tools'] }}"
|
||||
|
||||
- name: Add extra dependencies for EL8
|
||||
when:
|
||||
- ansible_distribution_major_version == 8
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['@Development Tools'] }}"
|
||||
|
||||
# }}}
|
||||
- name: Append alacritty installation
|
||||
@@ -69,9 +70,10 @@
|
||||
loop_var: alacritty_pkg_dep
|
||||
ansible.builtin.include_tasks: "{{ alacritty_pkg_dep }}"
|
||||
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + alacritty_build_deps }}"
|
||||
pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}"
|
||||
- name: Append build dependencies and cargo config
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + alacritty_build_deps }}"
|
||||
pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}"
|
||||
|
||||
- name: Append alacritty to pkg_sys
|
||||
when:
|
||||
@@ -80,6 +82,5 @@
|
||||
pkg_sys: "{{ pkg_sys + [alacritty_pkgname] }}"
|
||||
|
||||
- name: Complete alacritty configuration
|
||||
when: __alacritty_configured is undefined
|
||||
ansible.builtin.set_fact:
|
||||
__configured: "{{ __configured | combine( { 'alacritty': true } ) }}"
|
||||
|
||||
Reference in New Issue
Block a user