-
🦎 @milohaxAuthor Owner2024-06-12: An interesting idea which I considered back in 2019 was to automatically slurp dotfiles to SSH hosts when connecting.
That method was to use
tarto pack and unpack a list of files from the local machine into the remote.It would be interesting now to use yadm to install the dotfiles on the remote, using my install snippet but executed via SSH, something like:
Host * PermitLocalCommand yes LocalCommand \ curl -fsSL \ https://gitlab.com/milohax-net/radix/dotfiles/-/snippets/3705626/raw/main/install.sh \ | ssh -o PermitLocalCommand=no %n "bash"The install script would need to be smart enough not to install again if it's already done.
-
🦎 @milohaxAuthor OwnerI considered using compression in the slurp. The file produced would be smaller:
~► tar cfz tarball ~/tmp/get-*; ls -l tarball tar: Removing leading '/' from member names .rw-r--r-- mjl staff 531 B Thu Jun 13 10:03:18 2024 tarballBut I'd have to work out what I'm doing wrong wrong because simply changing
cattotar czmakes it twelve times larger:~► cat ~/tmp/get-*|wc 20 68 805 ~► tar cz ~/tmp/get-*|wc tar: Removing leading '/' from member names 2 14 10240Alternatively, I could shorten the URLs in both snippets, to reduce the 805 bytes, but I'd rather send them raw, than break it if I lose my DNS domain.
I think for a potential 805 - 531 = 274 bytes saved for each SSH connection, it's not worth the effort or complexity.
-
🦎 @milohaxAuthor OwnerTODO: Include fishing into
dotfiles-slurp.sh.- Just need another snippet in the fishing project (
netcast.shto keep with the naming😉 ) and then add it to the files (another 179 bytes) - Also, it's only useful for hosts which have
fishinstalled, so maybe it would be better as it's own thing: Script to install some essential utilities (bashing#11 - closed)
testd -d ~/lib/fish \ || git clone git@gitlab.com:milohax-net/radix/fishing.git ~/lib/fish test -s ~/.config/fish \ || rm -rf ~/.config/fish; ln -s ~/lib/fish ~/.config.fish - Just need another snippet in the fishing project (
-
🦎 @milohaxAuthor Ownerdotfiles-slurp.shis also available via a shortened URL:i.e. one can get the bootstrap slurp script like so:
LocalCommand curl -fsSL https://milohax.net/slurp | bash | ssh -o PermitLocalCommand=no %n bashI don't know if that's better or not? But if not SSH-slurping, it probably is better:
curl -fsSL https://milohax.net/slurp | bash | bash -
🦎 @milohaxAuthor Owner✅ TODO: Includebashin the list of basic programs.- Requires that the
basic.shbe rewritten for POSIX (remove bash-isms) - bash-ism: redirect all streams with
&> /dev/null. replace with> /dev/null 2>&1 - bash-ism: testing with
[[ -n ${PKGR} ]] ||, replace withtest -d ${PKGR} || - bash-ism: arrays. POSIX shell doesn't have first-class arrays. Read https://www.baeldung.com/linux/posix-shell-array
- bash-ism: functions. POSIX shell doesn't have functions! Probably the simplest fix is to just repeat the
typecalls.
All of these are good arguments to make sure there is
basheverywhere I go! It's missing in Alpine. These are also all good arguments for thisbasic.shscript to not be slurped during SSH connection, because it's going to be a lot longer.2024-06-27T21:23Z - For the array issue, I'll have a read of that article, but probably I will just install everything in one go and let the package managers skip already installed packages.
2024-07-29T00:11Z - I have tried with
boot.shto get this to run in Alpine. It works (with cut/paste) and will install bash/git/curl, and then install yadm/dotfiles/bashing. But, on trying to run bash, it fails because the version ofgrepin Alpine is based on BusyBox, and does not understand GNU switches like--quiet. If feel that for Alpine, it is not worth it to refactor my bashing library to work with BusyBox utilities. So, I think I will abandon this approach, for Alpine at least. The dotfiles are useful though, if I install the utilities into Alpine that I want.2024-07-30T10:10Z - The Alpine
greppackage installs a version ofgrepwhich understands--quiet👍 Added it to the list of packages inapkinstalls, and now Bashing will load2024-07-11T23:43Z - Technically
grep, andhostnameare needed by Bashing and not Bootstrap. I'm installing them here for Alpine and SUSE because it smells less than repeating the package install in Bashing's bootstrap snippetEdited by Mike Lockhart | GitLab - Requires that the
-
🦎 @milohaxAuthor Owner✅ TODO: refactordotfiles-slurp.sh- have
boot.shwhich tests and installsbasicand then curls/clones the others, likedotfiles-slurp.sh - would reduce the SSH paylod to something like
curl -fsSL https://gitlab.com/milohax-net/radix/bootstrap/-/snippets/3721686/raw/main/boot.sh(94 bytes, instead of 1194).
0224-07-29T09:07Z - Well, it's more than 94 bytes, but one cannot
curlif that's not installed. So nowboot.shis a combination of thedotfiles-slurp.shandbasic.shlogic, rewritten for/bin/sh, with less logic and with shortened URLs using this project's.gitlab.iodomain. I don't know if this is "perfection", but Antoine de Saint-Exupéry would still be pleased, I think.Edited by MikeL - have
-
🦎 @milohaxAuthor OwnerYou can also use this
boot.shwithout SSH by copy/paste, for example:curl -fsSL https://milohax.net/profile.sub | pbcopy nerdctl run -it --rm rockylinux:9.3 cat > profile.sub(then paste)
cat profile.sub | sh(
profile.subis just a name I chose becausePROFILE.SUBwas the startup submit file for CP/M+ back in the 1980s. I recall spending a bit of time playing with that as a kid, making my little Amstrad CPC's CP/M+ bootstrap be more like a Hollywood mainframe)Edited by MikeL
Please register or sign in to comment