dotfiles/bin/system-install

50 lines
2.6 KiB
Bash
Executable File

#!/bin/env sh
SUDO=${SUDO:-"sudo"}
if [ "$1" = "" ] || [ "$1" = "help" ]; 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 Linux system."
echo
echo "Available commands:"
echo "status Checks if the dotfiles-bin installation is there"
echo " and also prints out your default install path if"
echo " DOTFILES_SYS_INSTALL_PATH isn't found"
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."
exit 0
fi
if [ "$1" = "status" ]; then
if [ "! $DOTFILES_SYS_INSTALL_PATH" = "" ]; then
echo "Local install: $DOTFILES_SYS_INSTALL_PATH"
elif [ -f "$HOME/.dotfiles/config/sysbin-path" ]; then
DOTFILES_SYS_INSTALL_PATH=$(cat "$HOME/.dotfiles/config/sysbin-path")
echo "Local install: $DOTFILES_SYS_INSTALL_PATH"
else
echo "Local install: ✖ Not found"
fi
else
echo "That command isn't supported, yet. See 'system-install help' for details."
fi