Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.
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
You can’t perform that action at this time.