-
Notifications
You must be signed in to change notification settings - Fork 1
/
macos-terminfo-setup.yaml
44 lines (36 loc) · 1.42 KB
/
macos-terminfo-setup.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
# The terminfo that comes with macOS is too old, and doesn't contain
# tmux-256color. So sshing to macOS from my Linux machine which uses
# tmux-256color results in a useless terminal. Same if using tmux locally on
# macOS. This playbook ensures that terminfo is available using newer ncurses
# installed from brew.
# Reference: https://unix.stackexchange.com/a/410383/8945
- name: macOS terminfo setup # noqa: name[casing]
hosts: macos
tasks:
- name: Ensure ~/.terminfo directory exists
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.terminfo"
state: directory
mode: "0755"
- name: Ensure ncurses is installed from brew
community.general.homebrew:
name: ncurses
state: latest
- name: Get ncurses installation location
ansible.builtin.command: brew --prefix ncurses
register: brew_prefix_ncurses
changed_when: false
- name: Create temporary file to store terminfo source
ansible.builtin.tempfile:
register: tempfile
- name: Decompile terminfo
ansible.builtin.shell: "{{ brew_prefix_ncurses.stdout }}/bin/infocmp tmux-256color > {{ tempfile.path }}"
changed_when: true
- name: Compile terminfo with system tic
ansible.builtin.command: tic -s {{ tempfile.path }}
changed_when: true
- name: Remove temporary file
ansible.builtin.file:
state: absent
path: "{{ tempfile.path }}"