You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.4 KiB
100 lines
2.4 KiB
#!/bin/bash
|
|
IFS='\n\t'
|
|
set -euo pipefail
|
|
|
|
source="$(pwd)"
|
|
bkup="$source/../.home_bkup"
|
|
dest="$source/.."
|
|
|
|
echo "Making a backup of old dotfiles into ${bkup}..."
|
|
rm -rf "${bkup}"
|
|
mkdir -p "${bkup}"
|
|
|
|
IFS=$'\n'
|
|
if [[ -f ${dest}/.ssh/config ]]; then
|
|
mkdir -p "${bkup}/.ssh"
|
|
cp "${dest}/.ssh/config" "${bkup}/.ssh/config"
|
|
fi
|
|
for file in $(ls -lA "${source}" | grep "^-" | awk '{print $9}'); do
|
|
if [ -f "${dest}/${file}" ]; then
|
|
cp "${dest}/${file}" "${bkup}/${file}"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "loading git modules..."
|
|
git submodule init
|
|
git submodule update
|
|
|
|
echo ""
|
|
echo "copying \"./tools\" directories..."
|
|
if [[ -z "${dest}/Tools" ]]; then
|
|
mkdir ${dest}/Tools
|
|
fi
|
|
#ln -fs ${source}/Tools ${dest}/tools
|
|
cp -R ${source}/tools ${dest}/tools
|
|
|
|
echo "installing fonts"
|
|
find -f ${source}/tools/modules/powerline-fonts | grep "\.[to]tf" | xargs -I {} cp {} /Users/$(whoami)/Library/Fonts/
|
|
|
|
|
|
# sometimes its easier if you just change directories
|
|
pushd ${dest} 2&> /dev/null
|
|
|
|
echo ""
|
|
echo "linking dotfiles from ${source} into ${dest}"
|
|
# ln doesn't want to work on my windows box, so I'm going to have to figure this out later
|
|
ls -lA "${source}" | grep "^-" | awk '{print $9}' | xargs -I file ln -fs "${source}/file" "${dest}/file"
|
|
if [[ -z "${dest}/.ssh" ]]; then
|
|
mkdir "${dest}/.ssh"
|
|
fi
|
|
|
|
echo ""
|
|
# a check to see if they're using a config file and if it has a host setup
|
|
if [[ -f "${dest}/.ssh/config" && -z $(cat "${dest}/.ssh/config" | grep "[hH]ost \*") ]]; then
|
|
echo "Appending ssh config"
|
|
# we append it so we don't destroy any custom settings they may have
|
|
cat "${source}/.ssh/config" >> "${dest}/.ssh/config"
|
|
elif [[ -z "${dest}/.ssh/config" ]]; then
|
|
echo "Copying new ssh config"
|
|
cp "${source}/.ssh/config" "${dest}/.ssh/config"
|
|
else
|
|
echo "Your SSHfu is strong, skipping config copy..."
|
|
fi
|
|
|
|
if [[ $(uname -s) == "Darwin" ]]; then
|
|
echo "running .osx file"
|
|
sudo ./.osx
|
|
echo "installing brew"
|
|
./brew.sh
|
|
fi
|
|
|
|
|
|
echo ""
|
|
echo "Cleaning up..."
|
|
cleanup=".git
|
|
.gitmodules
|
|
.gitignore
|
|
bootstrap.sh
|
|
remove.sh
|
|
README.md
|
|
.osx
|
|
brew.sh"
|
|
|
|
|
|
for f in ${cleanup}
|
|
do
|
|
filetorm = ${dest}/${f}
|
|
if [[ -f ${filetorm} ]]; then
|
|
rm -rf $filetorm
|
|
fi
|
|
done
|
|
|
|
|
|
popd 2&> /dev/null
|
|
echo "To uninstall, do cd ./lauging-hipster && ./remove.sh"
|
|
echo "Make sure your home_bkup folder is present, so keep it safe in the meantime!"
|
|
echo "Install ./tools/modules/powerline-fonts and set them up in your terminal to benefit from the custom PS1 in .shell_colors"
|
|
echo ""
|
|
echo "done!"
|