[debian-edu-commits] debian-edu/ 01/01: share/d-e-c/tools: Add scripts 'install-missing-taskpkgs' and 'install-missing-chroot-taskpkgs'; they do what their names tell and are esp. useful after distribution upgrade when packages from the task files are missing due to meta-packages not allowing to define real Depends. (Closes: #779644, #779647, #779648).

Wolfgang Schweer schweer-guest at moszumanska.debian.org
Sun Mar 15 09:43:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

schweer-guest pushed a commit to branch upgrade-tmp
in repository debian-edu-config.

commit 33fcfbb84c979cff67d7fae1ada95944577c7de4
Author: Wolfgang Schweer <wschweer at arcor.de>
Date:   Sun Mar 15 10:42:50 2015 +0100

    share/d-e-c/tools: Add scripts 'install-missing-taskpkgs' and 'install-missing-chroot-taskpkgs';
    they do what their names tell and are esp. useful after distribution upgrade when packages from
    the task files are missing due to meta-packages not allowing to define real Depends.
    (Closes: #779644, #779647, #779648).
---
 Makefile                                           |  2 +
 debian/changelog                                   |  5 ++
 .../tools/install-missing-chroot-taskpkgs          | 84 ++++++++++++++++++++
 .../tools/install-missing-taskpkgs                 | 92 ++++++++++++++++++++++
 4 files changed, 183 insertions(+)

diff --git a/Makefile b/Makefile
index d450756..4d4f967 100644
--- a/Makefile
+++ b/Makefile
@@ -394,6 +394,8 @@ install: install-testsuite
 		share/debian-edu-config/tools/workaround-udev-bug-765577 \
 		share/debian-edu-config/tools/wpad-extract \
 		share/debian-edu-config/tools/debian-edu-dovecot-create-cert \
+		share/debian-edu-config/tools/install-missing-taskpkgs \
+		share/debian-edu-config/tools/install-missing-chroot-taskpkgs \
 		share/debian-edu-config/ltspfs-mounter-kde \
 		share/ltsp/get-ldap-ltsp-config \
 		share/ltsp/init-ltsp.d/08-edu-hostname \
diff --git a/debian/changelog b/debian/changelog
index c2fcead..299cd61 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,11 @@ debian-edu-config (1.818) UNRELEASED; urgency=medium
     - remove 'apt-get autoremove -y' from cf/cf.apt.
     - add param '--auto-remove' to all apt-get purge commands
       in cf/cf.ldapclient (Closes: #779646).
+  * share/d-e-c/tools: Add scripts 'install-missing-taskpkgs' and
+    'install-missing-chroot-taskpkgs'; they do what their names tell and
+    are esp. useful after distribution upgrade when packages from the
+    task files are missing due to meta-packages not allowing to define
+    real Depends. (Closes: #779644, #779647, #779648).
 
  -- Wolfgang Schweer <wschweer at arcor.de>  Tue, 10 Mar 2015 18:23:11 +0100
 
diff --git a/share/debian-edu-config/tools/install-missing-chroot-taskpkgs b/share/debian-edu-config/tools/install-missing-chroot-taskpkgs
new file mode 100755
index 0000000..0d646dc
--- /dev/null
+++ b/share/debian-edu-config/tools/install-missing-chroot-taskpkgs
@@ -0,0 +1,84 @@
+#!/bin/sh -e
+#
+# Based upon testsuite/taskpkgs
+#
+# Make sure the correct profile packages are installed in the LTSP chroot.
+# Once this is done, unwanted packages are removed including some of the just
+# installed ones. Smarter way to get the right package subset would be nice.
+
+if [ ! -f /etc/lts.conf ] ; then
+     echo ""
+     echo "$0 is only useful in LTSP chroots, exiting."
+     echo ""
+     echo "Usage: ltsp-chroot -m -a (i386|amd64) $0"
+     echo ""
+     exit 0
+fi
+
+installed="$(dpkg --get-selections | awk '/\tinstall$/ {print $1}')"
+
+deb_installed() {
+    echo $installed | grep -qw $1
+}
+
+check_installed() {
+    deb=$1
+    if ! deb_installed "$deb" ; then
+         echo "$0: Package $deb is missing, installing it now."
+         apt-get -q -y install $deb
+    fi
+}
+
+check_installed_task() {
+    task=$1
+    found=false
+    for deb in $(tasksel --task-packages $task); do
+        found=true
+        if ! deb_installed "$deb" ; then
+             echo "$0: Package $deb is missing, installing it now."
+             apt-get -q -y install $deb
+        fi
+    done
+    if [ false = $found ] ; then
+            echo "error: $0: Task $task is empty, tasksel --task-packages $task returns nothing!"
+            retval=1
+    fi
+}
+
+if test -r /etc/debian-edu/config ; then
+    . /etc/debian-edu/config
+fi
+
+# Check if the desktop type selection worked
+check_desktop_task() {
+    desktop=$(debconf-show tasksel |tr -d "*" |awk '/tasksel\/desktop/ {print $2}')
+    pkg="education-desktop-$desktop"
+    if deb_installed "$pkg" ; then
+	echo "$0: Desktop package $pkg is installed."
+    else
+	echo "error: $0: Desktop package $pkg is not installed."
+    fi
+}
+
+retval=0
+
+apt-get update
+
+check_installed education-common
+check_installed education-tasks
+check_installed_task education-workstation
+check_desktop_task
+
+# FIXME: Check if this list is still valid for stretch.
+# Some packages are unwanted for the LTSP chroot (list from 032-edu-pkgs),
+# so remove them. Remove as well automatically installed packages.
+unwanted="cups cups-browsed readahead readahead-fedora hdparm hddtemp lvm2 \
+munin-node xfs resolvconf network-manager wpasupplicant openvpn ppp \
+modemmanager consolekit cups network-manager-openvpn network-manager-pptp \
+network-manager-vpnc popularity-contest system-config-lvm"
+
+for i in $(echo $unwanted); do
+     apt-get --auto-remove -y purge $i
+done
+
+exit $retval
diff --git a/share/debian-edu-config/tools/install-missing-taskpkgs b/share/debian-edu-config/tools/install-missing-taskpkgs
new file mode 100755
index 0000000..49d1bd2
--- /dev/null
+++ b/share/debian-edu-config/tools/install-missing-taskpkgs
@@ -0,0 +1,92 @@
+#!/bin/sh -e
+#
+# Based upon testsuite/taskpkgs
+#
+# Make sure the correct profile packages are installed.
+
+installed="$(dpkg --get-selections | awk '/\tinstall$/ {print $1}')"
+
+deb_installed() {
+    echo $installed | grep -qw $1
+}
+
+check_installed() {
+    deb=$1
+    if ! deb_installed "$deb" ; then
+         echo "$0: Package $deb is missing, installing it now."
+         apt-get -q -y install $deb
+    fi
+}
+
+check_installed_task() {
+    task=$1
+    found=false
+    for deb in $(tasksel --task-packages $task); do
+        found=true
+        if ! deb_installed "$deb" ; then
+             echo "$0: Package $deb is missing, installing it now."
+             apt-get -q -y install $deb
+        fi
+    done
+    if [ false = $found ] ; then
+            echo "error: $0: Task $task is empty, tasksel --task-packages $task returns nothing!"
+            retval=1
+    fi
+}
+
+if test -r /etc/debian-edu/config ; then
+    . /etc/debian-edu/config
+fi
+
+# Check if the desktop type selection worked
+check_desktop_task() {
+    desktop=$(debconf-show tasksel |tr -d "*" |awk '/tasksel\/desktop/ {print $2}')
+    pkg="education-desktop-$desktop"
+    if deb_installed "$pkg" ; then
+	echo "$0: Desktop package $pkg is installed."
+    else
+	echo "error: $0: Desktop package $pkg is not installed."
+    fi
+}
+
+retval=0
+
+apt-get update
+
+check_installed education-common
+check_installed education-tasks
+
+for value in `echo $PROFILE |sed 's/ /-/g' | sed 's/,-/ /g'`; do
+    case $value in
+	Standalone)
+	    check_installed_task education-standalone
+	    check_desktop_task
+	    ;;
+	Workstation)
+	    check_installed_task education-workstation
+	    check_desktop_task
+	    ;;
+	Roaming-Workstation)
+	    check_installed_task education-roaming-workstation
+	    check_desktop_task
+	    ;;
+	Thin-Client-Server|LTSP-server)
+	    check_installed_task education-thin-client-server
+	    check_desktop_task
+	    ;;
+	Main-Server|Server)
+	    check_installed_task education-main-server
+	    ;;
+	Sugar)
+	    check_installed_task education-desktop-sugar
+	    ;;
+	Minimal)
+	    check_installed_task education-networked
+	    ;;
+	*)
+	    echo "error: $0: unknown profile '$profile'"
+	    ;;
+    esac
+done
+
+exit $retval

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/debian-edu-config.git



More information about the debian-edu-commits mailing list