parent
0e96076c3a
commit
3df045d687
@ -1,23 +1,45 @@
|
||||
#!/bin/bash
|
||||
IFS='\n\t'
|
||||
set -euo pipefail
|
||||
|
||||
source=$(pwd)
|
||||
bkup=~/dotfile_bkup
|
||||
bkup=~/home_bkup/
|
||||
dest=~
|
||||
|
||||
|
||||
mkdir -p $bkup
|
||||
echo "making a backup of old dotfiles into ${bkup}"
|
||||
ls -A ${dest} | grep ^\\..* | xargs -I file cp ~/file ${bkup}/file
|
||||
echo "making a backup of old dotfiles into ${bkup}..."
|
||||
rm -rf ${bkup}
|
||||
mkdir -p ${bkup}
|
||||
|
||||
IFS=$'\n'
|
||||
for file in $(ls -lA "${source}" | grep "^-" | awk '{print $9}'); do
|
||||
if [ -f "${dest}/${file}" ]; then
|
||||
cp -v "${dest}/${file}" "${bkup}/${file}"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "loading modules"
|
||||
echo ""
|
||||
echo "loading git modules..."
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
echo "linking dotfiles from ${source} into ${dest}"
|
||||
cd ${dest}
|
||||
ls -A ${source} | xargs -I file cp --symbolic-link -r ${source}/file ${dest}
|
||||
|
||||
rm -rf ~/.git
|
||||
rm -rf ~/bootstrap.sh
|
||||
echo "copying directories..."
|
||||
cp -rs ${source}/tools ${dest}/tools
|
||||
|
||||
pushd ${dest} 2>&1 /dev/null
|
||||
echo "linking dotfiles from ${source} into ${dest}..."
|
||||
ls -lA "${source}" | grep "^-" | awk '{print $9}' | xargs -I file ln -vfs "${source}/file" "${dest}/file"
|
||||
|
||||
#set +u
|
||||
#curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
|
||||
#set -u
|
||||
|
||||
echo "cleaning up..."
|
||||
# cleanup
|
||||
rm -rf ${dest}/bootstrap.sh
|
||||
rm -rf ${dest}/.git
|
||||
|
||||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
|
||||
popd 2>&1 /dev/null
|
||||
|
||||
source ~/.profile
|
||||
echo "done!"
|
||||
|
Loading…
Reference in new issue