[go: up one dir, main page]

File: preinst

package info (click to toggle)
fish 1.22.1-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,408 kB
  • ctags: 2,347
  • sloc: ansic: 35,286; sh: 3,022; makefile: 554
file content (232 lines) | stat: -rw-r--r-- 12,087 bytes parent folder | download
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
223
224
225
226
227
228
229
230
231
232
#! /bin/sh
# postinst script for fish
#

set -e

rm_conffile_fishd() {
    CONFFILE="$1"

    if [ -e "$CONFFILE" ]; then
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
        if [ "$md5sum" != "$old_md5sum" ]; then
            echo "Obsolete conffile $CONFFILE has been modified by you."
            newfile="/etc/fish.d/`echo $CONFFILE | awk -F/ '{printf "%s_%s", $4, $5}'`"
            echo "Saving as $newfile.dpkg-bak ..."
            mv -f "$CONFFILE" "$newfile".dpkg-bak
        else
            echo "Removing obsolete conffile $CONFFILE ..."
            rm -f "$CONFFILE"
        fi
    fi
}

rm_conffile_fish() {
    CONFFILE="$1"

    if [ -e "$CONFFILE" ]; then
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
        if [ "$md5sum" != "$old_md5sum" ]; then
            echo "Obsolete conffile $CONFFILE has been modified by you."
            echo "Saving as $CONFFILE.dpkg-bak ..."
            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
        else
            echo "Removing obsolete conffile $CONFFILE ..."
            rm -f "$CONFFILE"
        fi
    fi
}

prep_mv_conffile() {
    CONFFILE="$1"
    SPECIAL="$2"

    if [ -e "$CONFFILE" ]; then
        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
        old_md5sum="`sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' $CONFFILE'{s/.* //;p}}\" /var/lib/dpkg/status`"
        if [ "$md5sum" = "$old_md5sum" ]; then
            rm -f "$CONFFILE"
        fi
        if [ "$SPECIAL" = "yes" ]; then
            mv "$1" "$1".dpkg-tmp
        fi
    fi
}

