ghfw-build-extra/git-extra/git-extra.install

116 строки
3.1 KiB
Plaintext

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
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
GITATTRIBUTES
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\nSigLevel = Optional\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
}
}
post_upgrade () {
post_install
}