aboutsummaryrefslogtreecommitdiff
path: root/install
blob: 8c7d7049cab5bfdab0d5ee1124d8c70df19845a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

# install the dotfiles source if it is not present
if ! test -d ~/.dotfiles; then
    echo Installing dotfiles...
    git clone git@git.sr.ht:~jjanzen/.dotfiles ~/.dotfiles
fi

# save the current working directory and move to the dotfiles repository
CWD=$(pwd)
cd ~/.dotfiles || exit
git stash
git checkout main
git pull --rebase

# Install new install script and run it instead of this
if ! diff ~/.dotfiles/install ~/.local/bin/update-home; then
   cp ~/.dotfiles/install ~/.local/bin/update-home || exit 1
   echo Changes have been made to the install script.
   echo Running the new install script.
   ~/.local/bin/update-home
   exit
fi

# install config files
find -- * -type f -name "*.org" | while read -r file; do
    echo Installing "${file}" configuration...
    emacs --batch "${file}" -f package-initialize --eval '(org-babel-tangle)'
done

cd "${CWD}" || exit