Just dropping in here for a small little bit of cool stuff.
The steps for this are quite easy:
Install Termux
pkg install openssh
ssh-keygen
cp -R .ssh /sdcard
You can grab your pubkey and privkey now in case you need it. In addition, copy your own pubkey here.
cat /sdcard/your_key >> .ssh/authorized_keys
sshd
You can now SSH into your phone. Use id to pick the right username, then do: ssh <user>@<ip> -p 8022 - this should make things MUCH easier from here on out!
pkg install ndk-sysroot clang binutils-is-llvm make git
u0_a223@localhost ~> ll $PREFIX/bin/dinit*
-rwxr-xr-x 1 u0_a223 u0_a223 209K Jan 14 03:16 /data/data/com.termux/files/usr/bin/dinit
-rwxr-xr-x 1 u0_a223 u0_a223 27K Jan 14 03:16 /data/data/com.termux/files/usr/bin/dinit-monitor
-rwxr-xr-x 1 u0_a223 u0_a223 113K Jan 14 03:16 /data/data/com.termux/files/usr/bin/dinitcheck
-rwxr-xr-x 1 u0_a223 u0_a223 82K Jan 14 03:16 /data/data/com.termux/files/usr/bin/dinitctl
Next, you can install the "Termux:Boot" plugin. As per the instructions, create a .termux/boot folder. Here is a snippet of what I did:
u0_a223@localhost ~> cd .termux
u0_a223@localhost ~/.termux> mkdir boot
u0_a223@localhost ~/.termux> ls
boot shell termux.properties
u0_a223@localhost ~/.termux> cd boot
u0_a223@localhost ~/.t/boot> ls
u0_a223@localhost ~/.t/boot> ll /bin/sh
-rwxr-xr-x 1 root shell 321K Jan 1 2009 /bin/sh
u0_a223@localhost ~/.t/boot> nano 00-dinit
u0_a223@localhost ~/.t/boot> termux-fix-shebang ./00-dinit
u0_a223@localhost ~/.t/boot> cat 00-dinit
#!/data/data/com.termux/files/usr/bin/sh
# I couldn't find a way to preconfigure this...
dinit -d $PREFIX/etc/dinit.d
(I also temporarily added 01-sshd just in case, I plan to move that to a dinit unit.)
Here is the configure generated mconfig:
## Auto-generated by "./configure" for "Linux"
# All changes will be lost if "./configure" is re-run.
# See BUILD for help on all variables.
# Installation path options.
SBINDIR=/data/data/com.termux/files/usr/bin
MANDIR=/data/data/com.termux/files/usr/share/man
SYSCONTROLSOCKET=/data/data/com.termux/files/usr/var/run/dinitctl
# General build options.
CXX=g++
CXXFLAGS=-std=c++11 -Wall -Os -fno-plt -fno-rtti -flto
CXXFLAGS_EXTRA=
TEST_CXXFLAGS=$(CXXFLAGS) -fsanitize=address,undefined
TEST_CXXFLAGS_EXTRA=
CPPFLAGS=
LDFLAGS_BASE=
LDFLAGS=$(LDFLAGS_BASE) $(CXXFLAGS)
LDFLAGS_EXTRA=
TEST_LDFLAGS_BASE=$(LDFLAGS_BASE)
TEST_LDFLAGS=$(TEST_LDFLAGS_BASE) $(TEST_CXXFLAGS)
TEST_LDFLAGS_EXTRA=
BUILD_SHUTDOWN=no
STRIPOPTS=-s
# Feature settings
SUPPORT_CGROUPS=0
USE_INITGROUPS=1
# Optional settings
SHUTDOWN_PREFIX=
# Service defaults
DEFAULT_AUTO_RESTART=true
DEFAULT_START_TIMEOUT=60
DEFAULT_STOP_TIMEOUT=10
Now... why? Well, why not. o.o That's literally the only reason why. I have deployed dinit in docker containers and as a user-space init system a few times now - the service syntax is ultra simple and quick to produce and dinitctl list is easy and fast to read. I even tried to compile it for my TV through the OpenLGTV compiler to handle auto-mounting the inserted USB drive and starting Syncthing to transfer emulator saves. So yeah - I do it, because I can. :)
That's all! Have a nice day and thanks for this awesome init system!
Hello!
Just dropping in here for a small little bit of cool stuff.
The steps for this are quite easy:
pkg install openssh
ssh-keygen
cp -R .ssh /sdcard
cat /sdcard/your_key >> .ssh/authorized_keys
sshd
id
to pick the right username, then do:ssh <user>@<ip> -p 8022
- this should make things MUCH easier from here on out!pkg install ndk-sysroot clang binutils-is-llvm make git
./configure --prefix=$PREFIX --syscontrolsocket=$PREFIX/var/run/dinitctl --sbindir=$PREFIX/bin --disable-cgroups --disable-shutdown
make -j(nproc)
make install
After that, you should have:
Next, you can install the "Termux:Boot" plugin. As per the instructions, create a
.termux/boot
folder. Here is a snippet of what I did:(I also temporarily added 01-sshd just in case, I plan to move that to a dinit unit.)
Here is the configure generated mconfig:
Now... why? Well, why not. o.o That's literally the only reason why. I have deployed dinit in docker containers and as a user-space init system a few times now - the service syntax is ultra simple and quick to produce and
dinitctl list
is easy and fast to read. I even tried to compile it for my TV through the OpenLGTV compiler to handle auto-mounting the inserted USB drive and starting Syncthing to transfer emulator saves. So yeah - I do it, because I can. :)That's all! Have a nice day and thanks for this awesome init system!
Kind regards, Ingwie