Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[tip] scriptino per l'autologin
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
cloc3
Advocate
Advocate


Joined: 13 Jan 2004
Posts: 4787
Location: http://www.gentoo-users.org/user/cloc3/

PostPosted: Sat Apr 11, 2009 7:28 pm    Post subject: [tip] scriptino per l'autologin Reply with quote

sicuramente sto provando a rifare la ruota. forse un po' quadrata, per giunta.
ma, nel costruire una gentoo-live per chiavetta usb (squashfs - readonly), mi sono ritrovato il solito problema di forzare l'autologin.

allora ho deciso di sovrascrivere la cartella /etc, usando una partizione accessibile in scrittura, in modalità aufs.
ed è nato uno scriptino di init, facile da configurare sia nei fie (/etc/conf.d/autologin), che via /proc/cmdline (linea di comando in avvio).

in tutto due file. Versione provvista di taglia incolla autoinstallante:
Code:

cat <<-EOF >/etc/conf.d/autologin
## parametri di AutoLogin
# se AutologinUser=cmdline utilizza le impostazioni di /proc/cmdline
# per utilizzare le impostazioni di cmdline

AutoLoginEnable=true
AutoLoginAgain=true
AutoLoginUser=cmdline
#AutoLoginDelay=10
#AutoLoginPass=secret!
#AutoLoginLocked=true
EOF

Code:

cat <<-EOF >/etc/init.d/autologin
#!/sbin/runscript
# Distributed under the terms of the GNU General Public License v3
#
# questo script di init è costruito per kdm (3.5).
# serve ad impostare o a disabilitare la funzionalita' di autologin
# lo script modifica il file /usr/kde/3.5/share/config/kdm/kmdrc
# le impostazioni di configurazione possono essere prelevate
# da /etc/conf.d/autologin oppure da /proc/cmdline.

depend() {
   before xdm
}

kdmrc="/usr/kde/3.5/share/config/kdm/kdmrc"
varList=""
getEnv () {
   local value varName
   for i in $@; do
       case $i in
           *=*)
              value=${i#*=}
              varName=${i/=$value/}
              [[ "${varName:0:1}" != "#" ]] && grep -sq $varName /etc/conf.d/autologin && {
                export $varName=$value
                echo $varList|grep -sq $varName || varList="${varList}${varName} "
                }
        ;;
       esac
   done
}

setup () {
   getEnv `cat /etc/conf.d/autologin`
   [[ ${AutoLoginUser} == "cmdline" ]] && getEnv `cat /proc/cmdline`
}

start() {
   setup
   for var in $varList; do {
      eval value=\$$var
      sed -i 's/^#'${var}'\(.*\)/'${var}'='${value}'/' $kdmrc
      }
   done

   [[ ${AutoLoginEnable} ]] && ! grep -sq $AutoLoginUser /etc/passwd  && useradd -m $AutoLoginUser

   if [[ ${AutoLoginEnable} ]]; then {
        echo "autologin abilitato"
        retval=0
      };
   else   {
        echo "per abilitare l'autologin, utilizzare /etc/conf.d/autologin"
        retval=1
      };
   fi
   eend ${retval}
}

stop() {
   setup
   for var in $varList; do {
                sed -i 's/^'${var}'\(.*\)/#'${var}'=null/' $kdmrc
                }
        done

   echo "autologin disabilitato"
   eend 0
}

restart() {
   eend 0
}
EOF

nell'uovo di Pasqua.
_________________
vu vu vu
gentù
mi piaci tu
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum