diff options
| author | Marco Amadori <amadorim@vdavda.com> | 2008-09-02 10:42:11 +0200 |
|---|---|---|
| committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 17:48:02 +0100 |
| commit | 2910ae281a07441f55215ca74ec38f1d499420f2 (patch) | |
| tree | e4caef960a7e770fe9ae0078ef3962f1264bd11c /scripts | |
| parent | c8143167a7af7f3ff8c138f52c4ac637fd6c9312 (diff) | |
| download | live-boot-2910ae281a07441f55215ca74ec38f1d499420f2.tar.gz live-boot-2910ae281a07441f55215ca74ec38f1d499420f2.zip | |
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.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/live-bottom/10adduser | 22 | ||||
| -rwxr-xr-x | scripts/live-bottom/15autologin | 6 | ||||
| -rwxr-xr-x | scripts/live-bottom/22gnome_panel_data | 2 | ||||
| -rwxr-xr-x | scripts/live-bottom/30accessibility | 6 | ||||
| -rwxr-xr-x | scripts/live-bottom/32disable_hibernation | 2 | ||||
| -rwxr-xr-x | scripts/live-bottom/44pk_allow | 9 |
6 files changed, 42 insertions, 5 deletions
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 |
