Dpkg::Vendor::Debian: Set -Wno-error on qa=-bug-implicit-func
[dpkg.git] / dselect / methods / file / update.sh
blob3784ffe4003eed76619b35f86b941e825b4f82d6
1 #!/bin/sh
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 set -e
17 vardir="$1"
18 method=$2
19 option=$3
21 cd "$vardir/methods/file"
23 . ./shvar.$option
25 if [ -z "$p_main_packages" ] && [ -z "$p_ctb_packages" ] && \
26 [ -z "$p_nf_packages" ] && [ -z "$p_lcl_packages" ]; then
27 echo '
28 No Packages files available, cannot update available packages list.
29 Hit RETURN to continue. '
30 read response
31 exit 0
34 xit=1
35 trap '
36 rm -f packages-main packages-ctb packages-nf packages-lcl
37 exit $xit
38 ' 0
40 updatetype=update
42 for f in main ctb nf lcl; do
43 eval 'this_packages=$p_'$f'_packages'
44 case "$this_packages" in
45 '')
46 continue
48 scan)
49 eval 'this_binary=$p_'$f'_binary'
50 if [ -z "$this_binary" ]; then
51 continue
53 if [ "$updatetype" = update ]; then
54 dpkg --admindir $vardir --clear-avail
55 updatetype=merge
57 echo Running dpkg --record-avail -R "$p_mountpoint$this_binary"
58 dpkg --admindir $vardir --record-avail -R "$p_mountpoint$this_binary"
61 packagesfile="$p_mountpoint$this_packages"
62 case "$packagesfile" in
63 *.gz)
64 echo -n "Uncompressing $packagesfile ... "
65 zcat <"$packagesfile" >packages-$f
66 echo done.
67 dpkg --admindir $vardir --$updatetype-avail packages-$f
68 updatetype=merge
70 '')
73 dpkg --admindir $vardir --$updatetype-avail "$packagesfile"
74 updatetype=merge
76 esac
78 esac
79 done
81 echo -n 'Update OK. Hit RETURN. '
82 read response
84 xit=0