Added GETOPTS functionality and a README

main
Graham Helton 2 years ago
parent 5f8d70f267
commit fbd0b387fe

@ -0,0 +1,10 @@
# AutoDeploy
AutoDeploy is a tool written in 100% bash that allows for extensible synchronization of configuration files, auto installation of programs your commonly use, and allows for git-like pull/commit. This is intended to be extensible to allow for you to quickly push out a set of configuration files, and have them be pulled into any other machine.
# Goals
I work on so many different machines that keeping my configuration files and the versions of the software I use in sync between many machines is a painstaking task. Autodeploy should help with the following:
- Easily moving all configuraiton files (`~/.vimrc`,`~/.config/i3/config`,`~/.xprofile`,etc) between multiple machines
- Keeping software (and their configurations) the same across all machines
- 100% bash
- [Trufflehog](https://github.com/trufflesecurity/trufflehog)-like functionality for configuration files being stored in public places (IE: Github)

@ -5,7 +5,9 @@ BLUE="\e[94m"
GREEN="\e[32m"
ENDCOLOR="\e[0m"
TICK="[$GREEN+$ENDCOLOR] "
TAB="--"
CONFIG_PATH=~/.config/autodeploy
usage() { echo "Usage: $0 [-s <45|90>] [-p <string>]" 1>&2; exit 1; } # Copy and pasted, need to update
pre_check(){
# Sets default variables, creates config folder, and uses pre-existing config file if it exists
@ -20,10 +22,37 @@ pre_check(){
echo "remote_repo="https://github.com/grahamhelton"" >> ~/.config/autodeploy/config.txt
. ~/.config/autodeploy/config.txt
fi
echo $config_name
echo $remote_repo
}
pre_check
# Handle command line options. Not sure why this isn't working inside a function
while getopts "p c f d" o; do
case "${o}" in
# Pull config
p)
p=${OPTARG}
echo $TICK$BLUE"Pulling config from $remote_repo"$ENDCOLOR
;;
# Commit config
c)
c=${OPTARG}
echo $TICK$BLUE"Commiting config to $remote_repo"$ENDCOLOR
;;
# Full install
f)
f=${OPTARG}
echo $TICK$BLUE"Running full install"$ENDCOLOR
;;
# Only install dot files
d)
d=${OPTARG}
echo $TICK$BLUE"Only installing dot files"$ENDCOLOR
;;
*)
usage
;;
esac
done
get_posture(){
# This function is used to determine what kind of system the script is being deployed on. It will check for the following items:
@ -50,8 +79,8 @@ get_posture(){
}
install_apt(){
echo $TICK$GREEN"Please input SUDO password"$ENDCOLOR
echo $TICK$GREEN"Installing from $CONFIG_PATH/install.txt"$ENDCOLOR && xargs sudo apt install -y <$CONFIG_PATH/install.txt | grep "Unpacking"
echo $TICK$BLUE"Please input SUDO password"$ENDCOLOR
echo $TICK$GREEN"Running apt update and apt upgrade"$ENDCOLOR && sudo apt update -y> /dev/null 2>&1 && sudo apt upgrade -y > /dev/null 2>&1
echo $TICK$GREEN"Installing from $CONFIG_PATH/install.txt"$ENDCOLOR && xargs sudo apt install -y <$CONFIG_PATH/install.txt > /dev/null 2>&1
}
pre_check
install_apt
get_posture

@ -0,0 +1,17 @@
neovim
tmux
python3
terminator
nautilus
curl
zsh
xclip
mpv
vifm
flameshot
gimp
neofetch
wireshark
nmap
peek
Loading…
Cancel
Save