27 KiB
CCE on Termux
- Build init
- Build Ansible
- Emacs as "user init"
- Sharing URLs to org-roam
- IMAP over SSH for Gnus
- Taks Map
- get
ansible -m setup
working with ssh to the termux - get
cce/cce.shell
working with ssh to the termux ascce/cce-termux.shell
- NEXT document sshd setup in termux
- write
cce/using-termux
predicate function - include
cce/using-termux
predicate exclusions for programming and whatnot - function to write termux
init.el
andmain.yml
- cce-as-init for termux processes
- INPROGRESS
intents
andtermux-tasker
integrations
- get
,#+ARROYO_EMACS_MODULE: termux ,#+ARROYO_MODULE_WANTS: cce/async_forever.org
The Cosmo Communicator has a fully functional keyboard, a decent one at that, and it runs Android in its most optimal configuration. Rather than try to shoehorn the entire CCE and an X11 session in to the thing, it runs enough of the CCE for Programming Lisp in Emacs and my org-roam stack. I use the new CCE Dynamic Loader and a (cce/using-termux)
predicate to toggle things off for this environment.
Here are the modules which are included:
Build init
The function cce/compile-termux
will spit out an init.el
, and when done with a prefix argument it'll install that in to init.elc
(defun cce/compile-termux (arg)
"When ARG is non-nil, byte-compile and install that to init.elc"
(interactive "P")
(let ((modules (cce/module-list))
(cce-dynamic-init (concat cce-directory "/termux.init.el"))
(building-for-termux t))
(cce/generate-dynamic-ansible modules)
(cce/generate-dynamic-init modules)
(when arg
(copy-file "~/org/cce/termux.init.el" "~/.emacs.d/init.el" t t))))
Build Ansible
The Termux also has its own CCE Ansible file:
- name: install cce on termux
hosts: termux
vars:
local_account: 'u0_a104'
needs_become_deescalate: no
roles:
- base
- endpoint
post_tasks:
- name: install init.el
copy:
src: ~/org/cce/termux.init.el
dest: ~/.emacs.d/init.el
tags:
- post
- emacs
- name: install init.elc
copy:
src: ~/org/cce/termux.init.elc
dest: ~/.emacs.d/init.elc
tags:
- post
- emacs
- name: install termux-url-opener
copy:
src: ~/org/cce/termux-url-opener
dest: ~/bin/termux-url-opener
mode: 0755
tags:
- termux
- name: jq install
shell:
cmd: "pkg install -y {{item}}"
creates: /data/data/com.termux/files/usr/bin/jq
loop:
- jq
- termux-api
tags:
- termux
test -f /usr/bin/dnf && sudo dnf install ansible python3-libselinux
test -f /usr/bin/apt && sudo apt install ansible
pushd $(dirname $0)
ansible-playbook -i inventory termux.yml $@
popd
Emacs as "user init"
i need Syncthing running on boot, but dont have systemd, so here we go:
(defun cce/start-syncthing ()
(interactive)
(cce/async-forever "syncthing" "*syncthing*"))
(add-hook 'after-cce-hook #'cce/start-syncthing)
Sharing URLs to org-roam
Intents and Hooks on the Termux wiki explains how file and URL sharing in to termux work.
~/bin/termux-file-editor
should probably attach the file to an org-journal entry; this may require some significant effort?
~/bin/termux-url-opener
doesn't ingest the title and other text, perhaps, which is frustrating?? maybe AutoShare will do better.
TITLE=$(termux-dialog -t "Enter Title" | jq -r '@uri "\(.text)"')
URI=$(echo '"'$1'"' | jq -r '@uri "\(.)"')
echo emacsclient -nqu "org-protocol://roam-ref?template=r&ref=$URI&title=$TITLE"
emacsclient -nqu "org-protocol://roam-ref?template=r&ref=$URI&title=$TITLE"
It's installed above because org strips the whitespace…
this shims termux-api
and org-protocol together.
I'd really like to be able to capture from Tasker, and eventually make voice notes that way on the go.
IMAP over SSH for Gnus
Termux doesn't include an IMAP daemon, so my offlineimap setup won't work. Instead, I will SSH directly to fontkeming and use, which means that I cannot read my mail/feeds while offline. Oh well.
ssh -q fontkeming.fail '/usr/libexec/dovecot/imap'
- name: imap tunnel installed
copy:
src: termux-imap-tunnel
dest: /data/data/com.termux/files/home/bin/imap
tags:
- termux
Taks Map
DONE
get ansible -m setup
working with ssh to the termux
- State "DONE" from "NEXT" [2020-06-25 Thu 15:55]
CLOCK: [2020-06-25 Thu 15:27]–[2020-06-25 Thu 15:55] => 0:28
pkg upgrade
pkg install -y python openssh rsync python-apt
this gets ansible working:
[WARNING]: Platform linux on host cosmo is using the discovered Python interpreter at /data/data/com.termux/files/usr/bin/python,
but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
cosmo | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [],
"ansible_all_ipv6_addresses": [],
"ansible_apparmor": {
"status": "disabled"
},
"ansible_architecture": "aarch64",
"ansible_date_time": {
"date": "2020-06-25",
"day": "25",
"epoch": "1593124720",
"hour": "15",
"iso8601": "2020-06-25T22:38:40Z",
"iso8601_basic": "20200625T153840911190",
"iso8601_basic_short": "20200625T153840",
"iso8601_micro": "2020-06-25T22:38:40.911442Z",
"minute": "38",
"month": "06",
"second": "40",
"time": "15:38:40",
"tz": "PDT",
"tz_offset": "-0700",
"weekday": "Thursday",
"weekday_number": "4",
"weeknumber": "25",
"year": "2020"
},
"ansible_default_ipv4": {
"address": "10.10.10.12",
"interface": "tun0"
},
"ansible_default_ipv6": {},
"ansible_distribution": "OtherLinux",
"ansible_distribution_major_version": "NA",
"ansible_distribution_release": "NA",
"ansible_distribution_version": "NA",
"ansible_dns": {},
"ansible_domain": "",
"ansible_effective_group_id": 10104,
"ansible_effective_user_id": 10104,
"ansible_env": {
"ANDROID_DATA": "/data",
"ANDROID_ROOT": "/system",
"BOOTCLASSPATH": "/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/bouncycastle.jar:/system/framework/apache-xml.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.hidl.base-V1.0-java.jar:/system/framework/android.hidl.manager-V1.0-java.jar:/system/framework/framework-oahl-backward-compatibility.jar:/system/framework/android.test.base.jar:/system/framework/mediatek-common.jar:/system/framework/mediatek-framework.jar:/system/framework/mediatek-telephony-common.jar:/system/framework/mediatek-telephony-base.jar:/system/framework/mediatek-ims-common.jar:/system/framework/mediatek-telecom-common.jar",
"EXTERNAL_STORAGE": "/sdcard",
"HOME": "/data/data/com.termux/files/home",
"LANG": "en_US.UTF-8",
"LD_PRELOAD": "/data/data/com.termux/files/usr/lib/libtermux-exec.so",
"LOGNAME": "u0_a104",
"PATH": "/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets",
"PREFIX": "/data/data/com.termux/files/usr",
"PWD": "/data/data/com.termux/files/home",
"SHELL": "/data/data/com.termux/files/usr/bin/bash",
"SHLVL": "0",
"SSH_AUTH_SOCK": "/data/data/com.termux/files/usr/tmp/ssh-jkJY1kghQh/agent.19439",
"SSH_CLIENT": "192.168.0.44 44058 8022",
"SSH_CONNECTION": "192.168.0.44 44058 192.168.0.90 8022",
"SSH_TTY": "/dev/pts/29",
"TERM": "dumb",
"TMPDIR": "/data/data/com.termux/files/usr/tmp",
"USER": "u0_a104",
"_": "/bin/sh"
},
"ansible_fibre_channel_wwn": [],
"ansible_fips": false,
"ansible_fqdn": "localhost",
"ansible_hostname": "localhost",
"ansible_hostnqn": "",
"ansible_interfaces": [],
"ansible_is_chroot": false,
"ansible_iscsi_iqn": "",
"ansible_kernel": "4.4.146",
"ansible_kernel_version": "#2 SMP PREEMPT Wed Jun 17 16:50:14 CST 2020",
"ansible_local": {},
"ansible_lsb": {},
"ansible_machine": "aarch64",
"ansible_nodename": "localhost",
"ansible_os_family": "OtherLinux",
"ansible_pkg_mgr": "unknown",
"ansible_python": {
"executable": "/data/data/com.termux/files/usr/bin/python",
"has_sslcontext": true,
"type": "cpython",
"version": {
"major": 3,
"micro": 3,
"minor": 8,
"releaselevel": "final",
"serial": 0
},
"version_info": [
3,
8,
3,
"final",
0
]
},
"ansible_python_version": "3.8.3",
"ansible_real_group_id": 10104,
"ansible_real_user_id": 10104,
"ansible_selinux": {
"status": "Missing selinux Python library"
},
"ansible_selinux_python_present": false,
"ansible_service_mgr": "service",
"ansible_system": "Linux",
"ansible_user_dir": "/data",
"ansible_user_gecos": null,
"ansible_user_gid": 10104,
"ansible_user_id": "u0_a104",
"ansible_user_shell": "/system/bin/sh",
"ansible_user_uid": 10104,
"ansible_userspace_bits": "64",
"ansible_virtualization_role": "NA",
"ansible_virtualization_type": "NA",
"discovered_interpreter_python": "/data/data/com.termux/files/usr/bin/python",
"gather_subset": [
"all"
],
"module_setup": true
},
"changed": false
}
So checking for "ANDROID_DATA" "/data"
in environment is probably the best check for runtime.
Have to edit ansible code to detect apt in termux here.
{'path': '/data/data/com.termux/files/usr/bin/apt', 'name': 'apt'}
This was a red-herring as python-apt isn't available in termux. package availability may be the limiting issue here.
DONE
get cce/cce.shell
working with ssh to the termux as cce/cce-termux.shell
- State "DONE" from "NEXT" [2020-06-25 Thu 17:05]
CLOCK: [2020-06-25 Thu 15:59]–[2020-06-25 Thu 17:05] => 1:06
NEXT document sshd setup in termux
DONE
write cce/using-termux
predicate function
- State "DONE" from "INPROGRESS" [2020-06-25 Thu 17:22]
- State "INPROGRESS" from "NEXT" [2020-06-25 Thu 17:22]
CLOCK: [2020-06-25 Thu 17:05]–[2020-06-25 Thu 17:22] => 0:17
This predicate function should be applied on things that I don't want installed, probably (not (cce/using-termux))
is added to each that I don't like.
DONE
include cce/using-termux
predicate exclusions for programming and whatnot
- State "DONE" from "NEXT" [2020-06-25 Thu 17:46]
CLOCK: [2020-06-25 Thu 17:22]–[2020-06-25 Thu 17:46] => 0:24
DONE
function to write termux init.el
and main.yml
- State "DONE" from "NEXT" [2020-06-25 Thu 21:58]
DONE cce-as-init for termux processes
- State "DONE" from "NEXT" [2020-06-26 Fri 16:04]
INPROGRESS intents
and termux-tasker
integrations
- State "INPROGRESS" from "DONE" [2020-07-09 Thu 16:45]
- State "DONE" from "NEXT" [2020-07-09 Thu 16:45]