blob: ddb9dc172791d84e4d6485cccdc0adb764f3f2da (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/bin/sh
echo 'backing up previous log file to ~/.update-home-old.log'
mv ~/.update-home.log ~/.update-home-old.log >> /dev/null 2>&1
if ! test -d ~/.dotfiles; then
echo '.dotfiles should be at ~/.dotfiles; reinstalling dotfiles at ~/.dotfiles...'
git clone git@git.sr.ht:~jjanzen/.dotfiles ~/.dotfiles >> ~/.update-home.log 2>&1
fi
echo 'retrieving the latest changes (any unmerged local changes will be stashed)...'
{
git stash
git checkout main
git pull --rebase
} >> ~/.update-home.log 2>&1
CWD=$(pwd)
if [ "$(uname)" = 'Darwin' ]; then
echo 'detected Mac OS; installing Mac OS configuration...'
cd ~/.dotfiles/macos/ || exit
elif [ "$(uname)" = 'Linux' ] && grep -q 'ID=nixos' /etc/os-release; then
echo 'detected NixOS; installing NixOS configuration...'
cd ~/.dotfiles/nixos/ || exit
else
echo 'unsupported operating system'
exit 1
fi
echo 'installing configuration files...'
find -L -- . -type f -name "*\.org" | while read -r file; do
echo " installing $file..."
emacs --batch "$file" -f package-initialize --eval '(org-babel-tangle)' >> ~/.update-home.log 2>&1
done
find -L -- . -type f -name "*\.org\.gpg" | while read -r file; do
echo " installing $file..."
gpg -d --batch "$file" 1> tmp.org 2>> ~/.update-home.log
emacs --batch tmp.org -f package-initialize --eval '(org-babel-tangle)' >> ~/.update-home.log 2>&1
rm tmp.org
done
echo 'installing wallpaper...'
cp .wallpaper ~/.wallpaper
if [ "$(uname)" = 'Darwin' ]; then
osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"/$HOME/.wallpaper\" as POSIX file"
fi
if [ "$(uname)" = 'Linux' ] && grep -q 'ID=nixos' /etc/os-release; then
echo 'installing NixOS flake'
sudo nixos-rebuild switch --flake './flake#nixos'
fi
fonts_changed=false
if [ "$(uname)" = 'Darwin' ]; then
echo 'installing fonts...'
mkdir -p ~/.local/share/fonts
if ! test -d ~/.local/share/fonts/ComputerModern; then
echo ' Computer Modern font missing. Installing...'
tar xf .local/share/fonts/ComputerModern.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log 2>&1
fonts_changed=true
fi
if ! test -f ~/.local/share/fonts/NFM.ttf; then
echo ' Nerd Font Mono font missing. Installing...'
tar xf .local/share/fonts/NFM.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log 2>&1
fonts_changed=true
fi
if ! test -d ~/.local/share/fonts/SauceCodePro; then
echo ' Source Code Pro Nerd Font missing. Installing...'
tar xf .local/share/fonts/SauceCodePro.tar.gz -C ~/.local/share/fonts >> ~/.update-home.log 2>&1
fonts_changed=true
fi
if [ $fonts_changed = true ]; then
echo ' updating the font cache...'
fc-cache -f >> ~/.update-home.log
fi
fi
cd "$CWD" || exit
|