bin: Add some more stuff

I'm currently working on making your scripts on your
dotfiles available system-wide and also generating
your SSH client/server config.

Signed-off-by: Andrei Jiroh Eugenio Halili <andreijiroh@madebythepins.tk>
This commit is contained in:
Andrei Jiroh Eugenio Halili 2021-03-22 17:35:32 +08:00
parent 55efe75735
commit 7da21975e3
Signed by: ajhalili2006
GPG Key ID: A30EBE40AD856D88
2 changed files with 59 additions and 0 deletions

26
bin/generate-ssh-config Executable file
View File

@ -0,0 +1,26 @@
#!/bin/env bash
if [[ $1 == "" ]]; then
echo "Usage: $0 <--client|server|edit> [--online=url]"
echo "Generate predefined configuration for OpenSSH client/server, based on"
echo "the scrpit's defined config, stored in your ~/.dotfiles/config/ssh/* files."
echo ""
echo
echo "Available options:"
echo " --client Generate OpenSSH client config, usually"
echo " saved in ~/.ssh/config"
echo " --server Generate OpenSSH server config, either run"
echo " this script with the flag as root user"
echo " OR prefix with 'sudo' if your admin"
echo " allows you to use sudo."
echo " --online Generate OpenSSH client/server config from"
echo " the Internet, optionally provide the URL to"
echo " that publicly-available config file."
echo " To ensure that things don't break, we'll"
echo " keep an backup of the original file for you"
echo " just in case shit happens. You may need to"
echo " merge them manually since this script doesn't"
echo " have git-lile automerge and merge conflict"
echo " resolution toolkits yet."
exit
fi

33
bin/system-install Executable file
View File

@ -0,0 +1,33 @@
#!/bin/env sh
SUDO_PATH=$(command -v sudo)
SU_PATH=$(command -v su)
if [ "$1" = "" ]; then
echo "Usage: [sudo|su root -] $0 [COMMAND] [ARG]"
echo "Permanently installs your .dotfiles/bin scripts into your system for"
echo "all users. These system-wide installs are on /usr/local/bin/dotfiles-bin"
echo "to ensure that your dotfiles-bin installation doesn't mess up with"
echo "other locally-built packages in your Linus system."
echo
echo "Available commands:"
echo "install quick Install .dotfiles/bin scripts as system-wide"
echo " scripts, available for use in /usr/local/bin/dotfiles-bin"
echo " Requires root access (atleast with sudo) in order to"
echo " copy scripts into there. If ran as non-root user, this"
echo " script will attempt to run sudo or su root - as needed."
echo " It automatically detects your system for you before doing"
echo " anything to /usr/local/bin."
echo "install guided Guides you throughout the installation progress, including"
echo " choosing dest location. The script will check"
echo " file permissions for you"
echo "update DOTFILES_SYS_INSTALL_PATH"
echo " Update your system-wide scripts install as possibe, may"
echo " require root qccess. If the argument left blank, it will"
echo " attempt to find your ~/.dotfiles/config/sysbin-path.lock"
echo " file and sue the DOTFILES_SYS_INSTALL_PATH variable"
echo " Otherwise, this script will assume that you"
echo " installed it on /usr/local/bin/dotfiles-bin"
echo "uninstall Remove files from /usr/bin/local/dotfiles-bins"
echo " and any remaining artifacts.
fi