Commit a9c9b032 authored by Michael Shigorin's avatar Michael Shigorin

live: use/deflogin (along with fixups)

It appears that live feature has been buggy regarding user groups: its 30-users script would create a predefined account with fixed supplementry groups list, and even if deflogin feature got used too it would fail to add any groups to already existing account since its useradd(8) call would fail. Let's drop this duplication which has been long overdue anyways. Thanks dd@ for both reporting the problem and carrying out initial investigation.
parent 54609e47
......@@ -12,12 +12,12 @@ use/deflogin:
# GROUPS are just stashed there to include USERS logins created
# basic livecd: root and altlinux users with no password at all
use/deflogin/empty: use/deflogin
use/deflogin/live: use/deflogin
@$(call set,ROOTPW_EMPTY,1)
@$(call add,USERS,altlinux::1:1)
# real thing: some control added
use/deflogin/desktop: use/deflogin/empty \
use/deflogin/desktop: use/deflogin/live \
use/deflogin/hardware use/deflogin/xgrp use/deflogin/privileges; @:
# could also be passed on the commandline
......
......@@ -12,7 +12,8 @@ _OFF = anacron blk-availability bridge clamd crond dhcpd dmeventd dnsmasq \
# copy stage2 as live
# NB: starts to preconfigure but doesn't use/cleanup yet
use/live: use/stage2 sub/rootfs@live sub/stage2@live use/services
use/live: use/stage2 sub/rootfs@live sub/stage2@live \
use/services use/deflogin/live
@$(call add_feature)
@$(call add,CLEANUP_PACKAGES,'installer*')
@$(call add,DEFAULT_SERVICES_ENABLE,$(_ON))
......@@ -31,12 +32,12 @@ use/live/rw: use/live; @:
endif
# graphical target (not enforcing xorg drivers or blobs)
use/live/x11: use/live/base use/x11-autologin use/sound +power +efi
use/live/x11: use/live/base use/syslinux/localboot.cfg \
use/deflogin/desktop use/x11-autologin use/sound +power +efi
@$(call add,LIVE_LISTS,$(call tags,desktop && (live || network)))
@$(call add,LIVE_LISTS,$(call tags,base l10n))
@$(call add,LIVE_PACKAGES,fonts-ttf-dejavu fonts-ttf-droid)
@$(call add,LIVE_PACKAGES,pciutils)
@$(call add,SYSLINUX_CFG,localboot)
# this target specifically pulls free xorg drivers in (and a few more bits)
use/live/desktop: use/live/x11 use/x11/xorg use/x11/wacom \
......
#!/bin/sh
# * reset password for root
# * add user `altlinux' (without password)
GRPLIST="users scanner audio radio proc cdwriter wheel fuse netadmin xgrp"
verbose()
{
if [ -n "$GLOBAL_VERBOSE" ]; then
echo "HOOK: 30-users: $@"
fi
}
add_user()
{
verbose "Add $1 user"
local groups=
for g in $GRPLIST; do
if groupmod $g 2>/dev/null; then
if [ -n "$groups" ]; then
groups="$groups,$g"
else
groups="$g"
fi
fi
done
useradd -p "" -G "$groups" "$1" ||:
# Workaround for ALT#13213
chown -R "$1:auth" "/etc/tcb/$1"
chown -R "$1:$1" /home/$1
if [ -n "$GLOBAL_CRYPT_HOMES" ]; then
verbose "Set password for user $1"
echo "$1" | passwd --stdin $1
fi
sudoers="/etc/sudoers"
if [ -w "$sudoers" ]; then
verbose "Add $1 to sudoers."
echo "$1 ALL=(root) NOPASSWD:ALL" >> "$sudoers"
else
verbose "Can't find writable $sudoers file."
fi
echo "Hello friend, say \`$1' to log in at \\l" >> /etc/issue
}
verbose "has started"
verbose "Clear password for root account"
usermod -p "" root
add_user altlinux
verbose "finished"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment