Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 87 lines (64 sloc) 1.37 KB
#!/bin/sh
set -eu
cd "$(dirname "${0}")"
find -type d -empty -delete
Install_symlink () {
SOURCE="${1}"
TARGET="${2}$(basename ${SOURCE})"
if [ "$(readlink "${TARGET}")" = "${SOURCE}" ]
then
return 0
fi
if [ -d "${TARGET}" ]
then
echo "W: NOT removing directory ${TARGET}"
return 0
rm -rf "${TARGET}"
fi
ln -sfv "${SOURCE}" "${TARGET}"
}
Ensure_dir () {
DIR="${1}"
if [ -d "${DIR}" ]
then
return 0
fi
echo "I: Ensuring ${DIR} exists"
mkdir -p "${DIR}"
}
# Install dotfiles
for ENTRY in "$(pwd)"/dotfiles/*
do
Install_symlink ${ENTRY} ~/.
done
# Install files into XDG's ~/config
for FILE in "$(pwd)"/xdg/*
do
NAME="$(basename "${FILE}")"
mkdir -p ~/.config
if [ "$(readlink ~/.config/${NAME})" = "${FILE}" ]
then
continue
fi
ln -sfv -t ~/.config "${FILE}"
done
# Quick hack to get SSH working again...
case "$(cat /etc/debian_version)" in
6.*)
FILE=~/.ssh/config
rm -f ${FILE}
echo "# Not handled by dotfiles.git !!!" > ${FILE}
sed -e 's,^ControlPersist,#\0,' <"$(pwd)"/ssh/config >> ${FILE}
;;
esac
echo "I: Symlinking ~/.xsession-errors -> /dev/null"
ln -sfv /dev/null ~/.xsession-errors
echo "I: Installing crontabs"
(cd $(pwd)/crontabs && (cat __all__; cat $(hostname)* 2>/dev/null)) | crontab
Ensure_dir ~/temp
Ensure_dir ~/unfiled
if which rtorrent >/dev/null 2>&1
then
Ensure_dir ~/unfiled/torrents
fi
cd ipython && ./install