# HG changeset patch # User devi # Date 1140357762 -7200 # Node ID 44973d76ba4d1937f6c8b581f310fd409f2f0d2e # Parent 147fb109c012e13650de14692946af7d2e419d56 Подправлен скрипт l3bashrc. Теперь определение запущен ли скрипт на текущем терминале или нет, выполняется через PPID Идентификатор сессии изменён. Теперь это просто 8байтоное случайное число + время начала сессии. l3scripts: Вместо процедуры инсталляции lm-install мы теперь просто копируем l3bashrc в lilalo и всё diff -r 147fb109c012 -r 44973d76ba4d l3bashrc --- a/l3bashrc Sun Feb 19 14:36:33 2006 +0200 +++ b/l3bashrc Sun Feb 19 16:02:42 2006 +0200 @@ -5,7 +5,6 @@ # # L3_SESSION_ID - uniq id of the LiLaLo-session # L3_PARENT_TTY - name of tty on which script is running -# L3_TTY - current tty # PS1 - intercative shell prompt in which LiLaLo hides # various information about the command # L3_TAMPERED_EDITORS - list of editors which are tampered with functions @@ -18,43 +17,52 @@ _l3_start() { - if _l3_is_not_running_here + if _l3_is_running_here then - _l3_start_session - _l3_run_script - else _l3_env _l3_init_prompt l3_fix_prompt _l3_tamper_editors _l3_tamper_commands _l3_unset_internal + else + _l3_start_session + _l3_run_script fi } # ===================== STAGE 1 ============================ -_l3_is_not_running_here() +_l3_is_running_here() { + ps waux | awk '{print $2" "$11 }' | grep -q ^$PPID" "script + return $? + +# Check if ^^^^ run on Linux +# and del vvvv this if it does + export L3_TTY=`/usr/bin/tty` + uname -a | grep -qi bsd && bsd=yes proc_on_the_term=`w | grep "${L3_TTY##/dev/}" | awk '{print $8;}'` # freeBSD: [ -n "$bsd" ] && \ proc_on_the_term=`w | grep "${L3_TTY##/dev/tty}" | awk '{print $6;}'` - [ -n "$proc_on_the_term" ] && echo $proc_on_the_term | grep -qv script + [ -n "$proc_on_the_term" ] && echo $proc_on_the_term | grep -q script } _l3_start_session() { - export L3_SESSION_ID=${L3_TTY##*/}-$$ + export L3_SESSION_ID=${RANDOM}${RANDOM}${RANDOM}${RANDOM}-`date +%s` export L3_HOME=~/.lilalo/ mkdir -p $L3_HOME + tty=`/usr/bin/tty` uname -a | grep -qi bsd && bsd=yes parent=`cat /proc/$PPID/cmdline 2> /dev/null` + [ -z "$parent" ] && parent="`ps waux | awk '{if ($2 == '$PPID') print $11; }'`" system=`uname -rs` - login_from=`who | grep "${L3_TTY##/dev/}" | awk '{print $6;}' | tr -d '()'` + login_from=`who | grep "${tty##/dev/}" | awk '{print $6;}' | tr -d '()'` #[ -n "$bsd" ] && login_from="" #FIXME! start_time=`date +%s` hostname=`hostname -f 2> /dev/null` @@ -67,7 +75,7 @@ $USER $UID $login_from - $L3_TTY + $tty $system $parent $PPID @@ -77,7 +85,7 @@ INFO - unset parent system login_from start_time hostname + unset parent system login_from start_time hostname tty } _l3_run_script() diff -r 147fb109c012 -r 44973d76ba4d l3config.pm --- a/l3config.pm Sun Feb 19 14:36:33 2006 +0200 +++ b/l3config.pm Sun Feb 19 16:02:42 2006 +0200 @@ -81,7 +81,7 @@ "detach" => "yes", "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid", - "backend_address" => "192.168.18.254", + "backend_address" => "192.168.15.254", "backend_port" => "18030", "backend_pidfile" => "/tmp/l3-backend.pid", "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml", @@ -124,7 +124,7 @@ "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub", "lmssh" => "./lm-ssh", "lminstall" => "./lm-install", - "ssh_user" => "root", + "ssh_user" => "r", "l3scripts" => "l3scripts", diff -r 147fb109c012 -r 44973d76ba4d l3scripts --- a/l3scripts Sun Feb 19 14:36:33 2006 +0200 +++ b/l3scripts Sun Feb 19 16:02:42 2006 +0200 @@ -3,12 +3,17 @@ cat $sshkey | $lmssh $ssh_user@$host /bin/sh -c '"cat >>~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys"' ###install-lm -cat $lminstall | ssh $ssh_user@$host /bin/sh -s $dirs +#cat $lminstall | ssh $ssh_user@$host /bin/sh -s $dirs scp l3config.pm l3-agent $ssh_user@$host:/usr/local/bin +for i in $dirs +do + ssh $ssh_user@$host mkdir -p ${i}/.lilalo/ + scp l3bashrc $ssh_user@$host:${i}/.lilalo/ +done ###install-pm scp PM/* $ssh_user@$host:/tmp -ssh $ssh_user@$host 'cd /tmp; tar xfz Term-VT102*.gz; cd Term-VT102*[^z]; perl Makefile.PL; make ; make install' +#ssh $ssh_user@$host 'cd /tmp; tar xfz Term-VT102*.gz; cd Term-VT102*[^z]; perl Makefile.PL; make ; make install' ssh $ssh_user@$host 'cd /tmp; tar xfz Text-Iconv*.gz; cd Text-Iconv*[^z]; perl Makefile.PL; make ; make install' ###copy-lablogs