aboutsummaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2023-08-23 15:56:49 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2023-08-23 15:56:49 +0200
commiteffd08ba3063cde8427fc32909efa657d5a1f3bc (patch)
tree75361076ba3f6da342a1a954a31fa4e82e516422 /install.sh
parentfd2b64565c0030f3cd9235f3b2c75f2f7603aa97 (diff)
downloaddotfiles-effd08ba3063cde8427fc32909efa657d5a1f3bc.tar.gz
dotfiles-effd08ba3063cde8427fc32909efa657d5a1f3bc.zip
Updated install script and fixed outdated config
After trying up this whole thing on a fresh VM I got into a lot of old stuff that needed some updating (e.g. GNU Emacs' configuration which is now handled through Doom). Other than that, I have also added a few goodies when I'm using this on a VM, like a proper size for the TTY. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh53
1 files changed, 30 insertions, 23 deletions
diff --git a/install.sh b/install.sh
index cb92d47..8c5f3e8 100755
--- a/install.sh
+++ b/install.sh
@@ -17,18 +17,15 @@
set -e
##
-# First some checks: we need GNU Emacs and Vim because we are going to
-# initialize them right after installing their files.
-
-if ! [ -x "$(command -v emacs)" ]; then
- echo 'Error: GNU Emacs is not installed.' >&2
- exit 1
-fi
-
-if ! [ -x "$(command -v vim)" ]; then
- echo 'Error: Vim is not installed.' >&2
- exit 1
-fi
+# Let's ask for some dependencies and nice-to-have binaries.
+
+binaries=(git curl vim emacs)
+for bin in "${binaries[@]}"; do
+ if ! [ -x "$(command -v ${bin})" ]; then
+ echo "Error: the binary '${bin}' is not installed." >&2
+ exit 1
+ fi
+done
##
# Main procedure: link as many files as possible.
@@ -52,7 +49,7 @@ done
# And now let's go for the exceptional cases.
# Link the global.gitignore file
-rm "${HOME:?}/.gitignore"
+rm -rf "${HOME:?}/.gitignore"
ln -s "$(readlink -f .global.gitignore)" "${HOME:?}/.gitignore"
# Copy entries of some of the directories inside of maybe existing ones.
@@ -61,16 +58,21 @@ for i in .config .gnupg; do
cp -r "$i"/* "${HOME:?}/$i/"
done
-# GNU Emacs: most files can be simply linked, the only exception being
-# init.el. To know why check .emacs.d/README.org.
-mkdir -p "${HOME:?}/.emacs.d"
-for i in abbrevs.el early-init.el lisp org-templates snippets custom.el gtkrc init.org; do
- rm -rf "${HOME:?}/.emacs.d/$i"
- ln -s "$(readlink -f .emacs.d/$i)" "${HOME:?}/.emacs.d/$i"
-done
-rm -f "${HOME:?}/.emacs.d/init.elc"
-cp .emacs.d/init.el "${HOME:?}/.emacs.d/init.el"
-emacs -l "${HOME:?}/.emacs.d/init.el" --eval "(kill-emacs)"
+##
+# GNU Emacs: just install Doom and take it from there.
+
+rm -rf "${HOME:?}/.doom.d"
+ln -s "$(readlink -f .doom.d)" "${HOME:?}/.doom.d"
+
+if [ -d "${HOME:?}/.config/emacs" ]; then
+ if [ -x "$(command -v doom)" ]; then
+ doom upgrade
+ fi
+else
+ git clone https://github.com/hlissner/doom-emacs "${HOME:?}/.config/emacs"
+fi
+
+"${HOME:?}/.config/emacs/bin/doom" install
# i3 has a slightly different configuration on my workstation and on the laptop.
cp -r .i3 "${HOME:?}"
@@ -79,6 +81,11 @@ cp -r .i3status.conf "${HOME:?}"
##
# Other stuff
+# Get git completiom right.
+if ! [ -f "${HOME:?}/.git-prompt.sh" ]; then
+ curl -o "${HOME:?}/.git-prompt.sh" https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
+fi
+
# Initialize Vim plugins.
vim +PluginInstall +qall