This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=403a2d627c1ec6ee4be3744e783cbc09d9653bff commit 403a2d627c1ec6ee4be3744e783cbc09d9653bff Author: Guillem Jover <guil...@debian.org> AuthorDate: Sun Mar 20 08:42:57 2022 +0100 dselect: Rename multicd method to media The multicd name does not properly describe what this method is supposed to be able to handle, as we now have many other media types where distributions can ship their packages and updates on. --- Makefile.am | 2 + debian/dselect.docs | 2 +- debian/dselect.postrm | 2 +- debian/dselect.preinst | 49 ++++++++++++++++++ debian/dselect.prerm | 50 ++++++++++++++++++ dselect/methods/Makefile.am | 20 ++++---- dselect/methods/{multicd => media}/.gitignore | 0 .../{multicd/README.multicd => media/README.media} | 59 +++++++++++----------- dselect/methods/media/desc.media | 3 ++ dselect/methods/{multicd => media}/install.sh | 4 +- dselect/methods/media/names | 1 + dselect/methods/{multicd => media}/setup.sh | 28 +++++----- dselect/methods/{multicd => media}/update.sh | 0 dselect/methods/multicd/desc.multi_cd | 3 -- dselect/methods/multicd/names | 1 - man/dpkg-scanpackages.pod | 2 +- scripts/dpkg-scanpackages.pl | 2 +- t/shellcheck.t | 6 +-- 18 files changed, 168 insertions(+), 66 deletions(-) diff --git a/Makefile.am b/Makefile.am index d963a100c..dc1634880 100644 --- a/Makefile.am +++ b/Makefile.am @@ -89,6 +89,8 @@ EXTRA_DIST = \ debian/dselect.lintian-overrides \ debian/dselect.manpages \ debian/dselect.postrm \ + debian/dselect.preinst \ + debian/dselect.prerm \ debian/libdpkg-dev.install \ debian/libdpkg-perl.install \ debian/source/format \ diff --git a/debian/dselect.docs b/debian/dselect.docs index 277a80e30..26615f531 100644 --- a/debian/dselect.docs +++ b/debian/dselect.docs @@ -1 +1 @@ -dselect/methods/multicd/README.multicd +dselect/methods/media/README.media diff --git a/debian/dselect.postrm b/debian/dselect.postrm index 7376dd672..8fd119171 100755 --- a/debian/dselect.postrm +++ b/debian/dselect.postrm @@ -8,7 +8,7 @@ purge_state() { admindir=${DPKG_ADMINDIR:-/var/lib/dpkg} rm -f $admindir/cmethopt 2>/dev/null - for method in disk ftp mnt multicd; do + for method in disk ftp mnt media; do rm -rf $admindir/methods/$method/* 2>/dev/null done } diff --git a/debian/dselect.preinst b/debian/dselect.preinst new file mode 100644 index 000000000..ada5529bf --- /dev/null +++ b/debian/dselect.preinst @@ -0,0 +1,49 @@ +#!/bin/sh +# See deb-preinst(5). + +set -e + +: "${DPKG_ADMINDIR:=/var/lib/dpkg}" + +# Rename state directories to match renamed method names. +rename_method_state_dir() { + methodoldname="$1" + methodoldopt="$2" + methodnewname="$3" + methodnewopt="$4" + methodsdir="$DPKG_ADMINDIR/methods" + + if [ -d "$methodsdir/$methodoldname" ]; then + if [ -e "$methodsdir/$methodnewname" ]; then + rm -rf "$methodsdir/$methodoldname" + else + if [ -e "$methodsdir/$methodoldname/shvar.$methodoldopt" ]; then + cp -a "$methodsdir/$methodoldname/shvar.$methodoldopt" \ + "$methodsdir/$methodoldname/shvar.$methodnewopt" + fi + mv "$methodsdir/$methodoldname" "$methodsdir/$methodnewname" + rm -f "$methodsdir/$methodnewname/shvar.$methodoldopt" + fi + # Update the currently selected method and option if needed. + sed -i -e "s/^$methodoldname $methodoldopt/$methodnewname $methodnewopt/" \ + "$DPKG_ADMINDIR/cmethopt" + fi +} + +case "$1" in +install|upgrade) + if [ -n "$2" ]; then + rename_method_state_dir multicd multi_cd media media + fi + ;; +abort-upgrade) + ;; +*) + echo "$0 called with unknown argument '$1'" 1>&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/dselect.prerm b/debian/dselect.prerm new file mode 100644 index 000000000..63b699c5f --- /dev/null +++ b/debian/dselect.prerm @@ -0,0 +1,50 @@ +#!/bin/sh +# See deb-prerm(5). + +set -e + +: "${DPKG_ADMINDIR:=/var/lib/dpkg}" + +# Rename state directories to match renamed method names. +rename_method_state_dir() { + methodoldname="$1" + methodoldopt="$2" + methodnewname="$3" + methodnewopt="$4" + methodsdir="$DPKG_ADMINDIR/methods" + + if [ -d "$methodsdir/$methodoldname" ]; then + if [ -e "$methodsdir/$methodnewname" ]; then + rm -rf "$methodsdir/$methodoldname" + else + if [ -e "$methodsdir/$methodoldname/shvar.$methodoldopt" ]; then + cp -a "$methodsdir/$methodoldname/shvar.$methodoldopt" \ + "$methodsdir/$methodoldname/shvar.$methodnewopt" + fi + mv "$methodsdir/$methodoldname" "$methodsdir/$methodnewname" + rm -f "$methodsdir/$methodnewname/shvar.$methodoldopt" + fi + # Update the currently selected method and option if needed. + sed -i -e "s/^$methodoldname $methodoldopt/$methodnewname $methodnewopt/" \ + "$DPKG_ADMINDIR/cmethopt" + fi +} + +case "$1" in +upgrade) + if dpkg --compare-versions "$2" lt 1.21.3; then + # Downgrade + rename_method_state_dir media media multicd multi_cd + fi + ;; +deconfigure|remove|failed-upgrade) + ;; +*) + echo "$0 called with unknown argument '$1'" 1>&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/dselect/methods/Makefile.am b/dselect/methods/Makefile.am index 026c06e13..988937540 100644 --- a/dselect/methods/Makefile.am +++ b/dselect/methods/Makefile.am @@ -7,8 +7,8 @@ nobase_dist_methods_DATA = \ disk/desc.mounted \ ftp/names \ ftp/desc.ftp \ - multicd/names \ - multicd/desc.multi_cd \ + media/names \ + media/desc.media \ # EOL nobase_methods_SCRIPTS = \ @@ -18,9 +18,9 @@ nobase_methods_SCRIPTS = \ ftp/install \ ftp/setup \ ftp/update \ - multicd/install \ - multicd/setup \ - multicd/update \ + media/install \ + media/setup \ + media/update \ # EOL perllibdir = $(PERL_LIBDIR) @@ -35,10 +35,10 @@ EXTRA_DIST = \ ftp/setup.pl \ ftp/update.pl \ ftp/install.pl \ - multicd/setup.sh \ - multicd/update.sh \ - multicd/install.sh \ - multicd/README.multicd \ + media/setup.sh \ + media/update.sh \ + media/install.sh \ + media/README.media \ # EOL CLEANFILES = \ @@ -53,4 +53,4 @@ install-data-local: $(MKDIR_P) $(DESTDIR)$(admindir)/methods/mnt $(MKDIR_P) $(DESTDIR)$(admindir)/methods/disk $(MKDIR_P) $(DESTDIR)$(admindir)/methods/ftp - $(MKDIR_P) $(DESTDIR)$(admindir)/methods/multicd + $(MKDIR_P) $(DESTDIR)$(admindir)/methods/media diff --git a/dselect/methods/multicd/.gitignore b/dselect/methods/media/.gitignore similarity index 100% rename from dselect/methods/multicd/.gitignore rename to dselect/methods/media/.gitignore diff --git a/dselect/methods/multicd/README.multicd b/dselect/methods/media/README.media similarity index 55% rename from dselect/methods/multicd/README.multicd rename to dselect/methods/media/README.media index 19e5856b4..468daa85f 100644 --- a/dselect/methods/multicd/README.multicd +++ b/dselect/methods/media/README.media @@ -1,8 +1,9 @@ -Installation method for multiple binary CDs -------------------------------------------- +Installation method for multiple binary media +--------------------------------------------- This directory contains a method to be used within dselect in order to - access Debian binary packages stored across multiple binary CD-ROMs. + access Debian binary packages stored across multiple binary media + (CDs, DVDs, BDs, or USBs). Acquiring package data --------------------- @@ -17,42 +18,42 @@ Acquiring package data The selected method will try to read the «Packages.cd» file from each of these directories if it is available. -Identifying the CD-ROM +Identifying the media ---------------------- - A unique name is associated to each CD. This name should correspond - with the label on the front of the CD. The name is also available on - the CD, so the system can find out which CD is in the drive at any - time. + A unique name is associated to each media disc. This name should correspond + with the label on the front of the media disc. The name is also available on + the media disc, so the system can find out which media disc is inserted into + the computer at any time. Installing the files -------------------- - At the beginning of the installation the “multicd” method will sort - the list of to-be-installed packages and install them CD by CD. If a - different CD-ROM is required the user will be prompted to exchange - the CD-ROM. + At the beginning of the installation the “media” method will sort the list + of to-be-installed packages and install them media disc by media disc. If a + different media disc is required the user will be prompted to exchange + the media disc. -Preparing multiple binary CD-ROMs ---------------------------------- +Preparing multiple binary media discs +------------------------------------- - Since the “multicd” method needs to know which packages are on which - CD-ROMs one cannot use regular «Packages» files. An additional data - field «X-Medium:» is required. The first CD-ROM from the set should + Since the “media” method needs to know which packages are on which + media disc one cannot use regular «Packages» files. An additional data + field «X-Medium:» is required. The first media disc from the set should contain all «Packages.cd» files. To be more convenient you should - include the «Packages.cd» files on all CD-ROMs. This ensures that - you do not have to start with the first CD-ROM all the time. + include the «Packages.cd» files on all media discs. This ensures that + you do not have to start with the first media disc all the time. - Additionally the package needs to gain information which CD-ROM is - currently used. Thus each CD-ROM contains the file «.disk/info» - which contains the symbolic name for the CD-ROM as specified by + Additionally the package needs to gain information which media disc is + currently used. Thus each media disc contains the file «.disk/info» + which contains the symbolic name for the media disc as specified by «X-Medium:». In order to be able to create the modified «Packages.cd» files, you have to use the «-M medium» option of dpkg-scanpackages (supported in dpkg-dev since 1.15.5). - To split the “main” distribution into two CD-ROMs you will need to + To split the “main” distribution into two media discs you will need to create a «Packages.cd» file for each «binary-$arch» directory. Afterwards you simply append the second one to the first one and put the resulting «Packages.cd» file into both «binary-$arch» @@ -61,21 +62,21 @@ Preparing multiple binary CD-ROMs Sample Layout ------------- - CD1 .disk/info = "Debian GNU/Linux binary-amd64" + Media disc 1 .disk/info = "Debian GNU/Linux binary-amd64" dists/stable/main/binary-all/ binary-amd64/Packages.cd.gz binary-amd64/net/foo.deb contrib/binary-amd64/Packages.cd.gz non-free/binary-amd64/Packages.cd.gz - CD2 .disk/info = "Debian GNU/Linux contrib-amd64" + Media disc 2 .disk/info = "Debian GNU/Linux contrib-amd64" dists/stable/main/binary-amd64/Packages.cd.gz contrib/binary-all/ binary-amd64/Packages.cd.gz binary-amd64/net/foo.deb non-free/binary-amd64/Packages.cd.gz - CD3 .disk/info = "Debian GNU/Linux non-free-amd64" + Media disc 3 .disk/info = "Debian GNU/Linux non-free-amd64" dists/stable/main/binary-amd64/Packages.cd.gz contrib/binary-amd64/Packages.cd.gz non-free/binary-all/ @@ -87,14 +88,14 @@ Sample Layout assumed that you use regular compressed overrides files in «/pub/debian/indices». - CD1: dpkg-scanpackages -M "Debian GNU/Linux binary-amd64" \ + Media disc 1: dpkg-scanpackages -M "Debian GNU/Linux binary-amd64" \ binary-amd64 /pub/debian/indices/override.buster.gz \ dists/stable/ > binary-amd64/Packages - CD2: dpkg-scanpackages -M "Debian GNU/Linux contrib-amd64" \ + Media disc 2: dpkg-scanpackages -M "Debian GNU/Linux contrib-amd64" \ binary-amd64 /pub/debian/indices/override.buster.contrib.gz \ dists/stable/ > binary-amd64/Packages - CD3: dpkg-scanpackages -M "Debian GNU/Linux non-free-amd64" \ + Media disc 3: dpkg-scanpackages -M "Debian GNU/Linux non-free-amd64" \ binary-amd64 /pub/debian/indices/override.buster.non-free.gz \ dists/stable/ > binary-amd64/Packages diff --git a/dselect/methods/media/desc.media b/dselect/methods/media/desc.media new file mode 100644 index 000000000..e76022e37 --- /dev/null +++ b/dselect/methods/media/desc.media @@ -0,0 +1,3 @@ +Installation from a media set containing a Debian distribution. The +media discs may be or not be mounted already and should contain a standard +ISO9660 media filesystem. diff --git a/dselect/methods/multicd/install.sh b/dselect/methods/media/install.sh similarity index 98% rename from dselect/methods/multicd/install.sh rename to dselect/methods/media/install.sh index 59227028b..64ccabaa7 100755 --- a/dselect/methods/multicd/install.sh +++ b/dselect/methods/media/install.sh @@ -170,7 +170,7 @@ perl -e ' $| = 1; my ($vardir, $mountpoint, $hierbase, $mount, $umount) = @ARGV; my $line; - my $AVAIL = "$vardir/methods/multicd/available"; + my $AVAIL = "$vardir/methods/media/available"; my $STATUS = "$vardir/status"; my %Installed, %Filename, %Medium; print "Get currently installed package versions..."; @@ -268,7 +268,7 @@ perl -e ' if ($?) { print "\nThe dpkg run produced errors. Please state whether to\n", - "continue with the next CD. [Y/n]: "; + "continue with the next media disc. [Y/n]: "; $answer = <STDIN>; exit 1 if $answer =~ /^n/i; $ouch = $?; diff --git a/dselect/methods/media/names b/dselect/methods/media/names new file mode 100644 index 000000000..1d8879d83 --- /dev/null +++ b/dselect/methods/media/names @@ -0,0 +1 @@ +31 media Install from a media set (CDs, DVDs, BDs, USBs). diff --git a/dselect/methods/multicd/setup.sh b/dselect/methods/media/setup.sh similarity index 93% rename from dselect/methods/multicd/setup.sh rename to dselect/methods/media/setup.sh index 5ed4b52bc..887e1e5a4 100755 --- a/dselect/methods/multicd/setup.sh +++ b/dselect/methods/media/setup.sh @@ -155,7 +155,7 @@ ncdroms=$(wc -l <$tp.l) if [ $ncdroms -gt 1 ]; then response="" while [ -z "$response" ]; do - echo 'Several CD-ROMs (or other ISO9660 filesystems) are mounted:' + echo 'Several media discs (ISO9660 filesystems) are mounted:' grep -E 'type iso9660 \([^)]*\)$' <$tp.m | nl echo -n "Is it any of these ? Type a number, or 'n' for none. " read response @@ -176,7 +176,7 @@ elif [ $ncdroms = 1 ]; then <$tp.m >$tp.d blockdevice="$(cat $tp.d)" yesno yes \ - "Found a CD-ROM: $blockdevice, mounted on $mountpoint. Is it the right one?" + "Found a media disc: $blockdevice, mounted on $mountpoint. Is it the right one?" if [ $yesno = no ]; then echo 'Unmounting it ...' umount="$mountpoint" @@ -196,13 +196,13 @@ if [ -z "$mountpoint" ]; then echo 'Found that /dev/cdrom exists and is a block device.' newdefaultdevice=/dev/cdrom fi - getblockdev 'Insert the CD-ROM and enter the block device name' + getblockdev 'Insert the media and enter the block device name' fi if [ -n "$mountpoint" ]; then # We must have $mountpoint echo \ -'All directory names should be entered relative to the root of the CD-ROM. +'All directory names should be entered relative to the root of the media disc. ' fi @@ -216,10 +216,10 @@ while true; do fi echo \ -"Need to know where on the CD-ROM the top level of the Debian +"Need to know where on the media disc the top level of the Debian distribution is - this will usually contain the 'dists' directory. -If the CD-ROM is badly organized and doesn't have a straightforward copy of +If the media disc is badly organized and doesn't have a straightforward copy of the distribution you may answer 'none' and the needed parts will be prompted individually." @@ -233,12 +233,12 @@ individually." echo " Last time you said '$p_hierbase', but that doesn't look plausible, since '$p_hierbase/dists/$dist/main/binary-$iarch' doesn't seem to exist. -And it does not appear that you're using a multi-CD set." +And it does not appear that you are using a multiple media set." fi fi # at this point defhierbase is set if it looks plausible - # if ‘none’ was entered, we assume a CD with a debian/ directory + # if ‘none’ was entered, we assume a media with a debian/ directory if [ none = "$defhierbase" -a -d "$mountpoint/debian/dists/$dist/main/binary-$iarch" ] then @@ -262,7 +262,7 @@ And it does not appear that you're using a multi-CD set." -o -n "$multi" ]; then echo \ "Neither $response/dists/$dist/main/binary-$iarch does not exist, -nor are you using a multi-CD set" +nor are you using a multiple media set" break fi @@ -273,7 +273,7 @@ nor are you using a multi-CD set" disklabel=$(getdisklabel "$mountpoint" "/$response") echo "Ok, this is disc" echo " $disklabel" - #echo "Updating multi CD contents file cache ..." + #echo "Updating multiple media contents file cache ..." #multi_contentsfile="${mountpoint}/${response}/.disk/contents.gz" #zcat "$multi_contentsfile" > disk-contents.$option fi @@ -321,7 +321,7 @@ check_binary () { fi # In this special case it is ok for a sub-distribution to not contain any -# .deb files. Each CD should contain all Packages.cd files but doesn't +# .deb files. Each media should contain all Packages.cd files but does not # need to contain the .deb files. # # if ! { find -L "$mountpoint$2" -name '*.deb' -print \ @@ -356,10 +356,10 @@ find_area () { fi if [ $2 = nf -a -z "$this_binary" ]; then echo " -Note: most CD-ROM distributions of Debian do not include programs +Note: most media distributions of Debian do not include programs available in the 'non-free' directory of the distribution site. This is because these programs have copyrights that prevent -distribution for profit on a CD-ROM - ie they are not free software. +distribution for profit on a media - ie they are not free software. If you wish to install these programs you'll have to get them from an alternative source." fi @@ -412,7 +412,7 @@ If you overlooked it when downloading you should do get it now and return to this installation procedure when you have done so: you will find one Packages.cd file and one Packages.cd.gz file -- either will do -- in the 'binary' subdirectory of each area on the FTP sites and -CD-ROMs. Alternatively (and this will be rather slow) the packages in +media discs. Alternatively (and this will be rather slow) the packages in the distribution area can be scanned - say 'scan' if you want to do so. You need a separate Packages.cd file from each of the distribution areas diff --git a/dselect/methods/multicd/update.sh b/dselect/methods/media/update.sh similarity index 100% rename from dselect/methods/multicd/update.sh rename to dselect/methods/media/update.sh diff --git a/dselect/methods/multicd/desc.multi_cd b/dselect/methods/multicd/desc.multi_cd deleted file mode 100644 index 76e75d4cb..000000000 --- a/dselect/methods/multicd/desc.multi_cd +++ /dev/null @@ -1,3 +0,0 @@ -Installation from a CD-ROM set containing a Debian distribution. The -CD-ROMs may be or not be mounted already and should contain a standard -ISO9660 CD-ROM filesystem. diff --git a/dselect/methods/multicd/names b/dselect/methods/multicd/names deleted file mode 100644 index 06cda706a..000000000 --- a/dselect/methods/multicd/names +++ /dev/null @@ -1 +0,0 @@ -31 multi_cd Install from a CD-ROM set. diff --git a/man/dpkg-scanpackages.pod b/man/dpkg-scanpackages.pod index 90db8887a..cb686c6d5 100644 --- a/man/dpkg-scanpackages.pod +++ b/man/dpkg-scanpackages.pod @@ -119,7 +119,7 @@ Include all found packages in the output. Add an B<X-Medium> field containing the value I<id-string> (since dpkg 1.15.5). This field is required if you want to generate B<Packages.cd> files -for use by the multicd access method of dselect. +for use by the B<media> access method of B<dselect>. =item B<-?>, B<--help> diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl index 3d727753d..be6de52c0 100755 --- a/scripts/dpkg-scanpackages.pl +++ b/scripts/dpkg-scanpackages.pl @@ -80,7 +80,7 @@ Options: -m, --multiversion allow multiple versions of a single package. -e, --extra-override <file> use extra override file. - -M, --medium <medium> add X-Medium field for dselect multicd access method + -M, --medium <medium> add X-Medium field for dselect media access method -?, --help show this help message. --version show the version. "), $Dpkg::PROGNAME; diff --git a/t/shellcheck.t b/t/shellcheck.t index 0da7ef1ee..fdc6dcc9a 100644 --- a/t/shellcheck.t +++ b/t/shellcheck.t @@ -27,9 +27,9 @@ my @todofiles = qw( dselect/methods/disk/install.sh dselect/methods/disk/setup.sh dselect/methods/disk/update.sh - dselect/methods/multicd/install.sh - dselect/methods/multicd/setup.sh - dselect/methods/multicd/update.sh + dselect/methods/media/install.sh + dselect/methods/media/setup.sh + dselect/methods/media/update.sh ); my @files = qw( autogen -- Dpkg.Org's dpkg