ALT Linux Bugzilla
– Attachment 6407 Details for
Bug 30037
Добавить в альтератор(ACC) пункт "Автологин"
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
autologin-sh-functions
autologin-sh-functions (text/plain), 4.81 KB, created by
Michael Shigorin
on 2015-10-23 19:24:37 MSK
(
hide
)
Description:
autologin-sh-functions
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2015-10-23 19:24:37 MSK
Size:
4.81 KB
patch
obsolete
>#!/bin/sh > ># FIXME: Ñмена/ÑнÑÑие ÑзеÑа > >al_add_nopasswdlogin_group() >{ > [ -f "/etc/pam.d/$1" ] && > egrep -qs \ > '^auth.+user[[:blank:]]+ingroup[[:blank:]]+nopasswdlogin' > "/etc/pam.d/$1" && > ! groupmems -l -g nopasswdlogin >&/dev/null && > groupadd -r nopasswdlogin && > gpasswd -a "$USER" nopasswdlogin ||: >} > >al_backup() { > local BAK=".save" > [ -f "$1" -a ! -f "$1$BAK" ] || return 1 > cp -av "$1" "$1$BAK" >} > >## this is only relevant for installable livecd, noop otherwise >al_restore_later() { > local BAK=".save" > [ -n "$1" ] || return 0 > > local prefix="/usr/lib/alterator/hooks/livecd-preinstall.d" > [ -d "$prefix" ] || return 0 > > local hook="$prefix/51-disable-autologin-again.sh" > [ -s "$hook" ] || cat >> "$hook" <<- EOF > #!/bin/sh > . livecd-functions > EOF > > echo mv -v "\$destdir$1$BAK" "\$destdir$1" >> "$hook" > chmod +x "$hook" >} > >al_enable() { > >if [ ! -x /usr/bin/X ]; then > echo "SKIP autologin: X not installed" >&2 > return 0 >fi > >local USER=altlinux > >## autologin^2 >AUTOLOGIN_CFG=/etc/sysconfig/autologin >if [ -x /usr/sbin/autologin ]; then > al_backup "$AUTOLOGIN_CFG" > cat >> "$AUTOLOGIN_CFG" <<- EOF > USER=$USER > AUTOLOGIN=yes > EOF > al_restore_later "$AUTOLOGIN_CFG" >fi > >## lightdm autologin >LIGHTDM_CONF=/etc/lightdm/lightdm.conf >if [ -f "$LIGHTDM_CONF" ]; then > al_backup "$LIGHTDM_CONF" > sed -i \ > -e "s/^#\(autologin-user=\).*$/\1$USER/" \ > -e "s/^#\(autologin-user-timeout=0\)/\1/" \ > "$LIGHTDM_CONF" > al_backup "/etc/group" > al_add_nopasswdlogin_group lightdm > > al_restore_later "$LIGHTDM_CONF" > al_restore_later "/etc/group" >fi > >## gdm2 autologin >GDM_CONF=/etc/X11/gdm/custom.conf >if [ -f "$GDM_CONF" ]; then > al_backup "$GDM_CONF" > sed -i '/\[daemon\]/aAutomaticLoginEnable=true\nAutomaticLogin='$USER \ > "$GDM_CONF" > al_backup "/etc/group" > al_add_nopasswdlogin_group gdm > > al_restore_later "$GDM_CONF" > al_restore_later "/etc/group" >fi > >autologin_kdm() { > al_backup "$1" > sed -i \ > -e '/AutoLoginEnable/ s,^.*$,AutoLoginEnable=true,' \ > -e '/AutoLoginUser/ s,^.*$,AutoLoginUser='$USER',' \ > "$1" > al_restore_later "$1" >} > >## kdm3 autologin ># FIXME: tde packages have kdmrc in /usr via an absolute symlink :-( >KDM_ETC=/etc/X11/kdm >KDM_USR=/usr/share/kde/config/kdm >if [ "$(readlink "$KDM_ETC")" = "$KDM_USR" ]; then > rm -f "$KDM_ETC" > ln -s ../.."$KDM_USR" "$KDM_ETC" >fi > >KDMRC=/etc/X11/kdm/kdmrc >if [ -f "$KDMRC" ]; then autologin_kdm "$KDMRC"; fi > >## kdm4 autologin >KDMRC=/etc/X11/kdm4/kdmrc >if [ -f "$KDMRC" ]; then autologin_kdm "$KDMRC"; fi > >## sddm autologin >SDDM_RC=/etc/X11/sddm/sddm.conf >SDDM_SESSION= >if [ -f "$SDDM_RC" ]; then > al_backup "$SDDM_RC" > sed -i "s,^User=$,&$USER," "$SDDM_RC" > if [ -f /usr/share/xsessions/lxqt.desktop ]; then > SDDM_SESSION=LXQt > elif [ -f /usr/share/xsessions/plasma.desktop ]; then > SDDM_SESSION=plasma > fi > if [ -n "$SDDM_SESSION" ]; then > sed -i "s,^Session=$,&$SDDM_SESSION," "$SDDM_RC" > fi > al_restore_later "$SDDM_RC" >fi > >## nodm autologin (the last since the most intrusive) ># FIXME nodm and xinitrc should be modified (also in p6) ># WARNING: check user PATH if things go weird! >NODM_RC=/etc/sysconfig/nodm >NODM_EXE=/usr/sbin/nodm >if [ -x "$NODM_EXE" ]; then > al_backup "$NODM_RC" > cat >> "$NODM_RC" <<- EOF > export NODM_USER=$USER > EOF > al_restore_later "$NODM_RC" >else > return 0 >fi > ># FIXME: drop when #27451 is fixed >NODM_PAM=/etc/pam.d/nodm >for module in pam_console.so pam_ck_connector.so; do > if [ -f /lib*/security/$module ]; then > str="-session optional $module" > grep -q "^$str$" "$NODM_PAM" || echo -e "$str" >> "$NODM_PAM" > fi >done > >NODM_POLKIT_CONFDIR=/etc/polkit-1/localauthority/50-local.d >NODM_POLKIT_CONF=org.freedesktop.NetworkManager.pkla >if [ -d "$NODM_POLKIT_CONFDIR" ]; then > cat > "$NODM_POLKIT_CONFDIR/$NODM_POLKIT_CONF" << _EOF_ >[nm-applet] >Identity=unix-group:users >Action=org.freedesktop.NetworkManager.* >ResultAny=yes >ResultInactive=no >ResultActive=yes >_EOF_ >fi > >NODM_DBUS_NM_CONF=/etc/dbus-1/system.d/nm-applet.conf >if [ -f "$NODM_DBUS_NM_CONF" ]; then > sed -i "s/at_console=\"true\"/user=\"$USER\"/" "$NODM_DBUS_NM_CONF" >fi > >NODM_G2KR_DIR=/etc/skel/.gnome2/keyrings >mkdir -p "$NODM_G2KR_DIR" >echo -n login > "$NODM_G2KR_DIR"/default >cat > "$NODM_G2KR_DIR"/login.keyring << _EOF_ >[keyring] >display-name=login >ctime=0 >mtime=0 >lock-on-idle=false >lock-after=false >_EOF_ > >} > >al_disable() { > { > # autologin > sed -i '/^AUTOLOGIN=yes$/d;/^USER=/d' /etc/sysconfig/autologin > # lightdm > sed -ir \ > -e 's/^(autologin-user=).*$/#\1/' \ > -e 's/^autologin-user-timeout=0$/#&/' \ > /etc/lightdm/lightdm.conf > # gdm2 > sed -i \ > -e '/^AutomaticLoginEnable=true/d' \ > -e '/^AutomaticLogin=/d' \ > /etc/X11/gdm/custom.conf > # kdm{3,4} > sed -i \ > -e '/^AutoLoginEnable=true$/d' \ > -e '/^AutoLoginUser=/d' \ > /etc/X11/kdm/kdmrc \ > /etc/X11/kdm4/kdmrc > # sddm > sed -ir 's/^(User=).*$/\1/' /etc/X11/sddm/sddm.conf > # nodm > sed -i '/^export NODM_USER=/d' /etc/sysconfig/nodm > > } 2>/dev/null >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 30037
: 6407 |
6409