On Sun, Dec 16, 2018 at 09:30:21AM +0100, Vagrant Cascadian wrote:
> On 2018-12-16, Vagrant Cascadian wrote:
> > I'm now thinking of passing an option --trust-file-mirrors or something
> > like that. Then the trust is explicit, consistent with apt behavior
> > requiring to explicitly trust it. It wouldn't allow different levels of
> > trust for different file mirror types, but it will at least be simpler
> > to code...
> 
> And implemented, please test:
> 
>   
> https://git.launchpad.net/ltsp/commit/?id=85f4e9585d996bde20620a775185d06a6f41dc46
 
The new option is evaluated too late; if set to "True", the sources.list 
file contains 'deb True file:/// ... '.

The attached patch works for me, please check. 

Wolfgang
From c9eaca5529c3c8f212491a73c9f053bfd32f69c5 Mon Sep 17 00:00:00 2001
From: Wolfgang Schweer <wschw...@arcor.de>
Date: Sun, 16 Dec 2018 13:27:31 +0100
Subject: [PATCH] Debian: ltsp-build-client: Evaluate the --trust-file-mirror
 commandline option in ltsp-build-client-functions (doing it in
 010-manage-mirror is too late). https://bugs.debian.org/911380

---
 server/Debian/share/ltsp/ltsp-build-client-functions   | 10 ++++++----
 .../plugins/ltsp-build-client/Debian/010-manage-mirror |  5 -----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/server/Debian/share/ltsp/ltsp-build-client-functions b/server/Debian/share/ltsp/ltsp-build-client-functions
index 4fdd1dce..871714da 100644
--- a/server/Debian/share/ltsp/ltsp-build-client-functions
+++ b/server/Debian/share/ltsp/ltsp-build-client-functions
@@ -16,16 +16,18 @@ add_mirrors() {
             components="$COMPONENTS"
         fi
 
+        echo "deb $mirror $dist $components" >> $ROOT/etc/apt/sources.list
         case $mirror in
             file:///*)
-                echo "deb $TRUST_FILE_MIRROR $mirror $dist $components" >> $ROOT/etc/apt/sources.list
+                if ! [ -z "$trust-file-mirror" ] ; then
+                    # Option to enable trusted file mirrors:
+                    # https://bugs.debian.org/911380
+                    sed -i 's/deb/deb [trusted=yes]/' $ROOT/etc/apt/sources.list
+                fi
                 dir=$(echo "$mirror" | sed -e 's,^file://,,g')
                 mkdir -p $ROOT/$dir
                 chroot_mount $dir $dir --bind
                 ;;
-            *)
-                echo "deb $mirror $dist $components" >> $ROOT/etc/apt/sources.list
-                ;;
         esac
     done
 }
diff --git a/server/share/ltsp/plugins/ltsp-build-client/Debian/010-manage-mirror b/server/share/ltsp/plugins/ltsp-build-client/Debian/010-manage-mirror
index 65f873ae..9e1a8f57 100644
--- a/server/share/ltsp/plugins/ltsp-build-client/Debian/010-manage-mirror
+++ b/server/share/ltsp/plugins/ltsp-build-client/Debian/010-manage-mirror
@@ -15,11 +15,6 @@ case "$MODE" in
         if [ -n "$option_extra_mirror_value" ]; then
             EXTRA_MIRROR="$option_extra_mirror_value"
         fi
-        if [ -n "$option_trust_file_mirror_value" ]; then
-            # Option to enable trusted file mirrors:
-            # https://bugs.debian.org/911380
-            TRUST_FILE_MIRROR="[trusted=yes]"
-        fi
         ;;
     after-install)
         sources_list="$ROOT/etc/apt/sources.list"
-- 
2.20.0

Attachment: signature.asc
Description: PGP signature

Reply via email to