[debian-edu-commits] debian-edu/ 01/02: Enable Chromium homepage setting at installation time and via LDAP.
Wolfgang Schweer
schweer-guest at moszumanska.debian.org
Thu Oct 26 22:26:20 UTC 2017
This is an automated email from the git hooks/post-receive script.
schweer-guest pushed a commit to branch master
in repository debian-edu-config.
commit 9e6ca69afe6451370c841d4fe1b4192f8d18c54f
Author: Wolfgang Schweer <wschweer at arcor.de>
Date: Fri Oct 27 00:19:53 2017 +0200
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.
---
Makefile | 1 +
cf/cf.chromium | 9 ++++
debian/changelog | 11 +++++
debian/debian-edu-config.chromium-ldapconf | 57 ++++++++++++++++++++++
debian/rules | 1 +
.../tools/update-chromium-homepage | 40 +++++++++++++++
6 files changed, 119 insertions(+)
diff --git a/Makefile b/Makefile
index f64cc7e..142e3a3 100644
--- a/Makefile
+++ b/Makefile
@@ -386,6 +386,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 \
diff --git a/cf/cf.chromium b/cf/cf.chromium
new file mode 100644
index 0000000..11d1903
--- /dev/null
+++ b/cf/cf.chromium
@@ -0,0 +1,9 @@
+#
+# 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"
diff --git a/debian/changelog b/debian/changelog
index 83cd081..0d4f4c6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+debian-edu-config (1.937) UNRELEASED; urgency=medium
+
+ * 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.
+
+ -- Wolfgang Schweer <wschweer at arcor.de> Fri, 27 Oct 2017 00:03:16 +0200
+
debian-edu-config (1.936) unstable; urgency=medium
[ Wolfgang Schweer ]
diff --git a/debian/debian-edu-config.chromium-ldapconf b/debian/debian-edu-config.chromium-ldapconf
new file mode 100755
index 0000000..210573c
--- /dev/null
+++ b/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
diff --git a/debian/rules b/debian/rules
index 4341a08..32e2687 100755
--- a/debian/rules
+++ b/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:
diff --git a/share/debian-edu-config/tools/update-chromium-homepage b/share/debian-edu-config/tools/update-chromium-homepage
new file mode 100755
index 0000000..2facd16
--- /dev/null
+++ b/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="http://www/"
+ fi
+else
+ url="$1"
+fi
+
+if [ -z "$url" ] || [ "about:blank" = "$url" ]; then
+ rm $etcfile
+else
+ cat > $etcfile.new <<EOF
+{
+ "HomepageLocation": "http://www",
+ "homepage_is_newtabpage": false
+}
+EOF
+ chmod 644 $etcfile.new
+ if cmp -s $etcfile $etcfile.new ; then
+ rm $etcfile.new
+ else
+ mv $etcfile.new $etcfile
+ logger -t update-firefox-homepage "Updated Chromium default homepage to $url."
+ fi
+fi
--
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