blob: 7d729ff3947309e0be4a98d6a804307cf2f47ee5 (
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
|
#!/bin/sh
# Bootstrap home directory after dotfiles repository successfully cloned (see
# INSINUATE-DOTFILES Consfigurator property and 'insinuate-dotfiles' script).
# This script should be POSIX sh and idempotent. This is the 'mr fixups'
# action for src/dotfiles, here rather than in src/dotfiles/lib-src/mr/config
# so that we can run it even if we don't have a Perl interpreter.
set -e
cd "$HOME/src/dotfiles"
if [ -d /etc/skel ]; then
cd /etc/skel
for file in $(find . -type f); do
[ -e "$HOME/$file" -a ! -h "$HOME/$file" ] \
&& cmp "$file" "$HOME/$file" >/dev/null && rm "$HOME/$file"
done
cd "$HOME/src/dotfiles"
fi
# On Debian systems root gets a special .bashrc and .profile.
for f in bashrc profile; do
[ -e /usr/share/base-files/dot.$f \
-a -e "$HOME/.$f" -a ! -h "$HOME/.$f" ] \
&& cmp /usr/share/base-files/dot.$f "$HOME/.$f" >/dev/null \
&& rm "$HOME/.$f"
done
# These will often end up created by, e.g., insinuate-dotfiles.
# Remove them so that the initial stow will not involve any conflicts.
for f in gpg.conf gpg-agent.conf dirmngr.conf .gpg-v21-migrated; do
[ -h "$HOME/.gnupg/$f" ] || rm -f "$HOME/.gnupg/$f"
done
bin/hstow stow .
if command -v git >/dev/null; then
# Use a rebase workflow as I'm the only committer.
git config pull.rebase true
git config user.signingkey 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B
# Pushing and pulling are always done explicitly.
for branch in $(git for-each-ref \
--format='%(refname:short)' refs/heads/); do
git rev-parse "$branch"@{upstream} >/dev/null 2>&1 \
&& git branch --unset-upstream "$branch"
done
git config push.default nothing
# This is just for `magit-status'.
git config remote.pushDefault origin
# Don't set up any tracking branches, or fetch it.
[ -z "$(git remote)" ] \
&& git remote add origin https://git.spwhitton.name/dotfiles
# Non-POSIX cleanup: eventually drop.
rm -f .git/hooks/post-checkout{,_01gpgsign}
find bin lib/aid lib/backup lib/perl5 lib/hooks lib/athena lib/bins \
lib/img lib/mr lib/src local/anacron/spool -type d -empty -delete \
2>/dev/null ||:
# Eventually move to 'if ! [ "$MR_ACTION" = fixups ]; then' part, above.
bin/install-git-hooks dotfiles
fi
cd "$HOME"
[ -e .mrconfig ] || cat >.mrconfig <<EOF
# -*- mode: conf -*-
include = cat ~/src/dotfiles/lib-src/mr/config
EOF
mkdir -p .ssh tmp src lib mnt \
local/mutt local/big local/pub local/auth \
local/src local/bin local/lib local/log local/tmp local/info
chmod -R u+rwX,go= local/auth
|