lilalo

changeset 114:658b4ea105c1

PS1 bug fixed
author igor
date Sun Mar 09 02:38:56 2008 +0200 (2008-03-09)
parents 8287cb3530de
children 9e6359b7ad55
files install l3-agent l3-frontend l3bashrc l3prompt
line diff
     1.1 --- a/install	Sun Mar 09 02:34:52 2008 +0200
     1.2 +++ b/install	Sun Mar 09 02:38:56 2008 +0200
     1.3 @@ -22,6 +22,7 @@
     1.4  url_l3bashrc="${url_lilalo}"/l3bashrc
     1.5  url_l3agent="${url_lilalo}"/l3-agent
     1.6  url_l3config="${url_lilalo}"/l3config.pm
     1.7 +url_l3prompt="${url_lilalo}"/l3prompt
     1.8  url_perl_modules=${url_lilalo}/
     1.9  perl_modules="Term-VT102 Text-Iconv"
    1.10  
    1.11 @@ -92,6 +93,8 @@
    1.12          cp l3-agent /usr/local/bin
    1.13          chmod 755 /usr/local/bin/l3-agent
    1.14          cp l3bashrc ${user_home}/${lilalo_home}
    1.15 +        cp l3prompt ${user_home}/${lilalo_home}
    1.16 +        chmod 755 ${user_home}/${lilalo_home}/l3prompt
    1.17          chown -R $user ${user_home}/${lilalo_home}
    1.18          echo l3cd=${lilalo_context}/$user > ${user_home}/${lilalo_rc}
    1.19          chown -R $user ${user_home}/${lilalo_rc}
    1.20 @@ -163,6 +166,7 @@
    1.21  cd ${temp_dir}
    1.22  step "Installing dependencies" apt_get_install_deps
    1.23  step "Downloading l3bashrc" ${wget} ${url_l3bashrc} 
    1.24 +step "Downloading l3prompt" ${wget} ${url_l3prompt} 
    1.25  step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config}'
    1.26  step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
    1.27  step "Installing perl modules for l3-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
     2.1 --- a/l3-agent	Sun Mar 09 02:34:52 2008 +0200
     2.2 +++ b/l3-agent	Sun Mar 09 02:38:56 2008 +0200
     2.3 @@ -216,7 +216,7 @@
     2.4              ([0-9]+)[\#]                # uid
     2.5              ([0-9]+)[\#]                # pid
     2.6              ([0-9]+)[\#]                # time
     2.7 -            (.*?)[\#]                     # pwd
     2.8 +            (.*?)[\#]                   # pwd
     2.9              .\\[1024D.\\[K              # killing symbols
    2.10              (.*?([\$\#]\\s?))           # prompt
    2.11              (.*)                        # command line
    2.12 @@ -226,6 +226,31 @@
    2.13      my $cline_re_v2 = qr/$cline_re_v2_base/sx;
    2.14      my $cline_re2_v2 = qr/$cline_re_v2_base$/sx;
    2.15  
    2.16 +    my $cline_re_v3_base = qq'
    2.17 +            (
    2.18 +            v3[\#]                      # version
    2.19 +            .*
    2.20 +            )
    2.21 +            ';
    2.22 +    my $cline_re_v3 = qr/$cline_re_v3_base/sx;
    2.23 +
    2.24 +    my $cline_re2_v3_base = qq'
    2.25 +            (
    2.26 +            v3[\#]                      # version
    2.27 +            ([0-9]+)[\#]                # history line number
    2.28 +            ([0-9]+)[\#]                # exitcode
    2.29 +            ([0-9]+)[\#]                # uid
    2.30 +            ([0-9]+)[\#]                # pid
    2.31 +            ([0-9]+)[\#]                # time
    2.32 +            (.*?)[\#]                   # pwd
    2.33 +            (.*?([\$\#]\\s?))           # prompt
    2.34 +            (.*)                        # command line
    2.35 +            )
    2.36 +            ';
    2.37 +    my $cline_re2_v3 = qr/$cline_re2_v3_base$/sx;
    2.38 +
    2.39 +
    2.40 +
    2.41      my $vt = Term::VT102->new ( 'cols' => $Config{"terminal_width"}, 
    2.42                                  'rows' => $Config{"terminal_height"});
    2.43      my $cline_vt = Term::VT102->new (
    2.44 @@ -420,15 +445,19 @@
    2.45                  next;
    2.46              }
    2.47  
    2.48 -
    2.49 -            elsif (m/$cline_re_v2/) {
    2.50 -
    2.51 -
    2.52 +            elsif (m/$cline_re_v2/ || m/$cline_re_v3/) {
    2.53  # Разбираем командную строку версии 2
    2.54  
    2.55 -
    2.56                  s/.*\x0d(?!\x0a)//;
    2.57 -                m/$cline_re2_v2/gs;
    2.58 +                my $re;
    2.59 +                if (m/$cline_re_v2/) {
    2.60 +                    $re=$cline_re2_v2;
    2.61 +                }
    2.62 +                else {
    2.63 +                    s/.\[1K.\[10D//gs;
    2.64 +                    $re=$cline_re2_v3;
    2.65 +                }
    2.66 +                m/$re/gs;
    2.67  
    2.68                  $commandlines_loaded++;
    2.69                  $last_output_length=0;
     3.1 --- a/l3-frontend	Sun Mar 09 02:34:52 2008 +0200
     3.2 +++ b/l3-frontend	Sun Mar 09 02:38:56 2008 +0200
     3.3 @@ -1960,8 +1960,8 @@
     3.4  
     3.5  sub mywi_init
     3.6  {
     3.7 -    our $MyWiFile = "/home/devi/mywi/mywi.txt";
     3.8 -    our $MyWiLog = "/home/devi/mywi/mywi.log";
     3.9 +    our $MyWiFile = "/home/igor/mywi/mywi.txt";
    3.10 +    our $MyWiLog = "/home/igor/mywi/mywi.log";
    3.11      our $section="";
    3.12  
    3.13      our @MywiTXT;       # Массив текстовых записей mywi
     4.1 --- a/l3bashrc	Sun Mar 09 02:34:52 2008 +0200
     4.2 +++ b/l3bashrc	Sun Mar 09 02:38:56 2008 +0200
     4.3 @@ -128,7 +128,8 @@
     4.4  
     4.5  l3_fix_prompt()
     4.6  {
     4.7 -    export PS1='\[v2#\!#$?#$UID#$$#$(/bin/date +%s)$(l3_save_last_line)#$PWD#\033[1024D\033[K\]'$PS1
     4.8 +#    export PS1='\[v2#\!#$?#$UID#$$#$(/bin/date +%s)$(l3_save_last_line)#$PWD#\033[1024D\033[K\]'$PS1
     4.9 +    export PS1='\[$($L3_HOME/l3prompt "v3#\!#$?#$UID#$$#$(/bin/date +%s)#$PWD#")$(l3_save_last_line >& /dev/null)\]'$PS1
    4.10  }
    4.11  
    4.12  _l3_tamper_editors()
     5.1 --- a/l3prompt	Sun Mar 09 02:34:52 2008 +0200
     5.2 +++ b/l3prompt	Sun Mar 09 02:38:56 2008 +0200
     5.3 @@ -1,13 +1,13 @@
     5.4  #!/usr/bin/perl
     5.5  
     5.6 -$string="abcdefghijklmnopqrstuvwxyz";
     5.7 -$insert="\e[1K\e[10D";
     5.8 -$max=5;
     5.9 +my $string=$_[0];
    5.10 +my $insert="\e[1K\e[10D";
    5.11 +my $max=5;
    5.12  
    5.13  while (length($string) > $max) {
    5.14      $res .= substr($string, 0, $max).$insert;
    5.15      $string = substr($string, $max);
    5.16  }
    5.17  $res .= $string.$insert;
    5.18 -print "$res\n";
    5.19 +print "$res";
    5.20