-
Notifications
You must be signed in to change notification settings - Fork 613
/
Copy pathgit-extra.install
204 lines (174 loc) · 6.12 KB
/
git-extra.install
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
export LC_ALL=C
post_install () {
for dir in mingw32 mingw64
do
test ! -d /$dir ||
test -f /$dir/etc/gitconfig ||
cat > /$dir/etc/gitconfig <<\GITCONFIG
[core]
symlinks = false
autocrlf = true
[color]
diff = auto
status = auto
branch = auto
interactive = true
[pack]
packSizeLimit = 2g
[help]
format = html
[http]
sslCAinfo = /ssl/certs/ca-bundle.crt
[diff "astextplain"]
textconv = astextplain
[rebase]
autosquash = true
GITCONFIG
test ! -d /$dir ||
test -f /$dir/etc/gitattributes ||
cat > /$dir/etc/gitattributes <<\GITATTRIBUTES
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.docm diff=astextplain
*.DOCM diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.dotm diff=astextplain
*.DOTM diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.ods diff=astextplain
*.ODS diff=astextplain
*.odf diff=astextplain
*.ODF diff=astextplain
*.odt diff=astextplain
*.ODT diff=astextplain
GITATTRIBUTES
grep -q '^\*\.docm' /$dir/etc/gitattributes ||
sed -i -e 's/^\*\.DOCX\(.*\)/&\n*.docm\1\n*.DOCM\1/' \
-e 's/^\*\.DOT\(.*\)/&\n*.dotm\1\n*.DOTM\1/' \
/$dir/etc/gitattributes
# Drop git-wrapper in place of builtins "to save space"
git_wrapper=/$dir/share/git/git-wrapper.exe
if test -f $git_wrapper &&
! cmp -s $git_wrapper /$dir/bin/git-receive-pack.exe
then
for b in $(cat /$dir/share/git/builtins.txt)
do
rm /$dir/libexec/git-core/$b &&
ln $git_wrapper /$dir/libexec/git-core/$b
if test -x /$dir/bin/$b
then
rm /$dir/bin/$b &&
ln $git_wrapper /$dir/bin/$b
fi
done
fi
done
grep -q '^db_home: env windows' /etc/nsswitch.conf ||
sed -i 's/^\(db_home: \)\(windows \)\?\([^w]\)/\1env windows \3/' \
/etc/nsswitch.conf
! grep -q '^db_shell: [^#]*cygwin' /etc/nsswitch.conf ||
sed -i 's/^\(db_shell: \)\(env \)\?\(windows \)\?/\1env windows # /' \
/etc/nsswitch.conf
! grep -q '^db_gecos: [^#]*\(cygwin\|windows\)' /etc/nsswitch.conf ||
sed -i 's/^\(db_gecos: \)\(env \)\?\([^e]\)/\1env # \3/' \
/etc/nsswitch.conf
! grep -q '^group: [^#]*db' /etc/nsswitch.conf ||
sed -i 's/^\(group: \)\(.* \)\?\(db\)/\1\2# \3/' \
/etc/nsswitch.conf
! grep -q '^PS1=' /etc/bash.bashrc ||
sed -i 's/^PS1=/#&/' /etc/bash.bashrc
grep -q '^# Fixup git-bash in non login env' /etc/bash.bashrc ||
printf "\n# Fixup git-bash in non login env\nshopt -q login_shell || . /etc/profile.d/git-prompt.sh\n" >> /etc/bash.bashrc
grep -q git-for-windows[^-] etc/pacman.conf ||
sed -i -e '/^\[mingw32\]/i[git-for-windows]\nServer = https://dl.bintray.com/$repo/pacman/$arch\n' etc/pacman.conf
! grep -A2 git-for-windows[^-] etc/pacman.conf |
grep -q '^SigLevel = Optional' ||
sed -i -e '/\[git-for-windows\]/{N;N;s/\nSigLevel = Optional//}' \
etc/pacman.conf
uname_m="$(uname -m)"
test i686 = "$uname_m" ||
grep -q git-for-windows-mingw32 etc/pacman.conf ||
sed -i -e '/^\[mingw32\]/i[git-for-windows-mingw32]\nServer = https://dl.bintray.com/git-for-windows/pacman/i686\n' etc/pacman.conf
test x86_64 = "$uname_m" ||
grep -q git-for-windows-mingw64 etc/pacman.conf ||
sed -i -e '/^\[mingw32\]/i[git-for-windows-mingw64]\nServer = https://dl.bintray.com/git-for-windows/pacman/x86_64\n' etc/pacman.conf
test i686 != $"uname -m" ||
case "$(md5sum.exe < /msys2.ico)" in
292ad5cd*) cp /usr/share/git/msys2-32.ico /msys2.ico;;
esac
test ! -f /etc/post-install/05-home-dir.post ||
rm /etc/post-install/05-home-dir.post
grep -qw usertemp /etc/fstab ||
sed -i '$a\
none /tmp usertemp binary,posix=0,noacl 0 0' /etc/fstab
grep -qw usertemp.*noacl /etc/fstab ||
sed -i '$s/^none \/tmp usertemp [^ ]*/&,noacl/' /etc/fstab
! grep -q '^export TERM=' /etc/profile ||
sed -i 's/^export TERM=/test -n "$TERM" || &/' /etc/profile
! grep -q ' $1 == ~\* ' /usr/share/bash-completion/bash_completion ||
sed -i 's/\( \$1 == \|printf -v \$2 \)\(~\* \|~%q \)/\1\\\2/' \
/usr/share/bash-completion/bash_completion
! grep -qi '^TMP=' /etc/profile ||
sed -i 's/^TE\?MP=/#&/i' /etc/profile
! grep -q '^unset TMP' /etc/profile ||
sed -i 's/^unset TMP/#&/' /etc/profile
grep -q '^test -d "$TMPDIR"' /etc/profile || {
if lineno="$(grep -n '^#TEMP=' /etc/profile)"
then
lineno=${lineno%%:*}
else
lineno='$'
fi
sed -i "$lineno"'a\
case "$TMP" in *\\\\*) TMP="$(cygpath -m "$TMP")";; esac\
case "$TEMP" in *\\\\*) TEMP="$(cygpath -m "$TEMP")";; esac\
test -d "$TMPDIR" || test ! -d "$TMP" || {\
TMPDIR="$TMP"\
export TMPDIR\
}\
' /etc/profile
}
grep -q 'case "\${MSYS2_PATH_TYPE:-inherit}"' /etc/profile ||
sed -i 's/{MSYS2_PATH_TYPE:-[^}]*}/{MSYS2_PATH_TYPE:-inherit}/g' \
/etc/profile
! grep -qw PERL_PATH /etc/profile.d/perlbin.sh 2>/dev/null ||
sed -i 's/PERL_PATH/PERL_PATH_EXTRA/g' /etc/profile.d/perlbin.sh
! grep -q '^# Define default printer' /etc/profile ||
sed -i -e '/^# Define default printer/,/^$/d' \
-e 's/^\(export .* \)PRINTER /\1/' /etc/profile
! grep -A3 '^ *autocmd BufReadPost \*' \
/usr/share/vim/vim80/defaults.vim |
grep -q ' exe "normal! g`\\""' ||
sed -i -e '/^ *autocmd BufReadPost \*/,/\\ endif$/s/^/"/' \
/usr/share/vim/vim80/defaults.vim
! grep -q '^if .*command -v getent' /etc/bash.bashrc ||
sed -i '/^if .*command -v getent/,/^fi/s/^/#/' /etc/bash.bashrc
# Ensure that Git for Windows' GPG keyring is still imported
pacman-key --list-keys BB3AA74136C569BB >/dev/null ||
pacman-key --populate git-for-windows
# .bat files in /mingw{32,64}/bin are non-portable because they
# typically contain absolute paths
find /mingw*/bin/ -name \*.bat -exec rm {} \;
# absolute paths in the she-bang lines must be POSIX paths, not
# Windows paths, otherwise the SDK won't be portable
root="$(cygpath -am / | sed 's/\/$//')" &&
rootw="$(echo "$root" | sed "s/\//\\\\&/g")" &&
for s in $(grep -l "#\!$root/" $(find /mingw*/bin/ -size -17k -type f))
do
sed -i "1s/#\!$rootw/#\!/" $s || break
done
# Re-enable at least AES256-cbc and AES128-cbc, as they are still used
# e.g. in VSTS
grep -q '^Ciphers .*aes256-cbc,aes192-cbc' /etc/ssh/ssh_config ||
sed -i -e '/^[# ]*Ciphers /{s/^# *//;s/$/,aes256-cbc,aes192-cbc/}' \
/etc/ssh/ssh_config
}
post_upgrade () {
post_install
}