From cbeb6b6b8589f9e3bca51b838a8fbf919aca2a8e Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Halili Date: Tue, 13 Aug 2024 23:42:20 +0800 Subject: [PATCH] chore(termux): update readme for termux setup and then some Also adding some debugging-related chores btw. Signed-off-by: Andrei Jiroh Halili --- .config/yadm/bootstrap | 9 +- .../yadm/bootstrap.d/00-post-clone-repo.sh | 27 +++-- .termux/termux.properties | 2 +- README.md | 102 ++++-------------- 4 files changed, 47 insertions(+), 93 deletions(-) diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index 7eadc75..e327211 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -8,18 +8,23 @@ set -eu +if [[ $DEBUG != "" ]]; then + set -x +fi + # Directory to look for bootstrap executables in BOOTSTRAP_D="${BASH_SOURCE[0]}.d" if [[ ! -d "$BOOTSTRAP_D" ]]; then - echo "Error: bootstrap directory '$BOOTSTRAP_D' not found" >&2 + echo "[bootstrap] Error: bootstrap directory '$BOOTSTRAP_D' not found" >&2 exit 1 fi find -L "$BOOTSTRAP_D" -type f | sort | while IFS= read -r bootstrap; do if [[ -x "$bootstrap" && ! "$bootstrap" =~ "##" && ! "$bootstrap" =~ "~$" ]]; then + echo "[bootstrap] running $bootstrap" if ! "$bootstrap"; then - echo "Error: bootstrap '$bootstrap' failed" >&2 + echo "[bootstrap] Error: bootstrap '$bootstrap' failed" >&2 exit 1 fi fi diff --git a/.config/yadm/bootstrap.d/00-post-clone-repo.sh b/.config/yadm/bootstrap.d/00-post-clone-repo.sh index af8394a..59a0f7f 100755 --- a/.config/yadm/bootstrap.d/00-post-clone-repo.sh +++ b/.config/yadm/bootstrap.d/00-post-clone-repo.sh @@ -1,15 +1,20 @@ #!/usr/bin/env bash -set -x - -if [ ! -d "$HOME/.git" ] && [ -d "$HOME/.local/share/yadm/repo.git" ]; then - echo "Symlinking ~/.git to ~/.local/share/yadm/repo.git for compatibility" - ln -s ~/.local/share/yadm/repo.git ~/.git -elif [ -d "$HOME/.git" ] && [ ! -d "$HOME/.local/share/yadm/repo.git" ]; then - echo "Symlinking ~/.local/share/yadm/repo.git to ~/.git for compatibility" - ln -s ~/.git ~/.local/share/yadm/repo.git +if [ $DEBUG != "" ]; then + set -x fi -echo "Setting git remote URLs to SSH" -git remote set-url --add origin ssh://git@mau.dev/andreijiroh.dev/dotfiles || true -git remote set-url --add hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles || git remote add hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles +if [ ! -d "$HOME/.git" ] && [ -d "$HOME/.local/share/yadm/repo.git" ]; then + echo "[git-symlinks] Symlinking ~/.git to ~/.local/share/yadm/repo.git for compatibility" + ln -s ~/.local/share/yadm/repo.git ~/.git +elif [ -d "$HOME/.git" ] && [ ! -d "$HOME/.local/share/yadm/repo.git" ]; then + echo "[git-symlinks] Symlinking ~/.local/share/yadm/repo.git to ~/.git for compatibility" + ln -s ~/.git ~/.local/share/yadm/repo.git +else + echo "[git-symlinks] Looks like everything is all clear on git" +fi + +echo "[git-remotes] Setting git remote URLs to SSH" +git remote set-url --add --push hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles \ + || git remote add hut https://git.sr.ht/~ajhalili2006/dotfiles \ + && git remote set-url --add --push hut ssh://git@git.sr.ht/~ajhalili2006/dotfiles diff --git a/.termux/termux.properties b/.termux/termux.properties index 7bba4a4..fc8ec62 100644 --- a/.termux/termux.properties +++ b/.termux/termux.properties @@ -92,7 +92,7 @@ extra-keys = [ \ ############### ### Force black colors for drawer and dialogs -# use-black-ui = true +use-black-ui = true ############### # HW keyboard shortcuts diff --git a/README.md b/README.md index 55c9e66..85e9a92 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,34 @@ -# ~ajhalili2006's dotfiles +# ~ajhalili2006's dotfiles in Termux -This is the redesigned dotfiles repo for ~ajhalili2006, because my first repo became a mess so hard -to fix it in, built from scratch and based on . +> [!note] +> For the main documentation itself, [see the README on the main branch](https://mau.dev/andreijiroh-dev/dotfiles/blob/main/README.md). -## Quick deploy +My dotfiles, customized for [Termux](https://termux.dev) and friends (context: Android OS). +Based off , but uses `yadm` to manage home directory's version control +as if I do prefixing commands with `git -C ~`. + +## Quick deploy / Speedrun ```bash -# Working on it soon. -curl -fsSL https://scripts.andreijiroh.xyz/dotfiles/setup.sh | bash - +# The script should detect that we're inside Termux, although we can force it +# with the --termux flag. +curl -fsSL https://scripts.andreijiroh.xyz/dotfiles/setup.sh | bash -s --termux ``` -## Available Git mirrors +Alternatively: -This project is hosted on [hosted instance of sourcehut git](https://git.sr.ht) at the -[`~ajhalili2006/dotfiles`][git.sr.ht] Git repository, alongside the following -Git mirrors: - -* mau.dev: (technically canonical due -to how mirroring work and usualy pushed there first) -* GitHub: -* Launchpad.net: -* ~vern git: -* tildegit: - -[git.sr.ht]: https://git.sr.ht/~ajhalili2006/dotfiles - -## Setup - -### With yadm - -```shell -# on a Alpine Linux sandbox VM (or chroot) -apk add yadm git gnupg - -yadm clone https://mau.dev/andreijiroh.dev/dotfiles -yadm restore --staged $HOME -yadm checkout -- $HOME - -# run the bootstrap script +```bash +pkg install git git-lfs yadm gh glab-cli openssh +git init -m main +git remote add lab https://mau.dev/andreijiroh-dev/dotfiles +git fetch --all +git switch lab/termux yadm bootstrap ``` -### Without yadm +## Differences from main branch -It's easy, although this will be different because `git clone ` will -scream some errors when attempt to do so after creating a user with their own home directory. - -```bash -# go back to your $HOME -cd ~ - -# init repo, add origin to git.sr.ht repo (have you got your SSH keys?) -git init -git remote add origin git@git.sr.ht:~ajhalili2006/dotfiles-modern - -# another route here is cloning the repo before the user creation take place -# so you can skip the "fetch and force checkout hellscape" -git clone git@git.sr.ht:~ajhalili2006/dotfiles-modern /home/ajhalili2006 -# ...create user "ajhalili2006" here -chown ajhalili2006:ajhalili2006 -Rv /home/ajhalili2006 - -# fetch and force checkout, RIP any unstashed hellscapes -git fetch -git checkout -f main - -# logout and login again to refresh your shell env -``` - -## Codespaces + Gitpod specifics - -Because this cause confusion to most cloud dev environment services, although they'll symlink -stuff when there's no install script, but that is a design flaw to be work around in the future. - -## License - -TL;DR before we dive in to legalese: - -* Everything is licensed under both MIT + MPL 2.0, unless otherwise noted. Most third-party - code and submodules used here aren't covered by this policy. -* Open source !== open contribution. Since this is just a personal project, expect your contributions to be - either rewritten or declined. -* For contributors who wish to send patches, either an agreement to the DCO (via `--signoff` flag on commits and - when sending email patches via `~ajhalili2006/public-inbox@lists.sr.ht`) or through signing the project-specific - [Individual CLA][sign-link] alongside this specific [copyright transfer agreement on this project][cta-ajhalili2006-dotfiles] - (requires separate signature, uses FSFe's FLA 2.0) is mostly enough. Doing both is recommended to avoid further legal headaches down the line, atlhough ~sircmpwn recommends - against signing the CLA, especially due to legalities around copyright assignments in OSS. - -[cta-ajhalili2006-dotfiles]: https://cla.recaptime.eu.org/sign/copyright-assignment?project=ajhalili2006-dotfiles&requireClaSignature=true&claType=FLA-FSFE -[sign-link]: https://cla.recaptime.eu.org/sign/per-project-basis?type=individual&project=ajhalili2006-dotfiles&claType=FLA-FSFE +* Termux app customizations are stored in [`.termux/termux.properties`](.termux/termux.properties) file. +* Heavy usage of `safe.storage` in Git user config for cross-app storage access, especially for Git repos via Obsidian. +* Shell shebang patches via `termux-fix-shebang` +* Some workarounds for using `keychain`