Add Termux to Ansible (untested)

This commit is contained in:
Geoffrey Frogeye 2021-06-19 12:37:46 +02:00
parent 4e8681fad0
commit fb5a885e3c
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
4 changed files with 49 additions and 64 deletions

View file

@ -17,6 +17,9 @@
tags: tags:
- color - color
- desktop_environment - desktop_environment
- role: termux
tags: termux
when: termux
- role: desktop_environment - role: desktop_environment
tags: desktop_environment tags: desktop_environment
when: display_server when: display_server

View file

@ -40,7 +40,6 @@
- i3 - i3
- xresources - xresources
- rofi - rofi
- termux
- alacritty - alacritty
- shell - shell
- fzf - fzf
@ -56,7 +55,7 @@
template: template:
src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2" src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2"
dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml" dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
# Alacritty has live config reload, so no command to execute # Alacritty has live config reload, so no command to execute
# However, it doesn't work with yaml includes, hence the template # However, it doesn't work with yaml includes, hence the template
tags: tags:
@ -66,7 +65,7 @@
copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}"
dest: "{{ ansible_env.HOME }}/.config/Xresources/theme" dest: "{{ ansible_env.HOME }}/.config/Xresources/theme"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
notify: notify:
- xrdb-reload - xrdb-reload
tags: tags:
@ -77,7 +76,7 @@
copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}"
dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py" dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
notify: notify:
- qutebrowser-reload - qutebrowser-reload
tags: tags:
@ -88,7 +87,7 @@
content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}"
# url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css" # url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css" dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
when: False # Not currently used when: False # Not currently used
tags: tags:
- color - color
@ -97,7 +96,7 @@
template: template:
src: "{{ ansible_env.HOME }}/.config/i3/config.j2" src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
dest: "{{ ansible_env.HOME }}/.config/i3/config" dest: "{{ ansible_env.HOME }}/.config/i3/config"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
notify: notify:
- i3-reload - i3-reload
tags: tags:
@ -108,7 +107,7 @@
copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}" dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
with_items: with_items:
- rasi - rasi
- config - config
@ -119,7 +118,7 @@
template: template:
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2" src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc" dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
tags: tags:
- color - color
when: display_server == 'x11' when: display_server == 'x11'
@ -128,27 +127,17 @@
copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
notify: notify:
- fzf-reload - fzf-reload
tags: tags:
- color - color
- name: Download base16 theme for Termux
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"
dest: "{{ ansible_env.HOME }}/.termux/colors.properties"
mode: "u+rw,g=r,o=r"
tags:
- color
when: termux
# TODO Move to Termux role
- name: Download base16 theme for shell - name: Download base16 theme for shell
copy: copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}" content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply" dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
mode: "u+rwx,g=rx,o=rx" mode: "u=rwx,g=rx,o=rx"
notify: notify:
- shell-reload - shell-reload
when: False # Not currently used when: False # Not currently used
@ -158,7 +147,7 @@
- name: Set used base16 theme for vim - name: Set used base16 theme for vim
copy: copy:
path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim" path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim"
mode: "u+rw,g=r,o=r" mode: "u=rw,g=r,o=r"
content: "colorscheme base16-{{ base16_scheme }}" content: "colorscheme base16-{{ base16_scheme }}"
when: False # Not currently used when: False # Not currently used
tags: tags:

View file

@ -0,0 +1,36 @@
- name: Create Termux directory
file:
state: directory
path: "{{ ansible_user_dir }}/.termux"
mode: "u=rwx,g=rx,o=rx"
# TODO This is a dotfiles directory.
# Make it not install unless it's Termux
- name: Silence Termux login message
file:
state: file
path: "{{ ansible_user_dir }}/.hushlogin"
mode: "u=rw,g=r,o=r"
# Build a single color scheme and template and assign it to a variable
- base16_builder:
scheme: "{{ base16_scheme }}"
template: # This requires https://github.com/mnussbaum/base16-builder-ansible/pull/6
- termux
register: base16_schemes
tags:
- color
- name: Download base16 theme for Termux
copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"
dest: "{{ ansible_env.HOME }}/.termux/colors.properties"
mode: "u=rw,g=r,o=r"
tags:
- color
# TODO
# Upgrade
# If root:
# $ apt install tsu
# $ echo '/system/bin/mount -o remount,rw /; ln -s /data/data/com.termux/files/usr /usr; /system/bin/mount -o remount,ro /' | tsu

View file

@ -1,43 +0,0 @@
#!/data/data/com.termux/files/usr/bin/env bash
# Setups a Termux system the way I like it
if [ ! -d /data/data/com.termux/files ]; then
echo "This is not a Termux system (or pacman isn't installed)"
return 1
fi
# Configuration
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
if [ -z $ROOT ]; then
prompt "Is this device rooted and BusyBox installed in /system/bin/?"
ROOT=$?
fi
# Update
apt update
apt upgrade
# (needed for install-prefs)
apt install coreutils
apt install grep
# Used by some of my termux scripts
apt install jq
# Config
touch ~/.hushlogin
if [ $ROOT == 1 ]; then
apt install tsu
echo '/system/bin/mount -o remount,rw /; ln -s /data/data/com.termux/files/usr /usr; /system/bin/mount -o remount,ro /' | tsu
fi