From 04b250323e1481386481433f63388c792a66c128 Mon Sep 17 00:00:00 2001 From: Luxferre Date: Wed, 3 Jun 2026 13:16:36 +0300 Subject: [PATCH] added roid.sh --- .roidrc-minimal | 82 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 10 ++++++ roid.sh | 52 +++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 .roidrc-minimal create mode 100644 roid.sh diff --git a/.roidrc-minimal b/.roidrc-minimal new file mode 100644 index 0000000..d10e3e8 --- /dev/null +++ b/.roidrc-minimal @@ -0,0 +1,82 @@ +# .roidrc: a compact, single-file Bash shell environment tweaker +# for rooted Void Linux environments like Roid or Voideck +# Only include in the interactive sessions, e.g. for bash: +# [[ $- == *i* ]] && . $HOME/.roidrc +# Core deps: less, nano (8.x+), sed, ed, rlwrap, curl, openssh, dtach +# Created by Luxferre in 2026, released into public domain + +# override the editor (needs Nano 8 and up) and pager +export EDITOR='nano -FEDSMAGic/max%_T2' +export PAGER='less -RXF' +alias nn="$EDITOR" +alias pg="$PAGER" + +# edit and/or live-reload this very file +alias reload-rc=". $BASH_SOURCE" +alias edit-rc="$EDITOR $BASH_SOURCE && . $BASH_SOURCE" + +# get the most recent command run on this shell +alias lastcmd='history | tail -q -n 2 | head -q -n 1 | sed "s/^[[:space:]]*[0-9]*[[:space:]]*//"' + +# custom alias management framework (defalias/toalias/savealias) +alias defalias='___(){ __="$1";shift;alias $__="_$__(){ $*; };_$__";unset __; };___' +defalias toalias 'defalias "$1" "$(lastcmd)";alias "$1"' +defalias savealias "[ -n \"\$1\" ] && echo \"alias \$(alias \$1 | sed 's/^alias //')\" >> $BASH_SOURCE" + +# most important aliases +alias rw='rlwrap -R' +alias ee='rlwrap -R ed -p:' +alias eer='sudo rlwrap -R ed -p:' +defalias l 'ls -lahF --time-style=long-iso --color=always $* | less -RXF' +defalias sshed 'f="$(mktemp)";scp $1 $f && $EDITOR $f && scp $f $1 && rm -f $f && unset f' +alias dl='curl -sSLO' +alias websrv='python3 -m http.server' +alias gcm='git commit -a -m' +alias gp='git push origin' +alias gpm='git push origin master' + +# Void-specific aliases +alias pkgadd='xbps-install -Sy' +alias pkgdel='xbps-remove -oy' +alias pkgsearch='xbps-query -Rs' +alias sysup='xbps-install -Suy && vkpurge rm all && xbps-remove -OOoy' +alias sysclean='vkpurge rm all && xbps-remove -OOoy' + +# Roid-specific aliases +alias tmhome='cd $TERMUX_HOME' + +# OpenSSL-based vault helper +ovault() { + local pw="$4" + local op='-d' + [ "$1" = 'e' ] && op='-e' + if [ -z "$pw" ]; then + read -rs -p 'Enter vault password: ' pw + fi + openssl aes-256-cbc $op -pbkdf2 -iter 100000 -pass pass:"$pw" -in "$2" -out "$3" +} + +# dmux, a simple dtach based terminal session manager, as a Bash function +dmux() { + local SDIR="$HOME/.dtsess" SPFILE="$SDIR/.list" sname + local -a MENU + mkdir -p "$SDIR" + touch "$SPFILE" + mapfile -t MENU < "$SPFILE" + if [[ -z "$(ls -1 "$SDIR")" ]]; then + for sname in "${MENU[@]}"; do + dtach -n "$SDIR/$sname" $SHELL + done + fi + PS3='Select a session: ' + while true; do + select sname in "${MENU[@]}" New Quit; do break; done + [[ "$sname" = 'Quit' ]] && printf '\033[0m' && break + [[ "$sname" = 'New' ]] && read -r -p 'New session name: ' sname + [[ -n "$sname" ]] && printf '\033[0m' && dtach -A "$SDIR/$sname" $SHELL + ls -1 "$SDIR" > "$SPFILE" + mapfile -t MENU < "$SPFILE" + done +} + +# ...custom saved aliases will go here diff --git a/README.md b/README.md index 57f7da3..af62b69 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,16 @@ In case you don't need a GUI desktop, run `NOX=y sh ~/roid/install` instead. After the process completes, you need to fully exit the Termux shell and re-enter it before you can start Void. +## Absolute minimum installation (no Git required on Termux side) + +```sh +curl -sSL https://luxferre.top/roid.sh | sh +``` + +The [roid.sh](roid.sh) script installs a near-barebones, CLI-only, but still convenient Void Linux environment and also updates your Termux font to Fira Code Retina in order to enable ligatures. It uses a separate `.roidrc` file that's stored as [.roidrc-minimal](.roidrc-minimal) in this repo. + +This is the author's preferred way of quickstarting a Void shell on any fresh device running Termux. + ## CLI usage From the Termux environment, just type `void` to enter the Void Linux shell. You're ready to go. Your original Termux home path is available in the `$TERMUX_HOME` environment variable. diff --git a/roid.sh b/roid.sh new file mode 100644 index 0000000..e2bca8b --- /dev/null +++ b/roid.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Roid.SH: minimalistic Void Linux setup script for Termux environment +# that includes sound support via PulseAudio server +# This is a stand-alone version with no parameterization available +# Created by Luxferre in 2026, released into the public domain + +ALL_REPOS="void-repo-nonfree" +ALL_PKGS='base-container-full base-devel curl git nano mc dtach fzf zip p7zip unrar rlwrap jq htop rsync netcat socat gnupg pass progress discount aria2 lynx nmap pulseaudio alsa-plugins-pulseaudio mpg123 dumbplay' + +echo 'Setting up host environment...' +pkg upgrade -y +pkg install -y proot-distro pulseaudio +cat >> $HOME/.profile <<'EOF' +pulseaudio --start --exit-idle-time=-1 # ROID_INST +pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1 # ROID_INST +EOF +cat >> $HOME/.bashrc <<'EOF' +alias void="proot-distro login -P -e TERMUX_HOME=$HOME void-glibc-full" # ROID_INST +alias voidrun='proot-distro run -P void-glibc-full --' # ROID_INST +alias roidclean='killall pulseaudio' # ROID_INST +EOF +echo 'Installing Void Linux...' +proot-distro install ghcr.io/void-linux/void-glibc-full +echo 'Extra repository setup...' +proot-distro run void-glibc-full -- sh -c "xbps-install -Suyy && xbps-install -Sy $ALL_REPOS" +echo 'Package setup...' +proot-distro run void-glibc-full -- sh -c "xbps-install -Suyy && xbps-install -Sy $ALL_PKGS" +echo 'Post-installation steps...' +cat > $HOME/.roid-postinstall <<'GLOBALEOF' +#!/bin/sh +cat > /root/.bash_profile <<'EOF' +export LC_ALL=C.UTF-8 +export LANG=C.UTF-8 +[[ -f /root/.bashrc ]] && [[ $- == *i* ]] && . /root/.bashrc +EOF +cat > /root/.bashrc <<'EOF' +PS1='\W # ' +. /root/.roidrc +EOF +curl -sSL https://luxferre.top/.roidrc > /root/.roidrc +GLOBALEOF +proot-distro run void-glibc-full -e TERMUX_HOME=$HOME -- sh $HOME/.roid-postinstall +rm $HOME/.roid-postinstall +echo 'Font setup...' +TDIR="$(mktemp -d)" +cd $TDIR +FONTURL='https://github.com/tonsky/FiraCode/releases/download/6.2/Fira_Code_v6.2.zip' +curl -sSL -o font.zip "$FONTURL" +unzip -j font.zip ttf/FiraCode-Retina.ttf +mv FiraCode-Retina.ttf $HOME/.termux/font.ttf +cd && rm -rf $TDIR +echo 'Done. Restart the Termux shell to take effect, then type void to start the OS'