aboutsummaryrefslogtreecommitdiff
path: root/gentoo/install
blob: 09b2efd3a62b7218a68b644d8b88944b62232fb8 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

mv ~/.update-home.log ~/.update-home.log.old

if ! test -d ~/.dotfiles; then
    echo Installing dotfiles...
    git clone git@git.sr.ht:~jjanzen/.dotfiles ~/.dotfiles >> ~/.update-home.log
fi

CWD=$(pwd)
cd ~/.dotfiles || exit

{
    git stash
    git checkout main
    git pull --rebase
} >> ~/.update-home.log

if ! diff ~/.dotfiles/install ~/.local/bin/update-home >> ~/.update-home.log; 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.
   chmod +x ~/.local/bin/update-home
   ~/.local/bin/update-home
   exit
fi

echo Installing configuration files...
find -- . -type f -name "*.org" | while read -r file; do
    emacs --batch "${file}" -f package-initialize --eval '(org-babel-tangle)' >> ~/.update-home.log
done

echo Installing wallpaper...
cp .wallpaper ~/.wallpaper

fonts_changed=false
if ! test -d ~/.local/share/fonts/ComputerModern; then
    echo Computer Modern font missing. Installing...
    tar xf ~/.dotfiles/.local/share/fonts/ComputerModern.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log
    fonts_changed=true
fi
if ! test -f ~/.local/share/fonts/NFM.ttf; then
    echo Nerd Font Mono font missing. Installing...
    tar xf ~/.dotfiles/.local/share/fonts/NFM.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log
    fonts_changed=true
fi
if ! test -d ~/.local/share/fonts/SauceCodePro; then
    echo Source Code Pro Nerd Font missing. Installing...
    tar xf ~/.dotfiles/.local/share/fonts/SauceCodePro.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log
    fonts_changed=true
fi

if [ $fonts_changed = true ]; then
    echo Updating the font cache...
    fc-cache -f >> ~/.update-home.log
fi

cd "${CWD}" || exit