Skip to content

Commit

Permalink
update secondary install
Browse files Browse the repository at this point in the history
  • Loading branch information
bretonics committed Apr 18, 2020
1 parent 0a6e18b commit 5d952fe
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 42 deletions.
4 changes: 4 additions & 0 deletions bin/globals
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ BREW_FORMULAE_FILE="./src/formulae.txt"
BREW_TAPS_FILE="./src/taps.txt"
MAC_APPS_FILE="./src/apps.txt"

# Setup Configurations
GITHUB_KEYS_URL="https://github.com/settings/keys"
GITHUB_RSA_NAME="github_rsa"

# Color Outputs
GREEN="\033[0;32m"
RED="\033[0;31m"
Expand Down
132 changes: 90 additions & 42 deletions secondary
Original file line number Diff line number Diff line change
@@ -1,83 +1,131 @@
#!/usr/bin/env bash

echo "================================================================================"
echo "| Script: $0"
echo "| Run by: `whoami`"
echo "| On: `date`"
echo "| PID: $$"
echo "================================================================================"
echo ""
echo ""
echo ""


#--------------------------------------------------------------------------------
# PERSONALIZE SETUP
echo "Running personalizations"
printf "================================================================================\n\n"
#===============================================================================================
# PRE-LAUNCH SETUP
#===============================================================================================

SETUP_PWD=`pwd`

#-----------------------------------------------------------------------------------------------
# SOURCES
# - General Helper Functions
# - Global Environment Variables
# - CLI Argument Options
for file in ./bin/*; do
source $file
done

#===============================================================================================
# START RUNNING SECONDARY SETUP
#===============================================================================================
header_message

cd ~
printf "\nCurrently at `pwd`\n"
exit

printf "\nDownloading Submodules\n"
#-----------------------------------------------------------------------------------------------
# SYSTEM PERSONALIZATION
echo "RUNNING SYSTEM PERSONALIZATIONS"
echo -e "================================================================================\n\n"

echo -e "Downloading Submodules\n"
git pull --recurse-submodules

printf "\nCopying .bash_profile\n"
echo -e "\nCopying .bash_profile\n"
cp ./files/bash/profile/.bash_profile ~/

printf "\nCopying .bashrc\n"
echo -e "\nCopying .bashrc\n"
cp ./files/bash/bashrc/.bashrc ~/

printf "\nCopying .bash_functions\n"
echo -e "\nCopying .bash_functions\n"
cp ./files/bash/functions/.bash_functions ~/

printf "\nInitializing crontab\n"
echo -e "\nInitializing crontab\n"
crontab ./files/crontab/crontab

printf "\nSourcing .bash_profile\n"
echo -e "\nSourcing .bash_profile\n"
source ~/.bash_profile

printf "\nInitializing crontab\n"
crontab ./crontab
echo -e "\nLinking and Sourcing all Bash Completions\n"
ln -s /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash /usr/local/etc/bash_completion.d/
for f in /usr/local/etc/bash_completion.d/*; do source $f; done

echo -e "\nReducing Dock autohide animation\n"
defaults write com.apple.dock autohide-time-modifier -float 0.25; killall Dock

echo -e "\nRemove Dock Delay for Auto-Hide & Auto-Show\n"
defaults write com.apple.Dock autohide-delay -float 0 && killall Dock

printf "\nSymlinking Atom config directory\n"
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# 3RD PARTY
echo -e "\nSymlinking Atom config directory\n"
rm -rf ~/.atom
ln -sf ~/Dropbox/Apps/Atom ~/.atom

printf "\nReducing Dock autohide animation\n"
defaults write com.apple.dock autohide-time-modifier -float 0.25; killall Dock
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# GIT
echo -e "\n\nConfiguring Git"
echo -e "--------------------------------------------------------------------------------\n"

printf "\nRemove Dock Delay for Auto-Hide & Auto-Show\n"
defaults write com.apple.Dock autohide-delay -float 0 && killall Dock
# git config --global pull.rebase true

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# SSH KEYS
echo -e "\n\nConfiguring SSH Keys"
echo -e "--------------------------------------------------------------------------------\n"

cd ~
mkdir ~/.ssh
cp -v ./files/config ~/.ssh
ssh-keygen -t rsa -f ~/.ssh/${GITHUB_RSA_NAME}
cat ~/.ssh/${GITHUB_RSA_NAME}.pub | pbcopy

echo -e "\n\nSSH public key copied to clipboard.\n"
echo -e "\nGitHub will now open. Paste PUBLIC SSH key copied to your clipboard and come back here to continue.\n"
sleep 3
open ${GITHUB_KEYS_URL}
read -p "Waiting on user to return. Press to continue... "
pbcopy < /dev/null # clear clipboard

#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# GGP Key
echo -e "\n\nCreating GPG Key"
echo -e "--------------------------------------------------------------------------------\n"

printf "\nCreating GPG Key\n"
gpg --gen-key
GPGkey=$(gpg --list-secret-keys --keyid-format LONG | sed -nE 's/sec.*rsa2048\/([a-zA-Z0-9]+).*/\1/p')

printf "\nConfiguring GPG Key with resources\n"
git config --global user.signingkey ${GPGkey}
echo -e "\nConfiguring GPG Key with resources\n"
git config --global user.signingkey ${GPGkey} # configure Git to use GPG
gpg --armor --export ${GPGkey} | pbcopy

echo -e "\n\nGPG key copied to clipboard.\n"
unset GPGkey
echo -e "GitHub will now open. Paste GPG key copied to your clipboard and come back here to continue.\n"
sleep 3
open ${GITHUB_KEYS_URL}
read -p "Waiting on user to return. Press to continue... "
pbcopy < /dev/null # clear clipboard

printf "\n\nDone running personalizations.\n\n\n"
message "Done running workspace personalizations."
sleep 2

#--------------------------------------------------------------------------------
#===============================================================================================
# UPDATES
echo "Running updates"
printf "================================================================================\n\n"
#===============================================================================================
echo "RUNNING UPDATES"
echo -e "================================================================================\n\n"

echo "Updating macOS"
softwareupdate -ia --verbose

echo "Updating Atom"
apm upgrade -c false

printf "\n\nDone running updates.\n\n\n"
message "Done running updates."
sleep 2


echo "================================================================================"
echo "| Secondar setup has FINISHED"
echo "================================================================================"
echo ""
#===============================================================================================
# COMPLETED
#===============================================================================================
completed_message "Secondary"

0 comments on commit 5d952fe

Please sign in to comment.