-# need an extra directory
-dirs=($dir $dir-nox/.iank/e/e)
-
-m cd $dir
-
-rev=$(cat $last_build 2>/dev/null) ||:
-head=$(git rev-parse HEAD)
+# 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 $(readlink -f $(type -P emacs)))
+ build_info=$(file $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
+fi