[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] 3 commits: Update proxy settings in dconf

Mike Gabriel (@sunweaver) gitlab at salsa.debian.org
Tue Aug 22 14:21:13 BST 2023



Mike Gabriel pushed to branch master at Debian Edu / debian-edu-config


Commits:
7c4d3a12 by Guido Berhoerster at 2023-08-21T09:54:01+02:00
Update proxy settings in dconf

This adds support in update-proxy-from-wpad for setting the proxy default
values in dconf.  The values are added to a site database, it also packages an
empty local database in order to obviate the need to modify the user profile.
(Closes: #955702)

- - - - -
a3a6e9f5 by Guido Berhoerster at 2023-08-21T10:22:45+02:00
Remove use of obsolete grep aliases

These have been obsolete forever and have been removed from GNU grep upstream.

- - - - -
34b9ae60 by Guido Berhoerster at 2023-08-21T10:22:45+02:00
Use command -v builtin over external which command

- - - - -


27 changed files:

- Makefile
- debian/debian-edu-config.postinst
- debian/debian-edu-config.postrm
- debian/dirs
- etc/X11/Xsession.d/09debian-edu-missing-home
- + etc/dconf/profile/user
- etc/dhcp/dhclient-exit-hooks.d/hostname
- sbin/debian-edu-pxeinstall
- share/debian-edu-config/d-i/finish-install
- share/debian-edu-config/tools/gosa-remove
- share/debian-edu-config/tools/preseed-sitesummary
- share/debian-edu-config/tools/setup-ad-client
- share/debian-edu-config/tools/show-welcome-webpage
- share/debian-edu-config/tools/sssd-generate-config
- share/debian-edu-config/tools/update-proxy-from-wpad
- testsuite/automount
- testsuite/dhcpd
- testsuite/hardware
- testsuite/ldap-client
- testsuite/locale
- testsuite/ntp
- testsuite/rdp-server
- testsuite/samba
- testsuite/sudo
- testsuite/webcache
- testsuite/webserver
- testsuite/workstation


Changes:

=====================================
Makefile
=====================================
@@ -95,6 +95,7 @@ SYSCONFFILES = \
 	X11/Xsession.d/09debian-edu-missing-home \
 	X11/Xsession.d/10debian-edu-one-login-per-host \
 	X11/Xsession.d/55lightdm_gtk-greeter-rc \
+	dconf/profile/user \
 	debian-edu/nightkill.conf \
 	debian-edu/pxeinstall.conf \
 	default/munin-node \


=====================================
debian/debian-edu-config.postinst
=====================================
@@ -94,9 +94,9 @@ db_stop
 
 
 # start the enable-nat init script if we have a ltspserver
-if [ -f /etc/debian-edu/config ] && egrep -q "(LTSP-Server|Thin-Client-Server)" /etc/debian-edu/config ; then
+if [ -f /etc/debian-edu/config ] && grep -Eq "(LTSP-Server|Thin-Client-Server)" /etc/debian-edu/config ; then
 	if ! grep -q Main-Server /etc/debian-edu/config ; then
-		if [ -x "`which invoke-rc.d 2>/dev/null`" ] ; then
+		if command -v invoke-rc.d >/dev/null; then
 			invoke-rc.d enable-nat start || exit $?
 		else
 			/etc/init.d/enable-nat start || exit $?
@@ -201,6 +201,9 @@ configure)
 	if dpkg --compare-versions "$2" le "2.12.33"; then
 	    update-rc.d -f fetch-ldap-cert remove
 	fi
+
+	# Update dconf databases
+	command -v dconf >/dev/null && dconf update
     ;;
 esac
 


=====================================
debian/debian-edu-config.postrm
=====================================
@@ -6,7 +6,7 @@ case "$1" in
     remove)
         # Calling the init script during removal
 	if [ -x "/etc/init.d/enable-nat" ] ; then
-	    if [ -x "`which invoke-rc.d 2>/dev/null`" ] ; then
+	    if command -v invoke-rc.d >/dev/null ; then
 		invoke-rc.d enable-nat stop || exit $?
 	    else
 		/etc/init.d/enable-nat stop || exit $?
