Last active
April 7, 2020 01:13
-
-
Save Zsoldier/63ef0f0b14d0b9ef2f0dd46c8a907a5b to your computer and use it in GitHub Desktop.
Basically a way for me to sync changes via dropbox and restore a MacOS terminal environment w/o bringing along all the garbage that Time Machine will likely haul with it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
overwrite=true #only applies to zsh profile, not implemented for other stuff. no overwrite by default elsewhere. | |
brew=true | |
SyncDir=~/Documents/_NakaProfile | |
customsudodir=/etc/sudoers.d/ | |
ZSHPlugins=$SyncDir/zsh/custom/plugins/ | |
ZSHThemes=$SyncDir/zsh/custom/themes/ | |
VPNConfigs=$SyncDir/vpn/ | |
stoken=$SyncDir/stoken | |
customsudofiles=$SyncDir/customsudo/ | |
# oh-my-zsh install | |
if ! test -d ~/.oh-my-zsh/ ; then | |
echo "oh-my-zsh not detected, attempting install." | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
else | |
echo "oh-my-zsh detected, skipping install." | |
fi | |
# Brew Install | |
if [ $brew = true ] ; then | |
if ! brew help ; then | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
else | |
echo "brew is installed." | |
fi | |
else | |
echo "Skipping brew install check" | |
fi | |
# oh my zsh profile and ssh configs | |
if [ $overwrite = true ] ; then | |
rm ~/.zshrc | |
ln -s $SyncDir/zsh/.zshrc ~/.zshrc | |
rm ~/.ssh | |
ln -s $SyncDir/ssh/ ~/.ssh | |
fi | |
# Set ssh permissions | |
for i in $SyncDir/ssh/* | |
do | |
#filename=`basename ${i%%}` | |
chmod 600 $i | |
done | |
# ZSH Plugins | |
for i in $ZSHPlugins* | |
do | |
foldername=`basename ${i%}` | |
if ! test -d ~/.oh-my-zsh/custom/plugins/$foldername ; then | |
ln -s $i ~/.oh-my-zsh/custom/plugins/$foldername | |
else | |
echo "$foldername folder already exists" | |
fi | |
done | |
# ZSH Themes | |
for i in $ZSHThemes* | |
do | |
filename=`basename ${i%%}` | |
if test -f ~/.oh-my-zsh/custom/themes/$filename ; then | |
echo "symlink or file already exists for $i" | |
else | |
ln -s $i ~/.oh-my-zsh/custom/themes/$filename | |
fi | |
done | |
# Custom sudo files | |
for i in $customsudofiles* | |
do | |
filename=`basename ${i%%}` | |
if ! visudo -cf $i ; then | |
echo "$i sudo file shows incorrect syntax." | |
else | |
if test -f $customsudodir$filename ; then | |
echo "$filename already exists in $customsudodir" | |
else | |
echo "Copying $i into $customsudodir. Elevated permissions required." | |
sudo cp $i $customsudodir | |
fi | |
fi | |
done | |
# stoken | |
if test -f ~/.stokenrc ; then | |
echo "symlink or file already exists for $i" | |
else | |
ln -s $stoken/.stokenrc ~/.stokenrc | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment