-dir=/a/opt/emacs-`distro-name`
-dir+=`debian-archive` ||: # we may not be on debian
-
-if [[ ! -e $dir ]]; then
- e cp -ar /a/opt/emacs $dir
- recompile=true
+dir=/a/opt/emacs-$(distro-name)$(distro-num)
+last_build=$dir/iank-emacs-build
+
+# e/e because autofs failing to mount will make it so
+# you cant ls whatever directory it is in, so we
+# need an extra directory. i dunno why this was like this instead of just $dir-nox.
+#dirs=($dir $dir-nox/.iank/e/e)
+
+dirs=($dir $dir-nox)
+
+m cd /a/opt/emacs
+
+if [[ -e $dir ]]; then
+ m cd $dir
+ rev=$(cat $last_build 2>/dev/null) ||:
+ head=$(git rev-parse HEAD)
+ if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
+ echo "already compiled"
+ installed_info=$(file -b $(readlink -f $(type -P emacs)))
+ build_info=$(file -b $dir/src/emacs)
+ if [[ $installed_info == "$build_info" ]]; then
+ echo "already installed exiting"
+ # this isn't perfect, because install could partially fail or the
+ # command after it could
+ exit 0
+ fi
+ fi
+ if [[ $rev != "$head" ]]; then
+ bootstrap=true
+ fi
+else
+ head=$(git rev-parse HEAD)
+ bootstrap=true