[SCM] Debian Live initramfs hook branch, master, updated. 1.139.1-2-19-g79d1725

Marco Amadori amadorim at vdavda.com
Wed Sep 17 06:52:04 UTC 2008


The following commit has been merged in the master branch:
commit 5a52673e09893e49ed495a31e16af6111da91528
Author: Marco Amadori <amadorim at vdavda.com>
Date:   Tue Sep 2 10:42:11 2008 +0200

    Fix default user handling.
    
    * Handle the case in which an user is present but the default user could not
      be created (e.g. when configuring another user at build time in the
      chroot). If the default user could not be created or assigned, disable
      autologins (which previously just fails leaving without console login
      capabilities), and propagate that information to the scripts thinking that a
      default user will always be available.
      Note for live-helper documentation: The latter case could leave the system
      accessible only if root password is set in other ways or via ssh rsa/dsa
      passwordless accesses.
    
    Signed-off-by: Marco Amadori <amadorim at vdavda.com>

diff --git a/scripts/live-bottom/10adduser b/scripts/live-bottom/10adduser
index 7498476..4c0fe80 100755
--- a/scripts/live-bottom/10adduser
+++ b/scripts/live-bottom/10adduser
@@ -58,6 +58,28 @@ set passwd/username
 set passwd/user-uid
 EOF
 
+if ! grep "${USERNAME}" /root/etc/passwd
+then
+	echo "The default user (${USERNAME}) is not present,"
+	first_user=$(grep '^[^:]*:[^:]*:[12]\?[0-9][0-9][0-9][0-9]:' /root/etc/passwd | head -1 | cut -f1 -d ':')
+	if [ -n "${first_user}" ];
+	then
+		echo "setting default user to: ${first_user}."
+		USERNAME="${first_user}"
+		really_export USERNAME
+	else
+		echo "no other valid users found, disabling autologin."
+		NOAUTOLOGIN="Yes"
+		NOXAUTOLOGIN="Yes"
+		USERNAME=""
+		really_export NOAUTOLOGIN
+		really_export NOXAUTOLOGIN
+		really_export USERNAME
+		log_end_msg
+		exit 0
+	fi
+fi
+
 if [ -z "${NOSUDO}" ]
 then
 	if ! grep -q "${USERNAME}" /root/etc/sudoers
diff --git a/scripts/live-bottom/15autologin b/scripts/live-bottom/15autologin
index bb9902e..28a3141 100755
--- a/scripts/live-bottom/15autologin
+++ b/scripts/live-bottom/15autologin
@@ -20,13 +20,13 @@ esac
 
 # live-initramfs header
 
-if [ -n "${NOXAUTOLOGIN}" ]
+. /scripts/live-functions
+
+if [ -n "${NOXAUTOLOGIN}" ] || [ -z "${USERNAME}" ]
 then
 	exit 0
 fi
 
-. /scripts/live-functions
-
 log_begin_msg "Setting up automatic login"
 
 # live-initramfs script
diff --git a/scripts/live-bottom/22gnome_panel_data b/scripts/live-bottom/22gnome_panel_data
index 9767e45..bd0be26 100755
--- a/scripts/live-bottom/22gnome_panel_data
+++ b/scripts/live-bottom/22gnome_panel_data
@@ -41,7 +41,7 @@ fi
 
 panel_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-panel-data 2>/dev/null) || panel_version=""
 
-if [ -n "${panel_version}" ]
+if [ -n "${panel_version}" ] && [ -n "${USERNAME}" ]
 then
 	chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true
 fi
diff --git a/scripts/live-bottom/30accessibility b/scripts/live-bottom/30accessibility
index 7753154..a169342 100755
--- a/scripts/live-bottom/30accessibility
+++ b/scripts/live-bottom/30accessibility
@@ -27,6 +27,12 @@ fi
 
 . /scripts/live-functions
 
+if [ -z "${USERNAME}" ]
+then
+	echo "No default user for accessibility options."
+	exit 0
+fi
+
 log_begin_msg "Configuring accessibility options"
 
 # live-initramfs script
diff --git a/scripts/live-bottom/32disable_hibernation b/scripts/live-bottom/32disable_hibernation
index 8c9eb9a..f4960e6 100755
--- a/scripts/live-bottom/32disable_hibernation
+++ b/scripts/live-bottom/32disable_hibernation
@@ -33,7 +33,7 @@ log_begin_msg "Configuring power management"
 
 gpm_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-power-manager 2>/dev/null) || panel_version=""
 
-if [ -n "${gpm_version}" ]
+if [ -n "${gpm_version}" ] && [ -n "${USERNAME}" ]
 then
 	#live-reconfigure /root gnome-power-manager
 	# Gnome < 2.20
diff --git a/scripts/live-bottom/44pk_allow b/scripts/live-bottom/44pk_allow
index 7fd026e..fec6401 100755
--- a/scripts/live-bottom/44pk_allow
+++ b/scripts/live-bottom/44pk_allow
@@ -40,10 +40,19 @@ cat << EOF > /root/etc/PolicyKit/PolicyKit.conf
 	<match user="root">
 		<return result="yes"/>
 	</match>
+EOF
+
+if [ -n "${USERNAME}" ]
+then
+	cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
 	<!-- don't ask password for user in live session -->
 	<match user="$USERNAME">
 		<return result="yes"/>
 	</match>
+EOF
+fi
+
+cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
 	<define_admin_auth group="admin"/>
 </config>
 EOF

-- 
Debian Live initramfs hook



More information about the debian-live-changes mailing list