case "$1" in
install|upgrade)
    # The tokenize command was completely removed from fish in 1.20.0-1, so
    # tokenize.fish is useless. Remove it without prompting the user.
    rm -f /etc/fish.d/completions/tokenize.fish
    # These completions were moved to /usr/share/fish/completions.
    # /etc/fish.d/completions will still be read by fish so the admin can
    # override the settings so we'll save a backup if they've changed it.
    if dpkg --compare-versions "$2" le "1.20.2-1"; then
        rm_conffile_fishd "/etc/fish.d/completions/apm.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apropos.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-build.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-cache.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-cdrom.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-config.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-extracttemplates.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-file.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-ftparchive.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-get.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-key.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-listbugs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-listchanges.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-move.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-proxy-import.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-rdepends.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-setup.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-show-source.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-show-versions.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-sortpkgs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-spy.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-src.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-zip-inst.fish"
        rm_conffile_fishd "/etc/fish.d/completions/apt-zip-list.fish"
        rm_conffile_fishd "/etc/fish.d/completions/arp.fish"
        rm_conffile_fishd "/etc/fish.d/completions/at.fish"
        rm_conffile_fishd "/etc/fish.d/completions/atd.fish"
        rm_conffile_fishd "/etc/fish.d/completions/atq.fish"
        rm_conffile_fishd "/etc/fish.d/completions/atrm.fish"
        rm_conffile_fishd "/etc/fish.d/completions/bc.fish"
        rm_conffile_fishd "/etc/fish.d/completions/btdownloadcurses.py.fish"
        rm_conffile_fishd "/etc/fish.d/completions/btdownloadheadless.py.fish"
        rm_conffile_fishd "/etc/fish.d/completions/bunzip2.fish"
        rm_conffile_fishd "/etc/fish.d/completions/bzcat.fish"
        rm_conffile_fishd "/etc/fish.d/completions/bzip2.fish"
        rm_conffile_fishd "/etc/fish.d/completions/bzip2recover.fish"
        rm_conffile_fishd "/etc/fish.d/completions/cat.fish"
        rm_conffile_fishd "/etc/fish.d/completions/cd.fish"
        rm_conffile_fishd "/etc/fish.d/completions/chgrp.fish"
        rm_conffile_fishd "/etc/fish.d/completions/chown.fish"
        rm_conffile_fishd "/etc/fish.d/completions/chsh.fish"
        rm_conffile_fishd "/etc/fish.d/completions/commandline.fish"
        rm_conffile_fishd "/etc/fish.d/completions/complete.fish"
        rm_conffile_fishd "/etc/fish.d/completions/configure.fish"
        rm_conffile_fishd "/etc/fish.d/completions/cut.fish"
        rm_conffile_fishd "/etc/fish.d/completions/cvs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/darcs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/date.fish"
        rm_conffile_fishd "/etc/fish.d/completions/df.fish"
        rm_conffile_fishd "/etc/fish.d/completions/diff.fish"
        rm_conffile_fishd "/etc/fish.d/completions/du.fish"
        rm_conffile_fishd "/etc/fish.d/completions/echo.fish"
        rm_conffile_fishd "/etc/fish.d/completions/elatex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/emacs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/emerge.fish"
        rm_conffile_fishd "/etc/fish.d/completions/etex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/fish.fish"
        rm_conffile_fishd "/etc/fish.d/completions/function.fish"
        rm_conffile_fishd "/etc/fish.d/completions/functions.fish"
        rm_conffile_fishd "/etc/fish.d/completions/fusermount.fish"
        rm_conffile_fishd "/etc/fish.d/completions/gcc.fish"
        rm_conffile_fishd "/etc/fish.d/completions/gpg.fish"
        rm_conffile_fishd "/etc/fish.d/completions/gprof.fish"
        rm_conffile_fishd "/etc/fish.d/completions/grep.fish"
        rm_conffile_fishd "/etc/fish.d/completions/gunzip.fish"
        rm_conffile_fishd "/etc/fish.d/completions/gzip.fish"
        rm_conffile_fishd "/etc/fish.d/completions/help.fish"
        rm_conffile_fishd "/etc/fish.d/completions/id.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ifconfig.fish"
        rm_conffile_fishd "/etc/fish.d/completions/jobs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/kill.fish"
        rm_conffile_fishd "/etc/fish.d/completions/la.fish"
        rm_conffile_fishd "/etc/fish.d/completions/latex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/less.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ll.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ls.fish"
        rm_conffile_fishd "/etc/fish.d/completions/make.fish"
        rm_conffile_fishd "/etc/fish.d/completions/makedepend.fish"
        rm_conffile_fishd "/etc/fish.d/completions/man.fish"
        rm_conffile_fishd "/etc/fish.d/completions/mimedb.fish"
        rm_conffile_fishd "/etc/fish.d/completions/modprobe.fish"
        rm_conffile_fishd "/etc/fish.d/completions/mount.fish"
        rm_conffile_fishd "/etc/fish.d/completions/mplayer.fish"
        rm_conffile_fishd "/etc/fish.d/completions/mv.fish"
        rm_conffile_fishd "/etc/fish.d/completions/nextd.fish"
        rm_conffile_fishd "/etc/fish.d/completions/nice.fish"
        rm_conffile_fishd "/etc/fish.d/completions/omega.fish"
        rm_conffile_fishd "/etc/fish.d/completions/pdfelatex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/pdfetex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/pdflatex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/pdftex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/perl.fish"
        rm_conffile_fishd "/etc/fish.d/completions/pine.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ping.fish"
        rm_conffile_fishd "/etc/fish.d/completions/prevd.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ps.fish"
        rm_conffile_fishd "/etc/fish.d/completions/pushd.fish"
        rm_conffile_fishd "/etc/fish.d/completions/python.fish"
        rm_conffile_fishd "/etc/fish.d/completions/read.fish"
        rm_conffile_fishd "/etc/fish.d/completions/renice.fish"
        rm_conffile_fishd "/etc/fish.d/completions/rm.fish"
        rm_conffile_fishd "/etc/fish.d/completions/rmdir.fish"
        rm_conffile_fishd "/etc/fish.d/completions/rpm.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ruby.fish"
        rm_conffile_fishd "/etc/fish.d/completions/scp.fish"
        rm_conffile_fishd "/etc/fish.d/completions/screen.fish"
        rm_conffile_fishd "/etc/fish.d/completions/sed.fish"
        rm_conffile_fishd "/etc/fish.d/completions/service.fish"
        rm_conffile_fishd "/etc/fish.d/completions/set.fish"
        rm_conffile_fishd "/etc/fish.d/completions/set_color.fish"
        rm_conffile_fishd "/etc/fish.d/completions/sort.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ssh.fish"
        rm_conffile_fishd "/etc/fish.d/completions/sshfs.fish"
        rm_conffile_fishd "/etc/fish.d/completions/status.fish"
        rm_conffile_fishd "/etc/fish.d/completions/su.fish"
        rm_conffile_fishd "/etc/fish.d/completions/sudo.fish"
        rm_conffile_fishd "/etc/fish.d/completions/tar.fish"
        rm_conffile_fishd "/etc/fish.d/completions/test.fish"
        rm_conffile_fishd "/etc/fish.d/completions/tex.fish"
        rm_conffile_fishd "/etc/fish.d/completions/time.fish"
        rm_conffile_fishd "/etc/fish.d/completions/top.fish"
        rm_conffile_fishd "/etc/fish.d/completions/touch.fish"
        rm_conffile_fishd "/etc/fish.d/completions/trap.fish"
        rm_conffile_fishd "/etc/fish.d/completions/type.fish"
        rm_conffile_fishd "/etc/fish.d/completions/ulimit.fish"
        rm_conffile_fishd "/etc/fish.d/completions/umount.fish"
        rm_conffile_fishd "/etc/fish.d/completions/uname.fish"
        rm_conffile_fishd "/etc/fish.d/completions/uniq.fish"
        rm_conffile_fishd "/etc/fish.d/completions/valgrind.fish"
        rm_conffile_fishd "/etc/fish.d/completions/vared.fish"
        rm_conffile_fishd "/etc/fish.d/completions/w.fish"
        rm_conffile_fishd "/etc/fish.d/completions/wc.fish"
        rm_conffile_fishd "/etc/fish.d/completions/wget.fish"
        rm_conffile_fishd "/etc/fish.d/completions/whatis.fish"
        rm_conffile_fishd "/etc/fish.d/completions/who.fish"
        rm_conffile_fishd "/etc/fish.d/completions/xprop.fish"
        rm_conffile_fishd "/etc/fish.d/completions/xsel.fish"
        rm_conffile_fishd "/etc/fish.d/completions/yum.fish"
        rm_conffile_fishd "/etc/fish.d/completions/zcat.fish"
        rm_conffile_fishd "/etc/fish.d/completions/zip.fish"
        rm_conffile_fishd "/etc/fish.d/fish_function.fish"
        rm_conffile_fishd "/etc/fish.d/fish_complete.fish"
    fi
    # /etc/fish.d/completions is left-over from 1.20.2-1. Remove it if it's
    # empty
    if [ -d /etc/fish.d/completions ]; then
        rmdir --ignore-fail-on-non-empty /etc/fish.d/completions
    fi
    if dpkg --compare-versions "$2" le "1.21.12-4"; then
        # Upstream made the following changes to the configuration file
        # organization
        # /etc/fish.d -> /etc/fish
        # /etc/fish -> /etc/fish/config.fish
        # /etc/fish_inputrc -> /etc/fish/fish_inputrc
        # /etc/fish.d/fish_interactive.fish -> /usr/share/fish/config_interactive.fish
        rm_conffile_fish "/etc/fish.d/fish_interactive.fish"
        prep_mv_conffile "/etc/fish" "yes"
        prep_mv_conffile "/etc/fish_inputrc"
    fi
esac

#DEBHELPER#

exit 0