[debian-edu-commits] [Git][debian-edu/debian-edu-install][master] 2 commits: Whitespace: normalisation

Mike Gabriel (@sunweaver) gitlab at salsa.debian.org
Fri Sep 25 08:25:32 BST 2026



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


Commits:
d1532f5e by Roland Clobus at 2026-09-25T07:07:31+00:00
Whitespace: normalisation

- - - - -
1d2f3990 by Roland Clobus at 2026-09-25T07:07:31+00:00
etckeeper: nicer log messages

* Avoid `/.gitconfig`. (Closes: #1117842)
* Warn about misuse of direct `git commit` commands

- - - - -


1 changed file:

- tools/edu-etcvcs


Changes:

=====================================
tools/edu-etcvcs
=====================================
@@ -17,23 +17,39 @@ error() {
 commit() {
     info "Running etckeeper commit"
     if [ -x /target/usr/bin/etckeeper ] ; then
-	in-target /usr/bin/etckeeper \
-	    commit "Automatic commit during installation" || true
+        in-target /usr/bin/etckeeper \
+            commit "Automatic commit during installation" || true
     fi
 }
 
 init() {
     if [ -x /target/usr/bin/etckeeper ] && [ -d /target/etc/.git ]; then
-	return
+        # Already installed and initialised
+        return
     fi
+    if [ ! -x /target/usr/bin/git ]; then
+        apt-install git || true
+    fi
+    # Configure git to prevent messages about the default branch
+    OLD_DEFAULTBRANCH=$(in-target --pass-stdout git config get --global init.defaultBranch || true)
+    in-target git config set --global init.defaultBranch main
+    # The postinst of etckeeper initialises /etc/.git
     apt-install etckeeper || true
+    # Restore the original git configuration
+    if [ -z ${OLDDEFAULTBRANCH} ]; then
+        in-target git config unset --global init.defaultBranch
+    else
+        in-target git config set --global init.defaultBranch "${OLD_DEFAULTBRANCH}"
+    fi
+    # If this was a fresh installation, $HOME was not set and the configuration file is empty
+    if [ ! -s /target/.gitconfig ]; then
+        rm -f /target/.gitconfig
+    fi
     if [ -x /target/usr/bin/etckeeper ] ; then
-        if in-target /usr/bin/etckeeper init ; then
-            in-target /usr/bin/etckeeper vcs config --global user.name "Local Administrator"
-	    in-target /usr/bin/etckeeper vcs config --global user.email "root at localhost"
-	else
-	    info "Running etckeeper init failed"
-	fi
+        echo -e "#!/bin/sh\ncd /etc\ngit config user.name \"STOP! Use 'etckeeper commit' instead\"" > /target/set_git_username.sh
+        chmod a+x /target/set_git_username.sh
+        in-target /set_git_username.sh
+        rm -f /target/set_git_username.sh
     else
         error "Unable to install and enable etckeeper"
     fi
@@ -41,9 +57,9 @@ init() {
 
 case "$1" in
     init)
-	init
-	;;
+        init
+        ;;
     commit)
-	commit
-	;;
+        commit
+        ;;
 esac



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-install/-/compare/d6e4aa3f85a66a034e614edcaf4244664b03a2ba...1d2f399011113f3b5e850210170beda59cef0b36

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-install/-/compare/d6e4aa3f85a66a034e614edcaf4244664b03a2ba...1d2f399011113f3b5e850210170beda59cef0b36
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20260925/c9ea02f8/attachment-0001.htm>


More information about the debian-edu-commits mailing list