# Get it
cd
test -f installed/unison-2.40.102.tar.gz &&
mv -f installed/unison-2.40.102.tar.gz .
test ! -f unison-2.40.102.tar.gz &&
wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/\
unison-2.40.102.tar.gz
# Extract it
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "unison-*" -exec rm -r {} \;
tar xzvf ~/unison-2.40.102.tar.gz
cd unison-2.40.102
test $UID = 0 && chown -R root:root .
# Build the text-based unison program
# (you can ignore the etags error at the end if you don't have emacs)
make UISTYLE=text
# Install it somewhere in your $PATH
# Add -s if you want to strip symbol tables to make the binary smaller
install -m 755 unison /usr/local/bin/
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/unison-*.tar.*
mv unison-2.40.102.tar.gz installed/
# If you ever want to uninstall Unison, this should do it:
cd
su -c "rm -f /usr/local/bin/unison"
exit
find ~/src -maxdepth 1 -type d -name "unison-*" -exec rm -r {} \;
rm -f ~/installed/unison-*.tar.*