@@ -17,6 +17,9 @@ case "$1" in
 	    rm -rf /var/lib/cfengine3/inputs/
 	    mkdir /var/lib/cfengine3/inputs/
 	fi
+
+	# Update dconf databases
+	command -v dconf >/dev/null && dconf update
 	;;
     purge)
 	# remove user/group debian-edu from system


=====================================
debian/dirs
=====================================
@@ -5,6 +5,11 @@ etc/apache2/mods-available
 etc/chromium/policies/managed
 etc/cron.d
 etc/cups
+etc/dconf
+etc/dconf/profile
+etc/dconf/db
+etc/dconf/db/local.d
+etc/dconf/db/site.d
 etc/debian-edu
 etc/default
 etc/exports.d


=====================================
etc/X11/Xsession.d/09debian-edu-missing-home
=====================================
@@ -4,7 +4,7 @@
 # Should not run on Main-Server, Roaming-Workstation and Standalone
 if [ -r /etc/debian-edu/config ] ; then
     . /etc/debian-edu/config
-    if echo "$PROFILE" | egrep -q 'Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then
+    if echo "$PROFILE" | grep -Eq 'Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then
 	if [ ! -d $HOME -o / = "$HOME" ] ; then
 	    cat <<EOF | \
 		xmessage -buttons Understood:0 -timeout 30 -center -file - 


=====================================
etc/dconf/profile/user
=====================================
@@ -0,0 +1,3 @@
+user-db:user
+system-db:local
+system-db:site


=====================================
etc/dhcp/dhclient-exit-hooks.d/hostname
=====================================
@@ -19,10 +19,10 @@ if [ -r /etc/debian-edu/config ] ; then
 	. /etc/debian-edu/config
 fi
 
-if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|Roaming-Workstation|Standalone' ; then
 	exit 0
 	else
-	    if echo "$PROFILE" | egrep -q 'Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then
+	    if echo "$PROFILE" | grep -Eq 'Workstation|LTSP-Server|Thin-Client-Server|Minimal' ; then
 	        :
 	    fi
 fi


=====================================
sbin/debian-edu-pxeinstall
=====================================
@@ -247,7 +247,7 @@ choose-mirror-bin     mirror/http/hostname    string  deb.debian.org
 choose-mirror-bin     mirror/http/directory   string  /debian
 EOF
 	else
-	debconf-get-selections --installer | egrep -w 'mirror/http/mirror|mirror/country|mirror/protocol|mirror/http/hostname|mirror/http/directory|mirror/ftp/hostname|mirror/ftp/directory' | sort
+	debconf-get-selections --installer | grep -Ew 'mirror/http/mirror|mirror/country|mirror/protocol|mirror/http/hostname|mirror/http/directory|mirror/ftp/hostname|mirror/ftp/directory' | sort
 	fi
 
 	# Make it easier to have local overrides and still be able to


=====================================
share/debian-edu-config/d-i/finish-install
=====================================
@@ -135,7 +135,7 @@ echo "info: processes using mount point below /target"
 mountpoints="$(grep " /target" /proc/mounts | cut -d" " -f2 | sed s%/target%%g)"
 LANG=C chroot /target fuser -mv $mountpoints 2>&1 | sed 's/^/info: /'
 
-if LANG=C chroot /target fuser -mv $mountpoints 2>&1 | egrep -qv 'USER|mount |Cannot open ' ; then
+if LANG=C chroot /target fuser -mv $mountpoints 2>&1 | grep -Eqv 'USER|mount |Cannot open ' ; then
 	log "error: some processes blocking d-i from umounting /target/"
 fi
 


=====================================
share/debian-edu-config/tools/gosa-remove
=====================================
@@ -31,11 +31,11 @@ PREFIX=/skole
 MY_HOSTNAME=$(hostname -s)
 
 # Obviously a user template was removed. Ignoring.
