Newer
Older
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
# vim:set ts=2 sw=2 et:
# $1: the file to update
check_file() {
local p="/usr/share/config-seblu/${1##*/}"
[[ -n "$2" ]] && p="/usr/share/config-seblu/$2"
if [[ ! -e "$1" ]] || ! diff "$1" "$p" >/dev/null; then
cp -f -v "$p" "$1"
fi
}
# $1: the link target
# $2: the link himself
check_link() {
_ct="$(readlink "$2")"
if (( $? != 0 )) || [[ "$_ct" != "$1" ]]; then
ln -vsnf "$1" "$2"
fi
}
# arg 1: the new package version
post_install() {
check_file /etc/motd
check_file /etc/issue
check_file /etc/vconsole.conf
check_file /etc/locale.conf
check_file /etc/ntp.conf
check_file /etc/e2fsk.conf
check_file /etc/sysctl.d/seblu.net.conf
check_file /etc/zsh/zshrc zshrc
# enable vim config
check_file /usr/share/vim/vimfiles/seblu.vim
if ! grep -q 'runtime! seblu.vim' /etc/vimrc; then
echo '-- Updating /etc/vimrc'
echo 'runtime! seblu.vim' >> /etc/vimrc
fi
# localtime
check_link '/usr/share/zoneinfo/Europe/Paris' /etc/localtime
# locales
_md5="$(md5sum /etc/locale.gen)"
sed -ri 's/#(en_US|fr_FR)/\1/' /etc/locale.gen
[[ "$_md5" != "$(md5sum /etc/locale.gen)" ]] && locale-gen
# check full hostname
grep -q \. /etc/hostname || echo '!! /etc/hostname without FQDN'
return 0
}
# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
post_install "$1"
}