[debian-edu-commits] [Git][debian-edu/debian-edu-config][stretch] 3 commits: Enable Chromium homepage setting at installation time and via LDAP.

WolfgangSchweer gitlab at salsa.debian.org
Tue Oct 30 00:19:52 GMT 2018


WolfgangSchweer pushed to branch stretch at Debian Edu / debian-edu-config


Commits:
0a9f1592 by Wolfgang Schweer at 2018-10-29T23:47:41Z
Enable Chromium homepage setting at installation time and via LDAP.

Add cf/cf.chromium (cfengine).

Add debian/debian-edu-config.chromium-ldapconf (init script).

Add share/debian-edu-config/tools/update-chromium-homepage (used by
both cfengine and the init script).

Adjust Makefile and debian/rules. (Closes: #891262).

- - - - -
74a907ca by Mike Gabriel at 2018-10-30T00:14:33Z
update-chromium-homepage:

Don't complain about non-existing config file when attempting its removal.
Don't statically set http://www as homepage, use detected homepage
instead. (Closes: #911790)

- - - - -
9347a1e8 by Wolfgang Schweer at 2018-10-30T00:18:56Z
Add changelog entry for Mike.

- - - - -


7 changed files:

- Makefile
- + cf/cf.chromium
- debian/changelog
- + debian/debian-edu-config.chromium-ldapconf
- debian/dirs
- debian/rules
- + share/debian-edu-config/tools/update-chromium-homepage


Changes:

=====================================
Makefile
=====================================
@@ -42,6 +42,7 @@ CFFILES = \
 	cf.adduser \
 	cf.apache2 \
 	cf.apt \
+	cf.chromium \
 	cf.cfengine \
 	cf.cups \
 	cf.dhcpserver \
@@ -388,6 +389,7 @@ install: install-testsuite
 		share/debian-edu-config/tools/squid-update-cachedir \
 		share/debian-edu-config/tools/subnet-change \
 		share/debian-edu-config/tools/update-firefox-homepage \
+                share/debian-edu-config/tools/update-chromium-homepage \
 		share/debian-edu-config/tools/update-proxy-from-wpad \
 		share/debian-edu-config/tools/wpad-extract \
 		share/debian-edu-config/tools/debian-edu-dovecot-create-cert \


=====================================
cf/cf.chromium
=====================================
@@ -0,0 +1,8 @@
+shellcommands:
+	# Change default Chromium homepage. Standalone machines get our project page,
+	# while school machines get the school start page from LDAP.
+	# The clients using LDAP also update the pages at boot.
+	debian.installation.standalone::
+	"/usr/share/debian-edu-config/tools/update-chromium-homepage http\://www.skolelinux.org/"
+	debian.installation.!standalone::
+		"/usr/share/debian-edu-config/tools/update-chromium-homepage ldap\:homepage"


=====================================
debian/changelog
=====================================
@@ -1,5 +1,6 @@
 debian-edu-config (1.929+deb9u2) UNRELEASED; urgency=medium
 
+  [ Wolfgang Schweer ]
   * Fix configuration of personal web pages. (Closes: #866228).
     - Set right order of linking in cf/cf.apache2.
     - Add conditional code to d/d-e-c.postinst to fix the wrong configuration
@@ -13,6 +14,18 @@ debian-edu-config (1.929+deb9u2) UNRELEASED; urgency=medium
       otherwise installation fails because the Release file is expired.
     - 032-edu-pkgs: Move all diskless workstation installation parts to
       the finalization stage of LTSP chroot installation.
+  * Enable Chromium homepage setting at installation time and via LDAP.
+    - Add cf/cf.chromium (cfengine).
+    - Add debian/debian-edu-config.chromium-ldapconf (init script).
+    - Add share/debian-edu-config/tools/update-chromium-homepage (used by
+      both cfengine and the init script).
+    - Adjust Makefile and debian/rules. (Closes: #891262).
+
+  [ Mike Gabriel ]
+  * update-chromium-homepage:
+    - Don't complain about non-existing config file when attempting its removal.
+    - Don't statically set http://www as homepage, use detected homepage
+      instead. (Closes: #911790)
 
  -- Wolfgang Schweer <wschweer at arcor.de>  Mon, 29 Oct 2018 19:07:55 +0100
 


=====================================
debian/debian-edu-config.chromium-ldapconf
=====================================
@@ -0,0 +1,57 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          chromium-ldapconf
+# Required-Start:    $remote_fs slapd
+# Required-Stop:     $remote_fs
+# Should-Start:      $network $syslog $named slapd fetch-ldap-cert
+# Default-Start:     2 3 4 5
+# Default-Stop:
+# Short-Description: Update chromium configuration from LDAP
+# Description:
+#   Update default chromium default setup (currently only homepage)
+#   from LDAP.  Check LDAP every boot to see if the default homepage
+#   should be changed or not.
+### END INIT INFO
+#
+# Author: Petter Reinholdtsen <pere at hungry.com>
+# Date:   2011-12-31
+
+set -e
+
+. /lib/lsb/init-functions
+
+if [ -e /etc/debian-edu/config ] ; then
+    . /etc/debian-edu/config
+fi
+
+do_start() {
+    # Skip this on LTSP chroots
+    if [ -e /etc/ltsp_chroot ] ; then
+        return
+    fi
+
+    # Only networked profiles use LDAP
+    if echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then
+	/usr/share/debian-edu-config/tools/update-chromium-homepage ldap:homepage
+    fi
+
+    if echo "$PROFILE" | grep -q LTSP-Server  && [ -d /opt/ltsp ] ; then
+	for ltsp_chroot in `find /opt/ltsp/ -mindepth 1 -maxdepth 1 -type d`; do
+	    chroot $ltsp_chroot /usr/share/debian-edu-config/tools/update-chromium-homepage ldap:homepage
+	done
+    fi
+}
+
+case "$1" in
+    start)
+	do_start
+	;;
+    stop)
+	;;
+    restart|force-reload)
+	;;
+    *)
+	echo "Usage: $0 {start|stop|restart|force-reload}"
+	exit 2
+esac
+exit 0


=====================================
debian/dirs
=====================================
@@ -2,6 +2,7 @@ etc
 etc/apache2
 etc/apache2/sites-available
 etc/apache2/mods-available
+etc/chromium/policies/managed
 etc/cfengine/debian-edu
 etc/courier
 etc/cron.d


=====================================
debian/rules
=====================================
@@ -13,6 +13,7 @@ override_dh_installinit:
 	dh_installinit --init-script fetch-ldap-cert -r --no-start -u"start 95 2 3 4 5 ."
 	# Start it after 15bind9, 19slapd and 95fetch-ldap-cert, and add some to be sure
 	dh_installinit --init-script firefox-ldapconf -r --no-start -u"start 96 2 3 4 5 ."
+	dh_installinit --init-script chromium-ldapconf -r --no-start -u"start 97 2 3 4 5 ."
 	dh_installinit --init-script enable-nat --no-start
 
 override_dh_gconf:


=====================================
share/debian-edu-config/tools/update-chromium-homepage
=====================================
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Set default Chromium homepage based on URL fetched from
+# command line or LDAP.
+
+set -e
+
+etcfile=/etc/chromium/policies/managed/debian-edu-homepage-ldap.json
+
+if [ ldap:homepage = "$1" ] ; then
+    # Allow lookup script to be replaced using /etc/debian-edu/config
+    GETDEFAULTHOMEPAGE=/usr/share/debian-edu-config/tools/get-default-homepage
+    if [ -e /etc/debian-edu/config ] ; then
+	. /etc/debian-edu/config
+    fi
+    url="$($GETDEFAULTHOMEPAGE || true)"
+    if [ -z "$url" ] ; then # No LDAP available On main-server during installation
+        url="https://www/"
+    fi
+else
+    url="$1"
+fi
+
+if [ -z "$url" ] || [ "about:blank" = "$url" ]; then
+    rm $etcfile
+else
+    cat > $etcfile.new <<EOF
+{
+  "HomepageLocation" : "$url",
+  "HomepageIsNewTabPage" : false
+}
+EOF
+    chmod 644 $etcfile.new
+    if cmp -s $etcfile $etcfile.new ; then
+	rm $etcfile.new
+    else
+	mv $etcfile.new $etcfile
+	logger -t update-chromium-homepage "Updated Chromium default homepage to $url."
+    fi
+fi



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/compare/074aec5be29bf9c02041cd06256e266179d59299...9347a1e81a22be60b902e81719780654f9207e97

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/compare/074aec5be29bf9c02041cd06256e266179d59299...9347a1e81a22be60b902e81719780654f9207e97
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20181030/de4005b6/attachment-0001.html>


More information about the debian-edu-commits mailing list