-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-clone
executable file
·222 lines (196 loc) · 5.36 KB
/
post-clone
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
set -u
# Use "real" symlinks on Windwoes/cygwin.
# Set this unconditionally since it shouldn't hurt in a real environment.
# NB this doesn't work in a "Git Bash" since that is a minGW app, not cygwin.
export CYGWIN="winsymlinks:nativestrict"
EZEC=
:${existing_link_action:=}
: ${default_parent:=dpw}
: ${default_repo:=dpw/dpw}
while (($# > 0 ))
do
case "$1" in
-n) EZEC="echo - ";;
-r|--repo) shift; repo="$1";;
-d|--default-repo) repo="${default_repo}";;
-.|--here|--dpw-dot|--dot) repo=$(basename ${PWD});;
-x) set -x;;
--) shift; break;;
*) break;;
esac
shift
done
: ${repo:="${default_parent}/$(basename ${PWD})"}
echo "1: repo>${repo}<"
case "${repo}" in
/*) repo=$(./dp-realpath -R ${HOME} ${repo});;
*) ;;
esac
echo "2: repo>${repo}<"
: ${reporc:=${repo}/.rc}
${EZEC} cd "${HOME}" || {
echo "Cannot cd to home>${HOME}<"
exit 1
} 1>&2
echo "Putting links in $(pwd)"
safe_ln()
{
local src="${1}"; shift
local dest="${1}"; shift
{
[ -e "${dest}" -o -L "${dest}" ] && {
echo "Problem in safe_ln ${src} ${dest}"
}
[ -e "${dest}" ] && {
[ -L "${dest}" ] || {
echo "${dest} exists and is not a symlink. "
return 1
}
echo "${dest} exists and is a symlink."
if [ "${existing_link_action}" = "replace" ]
then
echo " \`-Removing and will remake link."
${EZEC} rm -f "${ln_dir}"
else
echo " \`-Leaving link alone."
return 0
fi
}
} 1>&2
${EZEC} ln -s "${src}" "${dest}"
}
ln_dotrc()
{
for fuckyou in "$@"
do
safe_ln ".rc/${fuckyou}" ".${fuckyou}"
done
}
repo_ln()
{
for eatshit in "$@"
do
local src="${repo}/${eatshit}"
local dest=$(basename "${src}")
safe_ln "${repo}/${eatshit}" "${dest}"
done
}
cd "${HOME}"
safe_ln "${repo}/DOTrc" .rc
# This should be compatible with exuberant-ctags since universal-ctags is the
# resurrection of exuberant-ctags.
safe_ln ".rc/universal-ctags.conf" .ctags
repo_ln \
bin \
bin.exp \
bin.primitive \
yokel \
etc \
lib \
lisp \
xf86 \
patches
ln_dotrc \
alias \
gdbinit \
gitconfig \
gitignore \
go \
inputrc \
lessrc \
muttrc \
mutt-colors \
mutt-aliases \
screenrc \
vimrc \
exrc \
bash_logout \
go.home \
mailrc \
ipython \
password-store
#
# Reference all of the bash_completion code.
#BASH_COMPLETION_DIR=.bash_completion.d
#RC_BASH_COMPLETION_DIR=.rc/DOTbash_completions.d
#SYS_BASH_COMPLETION_DIR=/usr/share/bash-completion
#[ -d "${SYS_BASH_COMPLETION_DIR}" ] && {
## This doesn't allow us to put new completion scripts in the standard
## completion location. ln -s "${SYS_BASH_COMPLETION_DIR}"
## "${BASH_COMPLETION_DIR}"
#mkdir -p "${BASH_COMPLETION_DIR}"
#(
#cd "${BASH_COMPLETION_DIR}" || {
#echo 1>&2 "Could not cd to ${BASH_COMPLETION_DIR}"
#exit 1
#}
#safe_ln "${SYS_BASH_COMPLETION_DIR}"/* .
#safe_ln "../.rc/DOTbash_completions.d"/* .
#) || {
#echo 1>&2 "Could not perform all bash completion setup operations."
#exit 1
#}
#}
OEM_DIR="${HOME}/.oem-dot-files"
${EZEC} mkdir -p "${OEM_DIR}"
for f in .bash_login .bashrc .bash_profile
do
[ -h "${f}" ] && continue
oem_file_name="${OEM_DIR}/DOT${f}"
[ -e "${oem_file_name}" ] || {
${EZEC} mv "${f}" "${oem_file_name}"
}
safe_ln .rc/bashrc $f
done
safe_ln lisp .xemacs
safe_ln lisp .emacs.d
safe_ln .rc/procmailrc.vilya .procmailrc
safe_ln lisp/Makefile Makefile
${EZEC} mkdir -p var/log
# @todo XXX deprecate ~/log
safe_ln var/log log
(
cd log
${EZEC} mkdir {boot,kde,login-rc,xemacs,shell-sessions,X11}
${EZEC} mkdir auto-rotate-c5-50K
${EZEC} mkdir -p shell-sessions/home/dpanarit/log/shell-sessions
safe_ln auto-rotate-c5-50K procmail
safe_ln auto-rotate-c5-50K msmtp
)
${EZEC} mkdir -p "var/log/auto-rotate-c10-50K"
${EZEC} mkdir ipc
${EZEC} mkdir tmp
${EZEC} mkdir .screen
${EZEC} mkdir notes
droppings="droppings/bash_history \
droppings/editors/xemacs \
droppings/editors/xemacs/session-auto-saves.d \
droppings/editors/xemacs/tramp.d \
droppings/editors/xemacs/tramp.d/auto-saves.d \
droppings/editors/xemacs/xebacs.d \
droppings/editors/xemacs/ephemeral.d \
droppings/editors/xemacs/auto-saves.d \
droppings/persist/gdb_history \
droppings/persist/emacs-history"
for dropping in ${droppings}
do
${EZEC} mkdir -p "${dropping}"
done
echo 'Other new Linux installation actions:
0) If a *buntu installation, run newbuntu-pkgs.
1) samba: I need to find the old instructions for this.
2) kernel core pattern:
To /etc/sysctl.conf, add: kernel.core_pattern = %e-p:%p,u:%u,s:%s,t:%t.CR
3) in ~/bin/src, make
4) In ~/.config/openbox:
4.1) ln -s ~/.rc/openbox-rc.xml to lubuntu-rc.xml
4.2) ln -s lubuntu-rc.xml rc.xml
5) Use [Menu-thing-on-left]->Preferences->Default applications for LXSession
to set up default applications for LXSession.
6) If using LXDE, et. al., change the keyboard input methods Next Input
Method mapping from C-<space> to something else because that collides with
XEmacs C-SPC (dp-expand-abbrev).
7) Any location dependent stuff? E.g. ~/bin.<place-of-work>
'
echo "TODO! Try to link ~/.rc/xxx.<host> and then ~/.rc/xxx into ~"