From 7da21975e325e2d321bdccb142dee73f3ca50651 Mon Sep 17 00:00:00 2001 From: Andrei Jiroh Eugenio Halili Date: Mon, 22 Mar 2021 17:35:32 +0800 Subject: [PATCH] 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 --- bin/generate-ssh-config | 26 ++++++++++++++++++++++++++ bin/system-install | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100755 bin/generate-ssh-config create mode 100755 bin/system-install diff --git a/bin/generate-ssh-config b/bin/generate-ssh-config new file mode 100755 index 0000000..e42bf48 --- /dev/null +++ b/bin/generate-ssh-config @@ -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 diff --git a/bin/system-install b/bin/system-install new file mode 100755 index 0000000..3323977 --- /dev/null +++ b/bin/system-install @@ -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