-
Notifications
You must be signed in to change notification settings - Fork 3
/
link
executable file
·172 lines (154 loc) · 4.79 KB
/
link
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/sh
set -eu
case `uname` in
MINGW*|CYGWIN*)
echo >&1 "don't run this on Windows; use link.bat instead"
exit 1;;
esac
cd `dirname "$0"`
PWD=${PWD-`pwd`}
PATH=home/sbin:$PATH
link_home() {
source=$PWD/home/$1
destdir=${2-`dirname "$HOME/$1"`/}
mkdir -p "$destdir"
path=`relpath "$source" "$destdir"`
ln -fs "$path" "$destdir"
printf "%s\n" "$path --> $destdir"
}
link_home_systemd() {
name=$1
mkdir -p "$HOME/.config/systemd/user"
echo "# automatically generated by config/link" \
>"$HOME/.config/systemd/user/$name"
sed "s:{{HOME}}:$HOME:" \
"home/.config/systemd/user/$name" \
>>"$HOME/.config/systemd/user/$name"
printf "%s\n" "[systemd user] $name"
}
bundle_home() {
source=$PWD/home/$1
dest=$HOME/$1
comment=${2-\#}
if [ -f "$dest" ] && [ ! -d "$dest".d ]; then
echo >&2 "error: $dest already exists; must move config to ${dest}.d/"
exit 1
fi
mkdir -p "$dest".d
rm -f "$dest"
{
printf "%s\n" "${comment} automatically generated from .d"
cat "$source"
for f in "$dest".d/*; do
[ -f "$f" ] || continue
printf "# %s\n" "$f"
cat "$f"
done
} >"$dest"
chmod a-w "$dest"
printf "%s\n" ".d + $1 --> $dest"
}
link_home_systemd backup.service
link_home_systemd backup.timer
link_home_systemd ssh-agent.service
link_home_systemd [email protected]
mkdir -p \
"$HOME/.cache/makepkg/pkg" \
"$HOME/.cache/makepkg/src" \
"$HOME/.cache/makepkg/srcpkg" \
"$HOME/.local/bin"
ln -fs /usr/bin/xfce4-terminal "${HOME}/.local/bin/term"
link_home .bashrc
link_home .bash_profile
link_home .clang-format
link_home .config/fontconfig/conf.d/10-hinting-none.conf
link_home .config/dunst/dunstrc
link_home .config/git/attributes
bundle_home .config/git/config
link_home .config/git/ignore
link_home .config/mypy
link_home .config/user-dirs.dirs
link_home .config/xfce4/terminal
link_home .config/xmobar/xmobarrc
link_home .config/yay
link_home .emacs.d/elisp/adwaita-custom-theme.el
link_home .emacs.d/elisp/solarized-custom-theme.el
link_home .emacs.d/elisp/tango-dark-custom-theme.el
link_home .emacs.d/elisp/wombat-custom-theme.el
link_home .emacs.d/init.el
link_home .gdbinit
link_home .ghci
link_home .gtkrc-2.0
link_home .i3/config
link_home .local/share/applications/mimeapps.list
link_home .local/opt
link_home .muttrc
link_home .profile
link_home .Rprofile
link_home .tmux.conf
link_home .ttytterrc
link_home .xbindkeysrc
link_home .XCompose
link_home .xinitrc
link_home .xmonad/xmonad.hs
link_home .Xresources
link_home .zprofile
link_home .zshrc
link_home sbin "$HOME/.local/"
ln -fs ../../stuff/emacs-rustdoc-theme/rustdoc-theme.el "$HOME/.emacs.d/elisp"
groups "$USER" | grep >/dev/null 2>&1 '\bwheel\b' ||
groups "$USER" | grep >/dev/null 2>&1 '\bsudo\b' ||
exit 0
sudo sh <<EOF
set -e
mkdir -p /root/.emacs.d
cp -f home/.emacs.d/init.el /root/.emacs.d/
cp -f home/.bashrc /root/
cp -f home/.bash_profile /root/
cp -f home/.profile /root/
cp -f home/.zshrc /root/
cp -f home/.Rprofile /root/
echo "$PWD/home/ --> /root/"
uname -a | grep arch >/dev/null 2>&1 ||
exit 0
link_root() {
source=$PWD/root/\$1
destdir=/\${2-\`dirname "\$1"\`/}
[ -f "/\$1.preserve" ] && return
mkdir -p "\$destdir"
cp -fr "\$source" "\$destdir"
printf "%s\n" "\$source --> \$destdir"
}
patch -d/ -N -p0 -r- <root/etc/inputrc.patch || :
patch -d/ -N -p0 -r- <root/etc/makepkg.conf.patch || :
patch -d/ -N -p0 -r- <root/etc/pacman.conf.patch || :
patch -d/ -N -p0 -r- <root/etc/pacman.d/gnupg/gpg.conf.patch || :
ln -fs ../conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/
link_root bin/conmon usr/local/bin/
link_root bin/touchpad-ctl usr/local/bin/
link_root bin/smartdnotify usr/local/bin/
link_root etc/locale.conf
link_root etc/locale.gen
link_root etc/modprobe.d/nobeep.conf
link_root etc/modules-load.d/ppp_mppe.conf
link_root etc/pam.d/su
link_root etc/ppp/ip-up.d/01-routes.sh
link_root etc/security/faillock.conf
link_root etc/security/limits.d/99-nocoredump.conf
link_root etc/sysctl.avail/30-ip-forward.conf
link_root etc/sysctl.avail/99-sysrq.conf
link_root etc/systemd/logind.conf.d/50-ignore-lid-switch.conf
link_root etc/systemd/system/[email protected]
link_root etc/systemd/system/[email protected]
link_root etc/systemd/system/[email protected]
link_root etc/systemd/system/[email protected]
link_root etc/udev/rules.d/01-touchpad.rules
link_root etc/udev/rules.d/60-schedulers.rules
link_root etc/X11/xorg.conf.d/10-monitor.conf
link_root etc/X11/xorg.conf.d/50-compose-key.conf
link_root etc/X11/xorg.conf.d/50-mouse-acceleration.conf
link_root etc/X11/xorg.conf.d/50-natural-scroll.conf
link_root etc/X11/xorg.conf.d/50-palm-detect.conf
link_root etc/X11/xorg.conf.d/60-composite.conf
link_root usr/share/i18n/locales/en_FYL
EOF