blob: 785bb30a645025664968eb1f9470c7192a88afde (
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
|
#!/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" \
-a -e "$HOME/src/dotfiles/$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 restow .
if command -v git >/dev/null; then
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
# Ensure 'git push-all' non-force pushes master to origin.
git config --unset branch.master.pushRemote ||:
# Ensure 'git push-all' force pushes localhost's branch to origin.
git config branch."$(hostname | sed -e 's#\..*$##')".pushRemote 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 local/mutt \
-type d -empty -delete 2>/dev/null ||:
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/big local/pub local/auth .emacs.d/auto-saves .emacs.d/backups \
local/src local/bin local/lib local/log local/tmp local/info
chmod -R u+rwX,go= local/auth .emacs.d/auto-saves .emacs.d/backups
|