Bug#989342: debian-edu-config: fails to setup thin client support if used outside d-i

2021-06-04 Thread Wolfgang Schweer
[ Wolfgang Schweer, 2021-06-01 ]
> During a recent installation test I noticed that the 
> debian-edu-ltsp-install script fails to setup thin client support if 
> used outside the Debian Installer environment.
> 
> As there are too many ways to install a combined server with or 
> without Internet connection using the BD iso image it is best to 
> adjust debian-edu-ltsp-install to only use the BD ISO image if run 
> inside d-i.
> 
> The fix is simple:
> 
> diff --git a/sbin/debian-edu-ltsp-install b/sbin/debian-edu-ltsp-install
> index 1edb407a..a22d8ca8 100755
> --- a/sbin/debian-edu-ltsp-install
> +++ b/sbin/debian-edu-ltsp-install
> @@ -341,8 +341,8 @@ cat < /etc/ltsp/skel/.x2goclient/settings
>  show=false
>  EOF
> 
> -# Specific settings needed if BD ISO image is used for installation.
> -if grep -q BD /etc/apt/sources.list ; then
> +# Specific settings needed if BD ISO image is used for installation inside 
> d-i.
> +if [ -e /etc/apt/apt.conf.d/00IgnoreTimeConflict ] && grep -q BD 
> /etc/apt/sources.list ; then
> BD_ISO="true";
> device="$(grep media/cdrom /etc/fstab | cut -d' ' -f1)"
> mirror="file:///media/cdrom/"
> @@ -365,7 +365,6 @@ debootstrap --arch="$arch" --no-check-gpg 
> --variant=minbase --include=linux-imag
> if [ "true" == "$BD_ISO" ] ; then
> mkdir -p /srv/ltsp/thin/"$thin_type"-"$arch"/media/cdrom
> mount $device /srv/ltsp/thin/"$thin_type"-"$arch"/media/cdrom
> -   cp /var/cache/apt/*.bin 
> /srv/ltsp/thin/"$thin_type"-"$arch"/var/cache/apt/
> echo "deb [trusted=yes] $mirror $dist main" > 
> /srv/ltsp/thin/"$thin_type"-"$arch"/etc/apt/sources.list
> fi
> chroot /srv/ltsp/thin/"$thin_type"-"$arch"/ apt -y -qq install 
> education-thin-client p910nd
> 

Explaining the fix:

If the BD ISO image is used in offline mode, 'apt update' isn't run, so 
/var/cache/apt/ doesn't contain pkgcache.bin and srcpkgcache.bin; the 
script errors out.

A fix could have been to append '|| true' to the line 
cp /var/cache/apt/*.bin /srv/ltsp/thin/"$thin_type"-"$arch"/var/cache/apt/

But a second issue showed up  while testing a fix for the script:

There are too many ways to use the script outside d-i for installation 
(with or without Internet connection, with or without adjusting the 
sources list, with or without running apt update, support for amd64 or 
i386 thin clients, with or without a related DVD / USB flash drive being 
mounted / available) to cover all these cases.

So it seemed to be best to use the BD ISO image to setup X2Go thin 
client support only in case the script is run inside the Debian 
Installer environment.

This said, instead of appending '|| true' to the mentioned line, get rid 
of it completely.

Wolfgang


signature.asc
Description: PGP signature


Bug#989342: debian-edu-config: fails to setup thin client support if used outside d-i

2021-06-01 Thread Wolfgang Schweer
Package: debian-edu-config
Version: 2.11.55
Severity: important

During a recent installation test I noticed that the debian-edu-ltsp-install 
script
fails to setup thin client support if used outside the Debian Installer 
environment.

As there are too many ways to install a combined server with or without Internet
connection using the BD iso image it is best to adjust debian-edu-ltsp-install
to only use the BD ISO image if run inside d-i.

The fix is simple:

diff --git a/sbin/debian-edu-ltsp-install b/sbin/debian-edu-ltsp-install
index 1edb407a..a22d8ca8 100755
--- a/sbin/debian-edu-ltsp-install
+++ b/sbin/debian-edu-ltsp-install
@@ -341,8 +341,8 @@ cat < /etc/ltsp/skel/.x2goclient/settings
 show=false
 EOF

-# Specific settings needed if BD ISO image is used for installation.
-if grep -q BD /etc/apt/sources.list ; then
+# Specific settings needed if BD ISO image is used for installation inside d-i.
+if [ -e /etc/apt/apt.conf.d/00IgnoreTimeConflict ] && grep -q BD 
/etc/apt/sources.list ; then
BD_ISO="true";
device="$(grep media/cdrom /etc/fstab | cut -d' ' -f1)"
mirror="file:///media/cdrom/"
@@ -365,7 +365,6 @@ debootstrap --arch="$arch" --no-check-gpg --variant=minbase 
--include=linux-imag
if [ "true" == "$BD_ISO" ] ; then
mkdir -p /srv/ltsp/thin/"$thin_type"-"$arch"/media/cdrom
mount $device /srv/ltsp/thin/"$thin_type"-"$arch"/media/cdrom
-   cp /var/cache/apt/*.bin 
/srv/ltsp/thin/"$thin_type"-"$arch"/var/cache/apt/
echo "deb [trusted=yes] $mirror $dist main" > 
/srv/ltsp/thin/"$thin_type"-"$arch"/etc/apt/sources.list
fi
chroot /srv/ltsp/thin/"$thin_type"-"$arch"/ apt -y -qq install 
education-thin-client p910nd

Wolfgang