-echo "$HOMEDIR" | egrep -q "^$PREFIX/$MY_HOSTNAME.*/%uid" && exit 0
+echo "$HOMEDIR" | grep -Eq "^$PREFIX/$MY_HOSTNAME.*/%uid" && exit 0
 
 # An LDAP user that did not have their home at a place we manage with this script
 # has been removed. This should not happen. Exiting with error.
-echo "$HOMEDIR" | egrep -q "^$PREFIX/$MY_HOSTNAME.*$USERID" || exit 1
+echo "$HOMEDIR" | grep -Eq "^$PREFIX/$MY_HOSTNAME.*$USERID" || exit 1
 
 ## move mail directory to home directory
 if [ -d /var/mail/$USERID ]; then


=====================================
share/debian-edu-config/tools/preseed-sitesummary
=====================================
@@ -27,7 +27,7 @@ sitesummaryserver=sitesummary
 if ping -c2 sitesummary > /dev/null 2>&1 ; then
    sitesummaryserver=$(getent hosts sitesummary | awk '{print $2}')
 else
-    host=$(LC_ALL=C host -N 2 -t SRV _sitesummary._tcp | egrep -v '^;|NXDOMAIN|SERVFAIL' | awk '{print $NF}' | head -1)
+    host=$(LC_ALL=C host -N 2 -t SRV _sitesummary._tcp | grep -Ev '^;|NXDOMAIN|SERVFAIL' | awk '{print $NF}' | head -1)
     if [ "$host" ] && ping -c2 "$host" ; then
 	sitesummaryserver=$(echo $host | sed 's/\.$//')
     fi


