Browse Source

Add Termux to Ansible (untested)

master
Geoffrey Frogeye 1 year ago
parent
commit
fb5a885e3c
Signed by: geoffrey GPG Key ID: C72403E7F82E6AD8
  1. 3
      config/automatrop/playbooks/default.yml
  2. 31
      config/automatrop/roles/desktop_environment/tasks/main.yml
  3. 36
      config/automatrop/roles/termux/tasks/main.yml
  4. 43
      config/scripts/install-termux

3
config/automatrop/playbooks/default.yml

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

31
config/automatrop/roles/desktop_environment/tasks/main.yml

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

36
config/automatrop/roles/termux/tasks/main.yml

@ -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

43
config/scripts/install-termux

@ -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
Loading…
Cancel
Save