Skip to content

Commit

Permalink
migrated to vim v9.0.1447
Browse files Browse the repository at this point in the history
  • Loading branch information
mirsella committed Apr 14, 2023
1 parent fe9d048 commit d516720
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 35 deletions.
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
## Nano for Android NDK
### osm0sis @ xda-developers
*Static ARM nano binary for Android built with the NDK*
# vim for Android NDK
vim version of osm0sis's vim-ndk modules, all credits to him.
### [osm0sis nano-ndk](https://github.com/Magisk-Modules-Repo/nano-ndk)
the vim binary i used is from Zackptg5 : [Cross-Compiled-Binaries-Android](https://github.com/Zackptg5/Cross-Compiled-Binaries-Android)

### Links
* [GitHub](https://github.com/Magisk-Modules-Repo/nano-Installer)
* [Support](https://bit.do/osm0)
* [Sponsor](https://github.com/sponsors/osm0sis)
* [Donate](https://www.paypal.me/osm0sis)
check convert-to-vim.zsh to see the steps

### Description
An installer to push my own static Android ARM build of the nano editor and required files to /system/xbin/ and /system/etc/terminfo/, with a wrapper adding a --term option to try terminfo profiles more easily. Detects and supports SuperSU/Magisk systemless installs. Can then be used from Terminal while booted.
A simple installer to push static Android ARM build of the vim editor binary to /system/xbin/ along with the required files in /system/etc/terminfo/, and a wrapper with optional --term parameter to choose your terminfo profile. Detects and supports "systemless" install via SuperSU/Magisk as well. It can then be used from Terminal while booted from that point on.

When flashed in recovery also allows temporary recovery use by pushing a script to /sbin/nano with the required setup, so you can trigger it from adb shell or TWRP Terminal. Makes it extremely easy and worry-free to tweak and mod on the go, knowing you can edit the faulty build.prop or startup script if something goes wrong.
Each time you flash in recovery it also temporarily enables use in recovery by pushing a script to /sbin/vim with the required environment variables, so you can then trigger it from recovery shell or the console in amarullz' brilliant AROMA Filemanager. Makes it extremely easy and worry-free to tweak and mod on the go, knowing you can edit the faulty build.prop or init.d script if something goes wrong.
Binary file removed bin/nano.bin
Binary file not shown.
4 changes: 2 additions & 2 deletions bin/nano → bin/vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/system/bin/sh
# nano: wrapper to set up and run nano from terminal
# vim: wrapper to set up and run vim from terminal
# osm0sis @ xda-developers

dir="$(cd "$(dirname "$0")"; pwd)";
Expand All @@ -13,5 +13,5 @@ fi;

clear;
[ -e "$(which resize 2>&1)" ] && resize >/dev/null;
TERMINFO=$dir/../etc/terminfo TERM=$term $dir/nano.bin "$@";
TERMINFO=$dir/../etc/terminfo TERM=$term $dir/vim.bin "$@";

Binary file added bin/vim.bin
Binary file not shown.
24 changes: 24 additions & 0 deletions convert-to-vim.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
mv README.md README.md.bak
mv convert-to-vim.zsh convert-to-vim.zsh.bak
git fetch https://github.com/Magisk-Modules-Repo/nano-ndk master
git reset --hard FETCH_HEAD
mv README.md.bak README.md
mv convert-to-vim.zsh.bak convert-to-vim.zsh
wget 'https://github.com/Zackptg5/Cross-Compiled-Binaries-Android/raw/master/vim/vim-arm64' -O bin/vim.bin
vimversion=$(curl -s 'https://raw.githubusercontent.com/Zackptg5/Cross-Compiled-Binaries-Android/master/README.md' | rg '\* Vim \(' | sed 's#* Vim (##; s#)##')
vimversioncode=$(sed 's#v##; s#\.##g' <<< $vimversion)
rm bin/nano.bin
fd -E convert-to-vim.zsh -E README.md -E vim.bin -t f -x sed -i 's/nano/vim/gi' {}
fd 'nano$' -x mv {} {//}/vim
sed 's/vim.bin/vim.bin -C/' bin/vim # see issue #2
sed -i 's#nano#vim#gi; s#author=#author=mirsella'\''s fork of #' module.prop
sed -i 's#version=.*#version='$vimversion'#; s#versionCode=.*#versionCode='$vimversioncode'#' module.prop
git rm update.json
git add -A
git commit -m "migrated to vim $vimversion"
git push -f origin master
zip magisk-vim-ndk.zip $(fd -E .git -t f)
gh config set prompt disabled
gh release create "$vimversion" magisk-vim-ndk.zip -t "vim $vimversion (automatic release ⚠️)"
gh config set prompt enabled
rm magisk-vim-ndk.zip
16 changes: 8 additions & 8 deletions diffusion_config.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Diffusion Installer Config
# osm0sis @ xda-developers

INST_NAME="Nano Installer Script";
INST_NAME="vim Installer Script";
AUTH_NAME="osm0sis @ xda-developers";

USE_ARCH=false
Expand All @@ -16,21 +16,21 @@ custom_zip_opts() {
}

custom_target() {
# use /product/bin/nano if /system_ext/bin/nano exists to remain higher in $PATH
if [ -e /system/system_ext/bin/nano ]; then
# use /product/bin/vim if /system_ext/bin/vim exists to remain higher in $PATH
if [ -e /system/system_ext/bin/vim ]; then
TARGET=$TARGET/product;
fi;
}

custom_install() {
ui_print " ";
ui_print "Installing nano to $BIN ...";
ui_print "Installing vim to $BIN ...";
ui_print "Installing terminfo to $ETC ...";
set_perm 0 0 755 $BIN/nano $BIN/nano.bin;
set_perm 0 0 755 $BIN/vim $BIN/vim.bin;
if ! $BOOTMODE; then
ui_print "Installing nano recovery script to /sbin ...";
ui_print "Installing vim recovery script to /sbin ...";
cp -rf sbin/* /sbin;
set_perm 0 0 755 /sbin/nano;
set_perm 0 0 755 /sbin/vim;
fi;
}

Expand All @@ -53,7 +53,7 @@ custom_cleanup() {
custom_exitmsg() {
if ! $BOOTMODE && [ "$ACTION" == installation ]; then
ui_print " ";
ui_print "nano may now be run temporarily from";
ui_print "vim may now be run temporarily from";
ui_print "terminal/adb shell for this recovery session,";
ui_print "and from now on in booted Android.";
fi;
Expand Down
14 changes: 7 additions & 7 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
id=nano-ndk
name=Nano for Android NDK
version=7.2
versionCode=7201
author=osm0sis @ xda-developers
description=Static ARM nano binary for Android built with the NDK
updateJson=https://raw.githubusercontent.com/Magisk-Modules-Repo/nano-ndk/master/update.json
id=vim-ndk
name=vim for Android NDK
version=v9.0.1447
versionCode=901447
author=mirsella's fork of osm0sis @ xda-developers
description=Static ARM vim binary for Android built with the NDK
updateJson=https://raw.githubusercontent.com/Magisk-Modules-Repo/vim-ndk/master/update.json
support=https://forum.xda-developers.com/t/tools-zips-scripts-osm0sis-odds-and-ends-multiple-devices-platforms.2239421
donate=https://www.paypal.me/osm0sis
template=1500
12 changes: 6 additions & 6 deletions sbin/nano → sbin/vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/sbin/sh
# nano: set up and run nano from recovery/terminal
# vim: set up and run vim from recovery/terminal
# osm0sis @ xda-developers

(mount /data;
Expand Down Expand Up @@ -27,14 +27,14 @@ if [ "$suimg" ]; then
losetup -d $loop 2>/dev/null;
fi;
fi;
[ $mnt == /magisk ] && magisk=/nano-ndk/system;
[ $mnt == /magisk ] && magisk=/vim-ndk/system;
[ -e $magisk/product ] && magisk=$magisk/product;
etc=$mnt$magisk/etc;
bin=$mnt$magisk/bin;
else
mnt=$(dirname `find /data -name supersu_is_here | head -n1`);
[ -e /data/adb/modules ] && mnt=/data/adb/modules/nano-ndk/system;
[ -e /data/adb/modules_update ] && mnt=/data/adb/modules_update/nano-ndk/system;
[ -e /data/adb/modules ] && mnt=/data/adb/modules/vim-ndk/system;
[ -e /data/adb/modules_update ] && mnt=/data/adb/modules_update/vim-ndk/system;
if [ -e "$mnt" ]; then
[ -e $mnt/product ] && mnt=$mnt/product;
etc=$mnt/etc;
Expand All @@ -44,7 +44,7 @@ else
mount -o ro /product 2>/dev/null;
system=/system;
[ -f /system/system/build.prop ] && system=/system/system;
[ -e $system/product/bin/nano ] && system=$system/product;
[ -e $system/product/bin/vim ] && system=$system/product;
etc=$system/etc;
bin=$system/bin;
[ -e $system/xbin ] && bin=$system/xbin;
Expand All @@ -59,5 +59,5 @@ else
fi;

clear;
TERMINFO=$etc/terminfo TERM=$term $bin/nano.bin "$@";
TERMINFO=$etc/terminfo TERM=$term $bin/vim.bin "$@";

4 changes: 2 additions & 2 deletions update.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "7.2",
"versionCode": "7201",
"zipUrl": "https://forum.xda-developers.com/attachments/update-nano-terminal-editor-v7-2-signed-zip.5816099/",
"changelog": "https://raw.githubusercontent.com/Magisk-Modules-Repo/nano-ndk/master/README.md"
"zipUrl": "https://forum.xda-developers.com/attachments/update-vim-terminal-editor-v7-2-signed-zip.5816099/",
"changelog": "https://raw.githubusercontent.com/Magisk-Modules-Repo/vim-ndk/master/README.md"
}

0 comments on commit d516720

Please sign in to comment.