summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/doinst.sh
blob: ebb76cc20978fd899b76a0d1a819766ea7752deb (plain) (blame)
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
#!/bin/bash
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
config usr/share/vim/vimrc.new

# Responding to a report that in some cases the file
# /usr/share/vim/vim90/defaults.vim must be edited in order to change settings
# (some settings in the file will otherwise override those in
# /usr/share/vim/vimrc), we will support a file in the same directory named
# defaults.vim.custom. If this file exists, then it will replace the shipped
# version of defaults.vim. The original file will be preserved as
# defaults.vim.orig.
if [ -r usr/share/vim/vim90/defaults.vim.custom ]; then
  cp -a usr/share/vim/vim90/defaults.vim usr/share/vim/vim90/defaults.vim.orig
  cp -a usr/share/vim/vim90/defaults.vim.custom usr/share/vim/vim90/defaults.vim
fi