=====================================
share/debian-edu-config/tools/setup-ad-client
=====================================
@@ -7,7 +7,7 @@ set -e
 # See if we can find an Active Directory LDAP server.
 lookup_ad_server() {
     dnsdomain="$1"
-    adserver=$(host -N 2 -t SRV _ldap._tcp.$dnsdomain | egrep -v 'NXDOMAIN|^;' | awk '{print $NF}' | head -1)
+    adserver=$(host -N 2 -t SRV _ldap._tcp.$dnsdomain | grep -Ev 'NXDOMAIN|^;' | awk '{print $NF}' | head -1)
     if [ "$adserver" ] ; then
 	echo $adserver | sed 's/\.$//'
     fi


=====================================
share/debian-edu-config/tools/show-welcome-webpage
=====================================
@@ -14,7 +14,7 @@ if [ -e /etc/debian-edu/config ] ; then
 fi
 
 if [ "$GETDEFAULTHOMEPAGE" ] &&
-	echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
+	echo "$PROFILE" | grep -Eq 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
 	if [ "$GETDEFAULTHOMEPAGE" = "http://www/" ] || [ "$GETDEFAULTHOMEPAGE" = "https://www/" ] ; then
 		for lang in $(echo $LANGCODE | tr : " "); do
 			if wget -q -O /dev/null ${GETDEFAULTHOMEPAGE}index.html.$lang ; then


=====================================
share/debian-edu-config/tools/sssd-generate-config
=====================================
@@ -14,7 +14,7 @@ lookup_ldap_uri() {
     if ping -c2 ldap.$domain > /dev/null 2>&1; then
 	echo ldap://ldap.$domain
     else
-	host=$(host -N 2 -t SRV _ldap._tcp.$domain | egrep -v 'NXDOMAIN|^;' | awk '{print $NF}' | head -1)
+	host=$(host -N 2 -t SRV _ldap._tcp.$domain | grep -Ev 'NXDOMAIN|^;' | awk '{print $NF}' | head -1)
 	if [ "$host" ] ; then
 	    echo ldap://$host | sed 's/\.$//'
 	fi
@@ -33,7 +33,7 @@ lookup_ldap_base() {
 	    if ldapsearch -LLL -H $ldapuri -x -b "$context" -s sub -z 1 \
 	        '(|(objectClass=posixAccount)(objectclass=posixGroup))' 2>&1 | \
 	        perl -p0e 's/\n //g' | \
-		egrep -q '^dn:|^Administrative limit exceeded' ; then
+		grep -Eq '^dn:|^Administrative limit exceeded' ; then
 		echo $context
 		return
 	    fi


=====================================
share/debian-edu-config/tools/update-proxy-from-wpad
=====================================
@@ -96,6 +96,29 @@ update_apt_conf() {
 	fi
 }
 
+update_dconf() {
+	proxy_host="${http_proxy#*://}"
+	proxy_port="${proxy_host##*:}"
+	proxy_host="${proxy_host%:*}"
+	cat >/etc/dconf/db/site.d/50-proxy <<EOF
+[system/proxy/http]
+host='${proxy_host}'
+port=${proxy_port}
+enabled=true
+
+[system/proxy/https]
+host='${proxy_host}'
+port=${proxy_port}
+enabled=true
+
+[system/proxy/ftp]
+host='${proxy_host}'
+port=${proxy_port}
+enabled=true
+EOF
+	dconf update
+}
+
 if [ -r /etc/debian-edu/config ] ; then
 	. /etc/debian-edu/config
 fi
@@ -116,11 +139,13 @@ else
 
 	update_apt_conf
 
-	# Do not set proxy in /etc/environment for machines that move around,
-	# as the value will be wrong when arriving at a new network.
-	if echo "$PROFILE" | egrep -q 'Roaming-Workstation|Standalone' ; then
-		:
-	else
+	# Do not set proxy in /etc/environment and dconf for machines that
+	# move around, # as the value will be wrong when arriving at a new
+	# network.
+	case $PROFILE in
+	*Roaming-Workstation*|*Standalone*) ;;
+	*)
 		update_etc_environment
-	fi
+		update_dconf
+	esac
 fi


=====================================
testsuite/automount
=====================================
@@ -12,7 +12,7 @@ fi
 
 # Automount is not used on the Main-Server, Roaming workstation and
 # Standalone profiles.
-if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|Roaming-Workstation|Standalone' ; then
     exit 0
 fi
 


=====================================
testsuite/dhcpd
=====================================
@@ -7,7 +7,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only main-server and thin-client server profiles run dhcpd
-if echo "$PROFILE" | egrep -q 'Main-Server|LTSP-Server' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|LTSP-Server' ; then
     :
 else
     exit 0


=====================================
testsuite/hardware
=====================================
@@ -33,7 +33,7 @@ for file in cpuinfo ioports iomem interrupts meminfo ; do
 	fi
 done
 
-disks=`cat /proc/partitions|egrep 'ide|scsi'|awk '{print $4}'|grep '/disc'|sed 's%^%/dev/%'`
+disks=`cat /proc/partitions|grep -E 'ide|scsi'|awk '{print $4}'|grep '/disc'|sed 's%^%/dev/%'`
 for disk in $disks ; do
 	/sbin/hdparm -i $disk 2>&1 |  sed "s%^%info: $0: hdparm: %"
 done


=====================================
testsuite/ldap-client
=====================================
@@ -16,7 +16,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only networked profiles use LDAP
-if echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
     :
 else
     exit 0
@@ -51,7 +51,7 @@ for file in nslcd.conf ; do
 done
 
 # Verify that NSS is properly configured for netgroups in LDAP.
-if egrep -q '^netgroup: +nis *.* +(ldap|sss)$' /etc/nsswitch.conf ; then
+if grep -Eq '^netgroup: +nis *.* +(ldap|sss)$' /etc/nsswitch.conf ; then
     success "NSS netgroup setting is correct in /etc/nsswitch.conf"
 else
     error "NSS netgroup setting is wrong in /etc/nsswitch.conf"
@@ -60,7 +60,7 @@ fi
 SERVICES="nslcd"
 
 # Roaming workstations use sssd for caching, and not nscd
-if echo "$PROFILE" | egrep -q 'Roaming-Workstation' ; then
+if echo "$PROFILE" | grep -Eq 'Roaming-Workstation' ; then
     SERVICES="$SERVICES sssd"
 else
     ls -l /var/cache/nscd/ | sed "s/^/info: nscd cache: /"
@@ -72,7 +72,7 @@ host -a -t srv _ldap._tcp | sed "s/^/info: SRV record from DNS: /"
 host -a "$ldap_server" | sed "s/^/info: LDAP server from DNS: /"
 
 if [ -f /etc/nslcd.conf ] ; then
-    if egrep -q "^uri (ldap|$ldap_server)" /etc/nslcd.conf ; then
+    if grep -Eq "^uri (ldap|$ldap_server)" /etc/nslcd.conf ; then
         :
     else
         error "ldap/ldap.conf misses definition of HOST ldap"


=====================================
testsuite/locale
=====================================
@@ -4,7 +4,7 @@
 
 echo "info: $0: install locale: '$LANG' '$LANGUAGE'"
 
-env|egrep 'LC|LANG' | sed "s%^%info: $0: install env: %"
+env|grep -E 'LC|LANG' | sed "s%^%info: $0: install env: %"
 
 locale | sed "s%^%info: $0: locale: %"
 locale charmap | sed "s%^%info: $0: locale charmap: %"


=====================================
testsuite/ntp
=====================================
@@ -7,7 +7,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only networked profiles use NTP
-if echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
     :
 else
     exit 0


=====================================
testsuite/rdp-server
=====================================
@@ -9,7 +9,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only LTSP-Server profiles provide RDP
-if echo "$PROFILE" | egrep -q 'LTSP-Server' ; then
+if echo "$PROFILE" | grep -Eq 'LTSP-Server' ; then
     :
 else
     exit 0


=====================================
testsuite/samba
=====================================
@@ -11,7 +11,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only Main-Server install samba
-if echo "$PROFILE" | egrep -q 'Main-Server' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server' ; then
     :
 else
     exit 0


=====================================
testsuite/sudo
=====================================
@@ -7,7 +7,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Standalone profile do not use LDAP based sudo
-if echo "$PROFILE" | egrep -q 'Standalone' ; then
+if echo "$PROFILE" | grep -Eq 'Standalone' ; then
     exit 0
 fi
 


=====================================
testsuite/webcache
=====================================
@@ -7,7 +7,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only networked profiles use squid
-if echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
     :
 else
     exit 0
@@ -37,7 +37,7 @@ fi
 # Wait for 10 seconds
 HEADOPTS="-t 10"
 
-if echo "$PROFILE" | egrep -q 'Main-Server' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server' ; then
     # Test that the binary exist
     if test -x /usr/sbin/squid ; then
         echo "success: $0: Binary /usr/sbin/squid is present."
@@ -52,7 +52,7 @@ if echo "$PROFILE" | egrep -q 'Main-Server' ; then
         exit 1
     fi
 
-    if egrep -q '^refresh_pattern \(Release\|Package\(.gz\)\*\)$' /etc/squid/squid.conf
+    if grep -Eq '^refresh_pattern \(Release\|Package\(.gz\)\*\)$' /etc/squid/squid.conf
     then
         echo "error: $0: squid typo causing APT problem is present (#591839)."
     else


=====================================
testsuite/webserver
=====================================
@@ -9,7 +9,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only networked profiles should have the https certificates
-if echo "$PROFILE" | egrep -q 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
+if echo "$PROFILE" | grep -Eq 'Main-Server|Workstation|Roaming-Workstation|LTSP-Server|Minimal' ; then
     :
 else
     exit 0


=====================================
testsuite/workstation
=====================================
@@ -7,7 +7,7 @@ if test -r /etc/debian-edu/config ; then
 fi
 
 # Only Workstation profiles use squid
-if echo "$PROFILE" | egrep -q 'Workstation|Roaming-Workstation|LTSP-Server' ; then
+if echo "$PROFILE" | grep -Eq 'Workstation|Roaming-Workstation|LTSP-Server' ; then
     :
 else
     exit 0



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/ce6678053be939d1bad5f93e4b6cd00ad9a7f0ac...34b9ae60484989b676efba3dfce2ea61d557b317

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/ce6678053be939d1bad5f93e4b6cd00ad9a7f0ac...34b9ae60484989b676efba3dfce2ea61d557b317
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/20230822/cd4dd8c1/attachment-0001.htm>


More information about the debian-edu-commits mailing list