dpkg (1.18.25) stretch; urgency=medium
[dpkg] / dselect / methods / multicd / update
CommitLineData
1479465f
GJ
1#!/bin/sh
2#
3# Copyright © 1995-1998 Ian Jackson <ijackson@chiark.greenend.org.uk>
4# Copyright © 1998 Heiko Schlittermann <hs@schlittermann.de>
5#
6# This is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19set -e
20vardir="$1"
21method=$2
22option=$3
23iarch=`dpkg --print-architecture`
24
25cd "$vardir/methods/$method"
26
27. ./shvar.$option
28
29#debug() { echo "DEBUG: $@"; }
30debug() { true; }
31ismulti() { debug $1 $2; test -e "$1/.disk/info" || test -e "$1$2/.disk/info"; }
32
33packages=0
34for f in main ctb nf nonus nonusctb nonusnf lcl
35do
36 eval 'this_packages=$p_'$f'_packages'
37
38 if [ -n "$this_packages" ]
39 then
40 packages=1
41 fi
42done
43
44if [ $packages eq 0 ]
45then
46 echo '
47No Packages files available, cannot update available packages list.
48Hit RETURN to continue. '
49 read response
50 exit 0
51fi
52
53xit=1
54trap '
55 rm -f packages-{main,ctb,nf,nonus,nonusctb,nonusnf,lcl}
56 if [ -n "$umount" ]
57 then
58 umount "$umount" >/dev/null 2>&1
59 fi
60 exit $xit
61' 0
62
63if [ ! -b "$p_blockdev" ]
64then
65 loop=",loop"
66fi
67
68if [ -n "$p_blockdev" ]
69then
70 umount="$p_mountpoint"
71 mount -rt "$p_fstype" -o nosuid,nodev${loop} "$p_blockdev" "$p_mountpoint"
72fi
73
74if [ -n "$p_nfs" ]
75then
76 umount="$p_mountpoint"
77 mount -rt nfs "$p_nfs" -o nosuid,nodev "$p_mountpoint"
78fi
79
80updatetype=update
81
82if [ -z "$p_multi" ]; then
83 exit 1
84fi
85
86for f in main ctb nf nonus nonusctb nonusnf lcl
87do
88 eval 'this_packages=$p_'$f'_packages'
89 case "$this_packages" in
90 '')
91 continue
92 ;;
93 scan)
94 eval 'this_binary=$p_'$f'_binary'
95 if [ -z "$this_binary" ]; then continue; fi
96 if [ "$updatetype" = update ]
97 then
98 dpkg --clear-avail
99 updatetype=merge
100 fi
101 echo Running dpkg --record-avail -R "$p_mountpoint$this_binary"
102 dpkg --record-avail -R "$p_mountpoint$this_binary"
103 ;;
104 *)
105 packagesfile="$p_mountpoint$this_packages"
106 case "$packagesfile" in
107 *.gz | *.Z | *.GZ | *.z)
108 echo -n "Uncompressing $packagesfile ... "
109 zcat <"$packagesfile" >packages-$f
110 echo done.
111 dpkg --$updatetype-avail packages-$f
112 updatetype=merge
113 ;;
114 '')
115 ;;
116 *)
117 dpkg --$updatetype-avail "$packagesfile"
118 updatetype=merge
119 ;;
120 esac
121 ;;
122 esac
123done
124
125cp -f $vardir/available $vardir/methods/$method
126
127echo -n 'Update OK. Hit RETURN. '
128read response
129
130xit=0