summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-11 18:43:12 +0000
committerLuca Boccassi <bluca@debian.org>2020-03-12 10:31:39 +0000
commit1e0339a4e36f85f468ecbdc21c645541f51e5e56 (patch)
tree81e7fc69a6fa84b42ae1efa19a2fa6a3957ee6a9
parent9930ce1ea542516dabdce9ce9b2bb297b437483a (diff)
downloadvyos-live-build-1e0339a4e36f85f468ecbdc21c645541f51e5e56.tar.gz
vyos-live-build-1e0339a4e36f85f468ecbdc21c645541f51e5e56.zip
remove obsolete loop-aes-utils related losetup hack
677415f6d7efc1e5b888570d70af311d2900c69c (2007) in v1.0~a2-1 added a hack relating to the loop-aes-utils package and losetup. this commit bundled a bunch of changes, it was not specific to the hack, and so info about the hack is limited to a brief comment included within the related change in defaults: ``` # Workaround for loop-aes-utils divertion # (loop-aes-utils' losetup lacks features). ``` though it is very similar to the removed fdisk hack in that it seems that one package may replace a binary from another, moving the original to a new location, and this hack gives the user the opportunity to select the original instead of the one put in its place, for use in LB. the comment mentions a package called loop-aes-utils as being the package that performs such a diversion, and that the need for the hack was that losetup itself lacked features, presumably encryption support, and it is clear that it is the losetup binary that is the focus of the diversion. looking into the history of loop-aes-utils a little, this package was dropped from debian back in 2012 (#680748), favouring encrytion support of dm-crypt/cryptsetup. double checking file contents of packages, only the mount package carries an /sbin/losetup file, so presumably this means that dm-setup/cryptsetup do not perform such a diversion of losetup (i.e. their use is exclusively done directly). since the possible diversion is simply gone, that completely removes any point in having the hack of giving users choice between losetup and the diverted one. so let's remove this obsolete hack...
-rwxr-xr-xfunctions/defaults.sh16
-rwxr-xr-xfunctions/losetup.sh8
-rw-r--r--manpages/en/lb_config.14
-rwxr-xr-xscripts/build/binary_hdd5
-rwxr-xr-xscripts/build/config9
-rwxr-xr-xscripts/build/source_hdd5
6 files changed, 12 insertions, 35 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh
index b8ac6204d..bfbffa37e 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -273,22 +273,6 @@ Set_config_defaults ()
;;
esac
- # Setting losetup
- if [ -z "${LB_LOSETUP}" ] || [ "${LB_LOSETUP}" != "/sbin/losetup.orig" ]
- then
- # Workaround for loop-aes-utils divertion
- # (loop-aes-utils' losetup lacks features).
- if [ -x /sbin/losetup.orig ]
- then
- LB_LOSETUP="losetup.orig"
- elif [ -x /sbin/losetup ]
- then
- LB_LOSETUP="losetup"
- else
- Echo_error "Can't process file /sbin/losetup"
- fi
- fi
-
if [ "${LB_ARCHITECTURES}" = "i386" ] && [ "${CURRENT_IMAGE_ARCHITECTURE}" = "amd64" ]
then
# Use linux32 when building amd64 images on i386
diff --git a/functions/losetup.sh b/functions/losetup.sh
index e0d2b6fdb..c3dd59641 100755
--- a/functions/losetup.sh
+++ b/functions/losetup.sh
@@ -32,7 +32,7 @@ Lodetach ()
sync
sleep 1
- ${LB_LOSETUP} -d "${DEVICE}" || Lodetach "${DEVICE}" "$(expr ${ATTEMPT} + 1)"
+ losetup -d "${DEVICE}" || Lodetach "${DEVICE}" "$(expr ${ATTEMPT} + 1)"
}
Losetup ()
@@ -41,7 +41,7 @@ Losetup ()
FILE="${2}"
PARTITION="${3:-1}"
- ${LB_LOSETUP} --read-only --partscan "${DEVICE}" "${FILE}"
+ losetup --read-only --partscan "${DEVICE}" "${FILE}"
FDISK_OUT="$(fdisk -l -u ${DEVICE} 2>&1)"
Lodetach "${DEVICE}"
@@ -51,14 +51,14 @@ Losetup ()
then
Echo_message "Mounting %s with offset 0" "${DEVICE}"
- ${LB_LOSETUP} --partscan "${DEVICE}" "${FILE}"
+ losetup --partscan "${DEVICE}" "${FILE}"
else
SECTORS="$(echo "$FDISK_OUT" | sed -ne "s|^$LOOPDEVICE[ *]*\([0-9]*\).*|\1|p")"
OFFSET="$(expr ${SECTORS} '*' 512)"
Echo_message "Mounting %s with offset %s" "${DEVICE}" "${OFFSET}"
- ${LB_LOSETUP} --partscan -o "${OFFSET}" "${DEVICE}" "${FILE}"
+ losetup --partscan -o "${OFFSET}" "${DEVICE}" "${FILE}"
fi
}
diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index 8282973ca..76148435e 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -152,8 +152,6 @@
.br
[\fB\-\-loadlin\fR true|false]
.br
- [\fB\-\-losetup\fR losetup|losetup.orig]
-.br
[\fB\-\-memtest\fR memtest86+|memtest86|none]
.br
[\fB\-\-mirror\-binary\fR \fIURL\fR]
@@ -395,8 +393,6 @@ sets the kernel flavours to be installed. Note that in case you specify more tha
sets the internal name of the kernel packages naming scheme. If you use debian kernel packages, you will not have to adjust it. If you decide to use custom kernel packages that do not follow the debian naming scheme, remember to set this option to the stub of the packages only (for debian this is linux\-image\-2.6), so that \fISTUB\fR-\fIFLAVOUR\fR results in a valid package name (for debian e.g. linux\-image\-686\-pae). Preferably you use the meta package name, if any, for the stub, so that your configuration is ABI independent. Also don't forget that you have to include stubs of the binary modules packages for unionfs or aufs, and squashfs if you built them out-of-tree.
.IP "\fB\-\-loadlin\fR true|false" 4
sets loadlin. Defaults to false, except when the debian-installer is included for x86_64 or i386.
-.IP "\fB\-\-losetup\fR losetup|losetup.orig" 4
-sets the filename of the losetup binary from the host system that should be used. This is autodetected and does generally not need any customization.
.IP "\fB\-\-memtest\fR memtest86+|memtest86|none" 4
defines if memtest, memtest86+ or no memory tester at all should be included as secondary bootloader configuration. This is only available on amd64 and i386 and defaults to memtest86+.
.IP "\fB\-\-mirror\-binary\fR \fIURL\fR" 4
diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 23cc4f0e2..a4ef83170 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -54,6 +54,7 @@ esac
Check_package chroot /usr/share/doc/mtools mtools
Check_package chroot /sbin/parted parted
Check_package host /sbin/fdisk fdisk
+Check_package host /sbin/losetup mount
echo "${LB_BOOTLOADERS}" | \
while IFS="," read -r BOOTLOADER
@@ -145,7 +146,7 @@ else
fi
dd if=/dev/zero of=chroot/binary.img bs=1024k count=0 seek=${REAL_DIM}
-FREELO="$(${LB_LOSETUP} -f)"
+FREELO="$(losetup -f)"
MAKEDEV=false
if [ ! -b chroot/${FREELO} ]
then
@@ -223,7 +224,7 @@ esac
Lodetach ${FREELO}
-FREELO="$(${LB_LOSETUP} -f)"
+FREELO="$(losetup -f)"
Losetup $FREELO chroot/binary.img 1
case "${LB_BINARY_FILESYSTEM}" in
diff --git a/scripts/build/config b/scripts/build/config
index 4ec2ea8e9..0f84c28c7 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -89,7 +89,6 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [-k|--linux-flavours FLAVOUR|\"FLAVOURS\"]\n\
\t [--linux-packages \"PACKAGES\"]\n\
\t [--loadlin true|false]\n\
-\t [--losetup losetup|losetup.orig]\n\
\t [--memtest memtest86+|memtest86|none]\n\
\t [--mirror-binary URL]\n\
\t [--mirror-binary-security URL]\n\
@@ -140,7 +139,7 @@ Local_arguments ()
LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-options:,aptitude-options:,debootstrap-options:,debootstrap-script:,
apt-pipeline:,apt-recommends:,apt-secure:,apt-source-archives:,cache:,cache-indices:,cache-packages:,
cache-stages:,debconf-frontend:,debconf-priority:,dump,
- initramfs:,initramfs-compression:,initsystem:,losetup:,mode:,system:,tasksel:,
+ initramfs:,initramfs-compression:,initsystem:,mode:,system:,tasksel:,
architectures:,clean,
distribution:,parent-distribution:,parent-debian-installer-distribution:,
distribution-chroot:,parent-distribution-chroot:,
@@ -334,7 +333,7 @@ Local_arguments ()
;;
--losetup)
- LB_LOSETUP="${2}"
+ Echo_warning "--losetup is an obsolete option"
shift 2
;;
@@ -1010,10 +1009,6 @@ LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION}"
# (Default: ${LB_INITSYSTEM})
LB_INITSYSTEM="${LB_INITSYSTEM}"
-# \$LB_LOSETUP: set losetup program
-# (Default: autodetected)
-LB_LOSETUP="${LB_LOSETUP}"
-
# \$LB_MODE: set distribution mode
# (Default: ${LB_MODE})
LB_MODE="${LB_MODE}"
diff --git a/scripts/build/source_hdd b/scripts/build/source_hdd
index 98c9b01e6..123e758fa 100755
--- a/scripts/build/source_hdd
+++ b/scripts/build/source_hdd
@@ -49,6 +49,7 @@ Create_lockfile .lock
Check_package chroot /sbin/mkdosfs dosfstools
Check_package chroot /sbin/parted parted
Check_package host /sbin/fdisk fdisk
+Check_package host /sbin/losetup mount
# Installing depends
Install_package
@@ -64,7 +65,7 @@ DU_DIM="$(du -ms source | cut -f1)"
REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_BINARY_FILESYSTEM})"
dd if=/dev/zero of=${LIVE_IMAGE_NAME}-source.img bs=1024k count=0 seek=${REAL_DIM}
MAKEDEV=false
-FREELO="$(${LB_LOSETUP} -f)"
+FREELO="$(losetup -f)"
if [ ! -b chroot/${FREELO} ]
then
MAKEDEV=true
@@ -136,7 +137,7 @@ rmdir source.tmp
Lodetach ${FREELO}
Echo_warning "!!! The above error/warning messages can be ignored !!!"
-FREELO="$(${LB_LOSETUP} -f)"
+FREELO="$(losetup -f)"
Losetup "$FREELO" ${LIVE_IMAGE_NAME}-source.img 0
Chroot chroot "parted -s ${FREELO} set 1 lba off" || true
Lodetach ${FREELO}