| /l3/users/28-09-2015/NT-Ladm/debian4.net.nt/root :1 :2 :3 :4 :5 :6 :7 |
|
|
#mv repotr report2
mv: не удалось выполнить stat для «repotr»: Нет такого файла или каталога |
|
#date >> report
l3script: report: Отказано в доступе |
|
#ls
all file1 file3 file5 install report errors file2 file4 files privet.sh shadow |
|
#ls f*
file1 file2 file3 file4 file5 files |
|
#ls -1 f* | sort -r
files file5 file4 file3 file2 file1 |
|
#ls -1 f* | sort
file1 file2 file3 file4 file5 files |
|
#ls -1 f* | rm -f
|
|
#ls
all file1 file3 file5 install report errors file2 file4 files privet.sh shadow |
|
#rm -f
|
|
#ls
all file1 file3 file5 install report errors file2 file4 files privet.sh shadow |
|
#ls -1 f* | xargs rm -f
|
|
#ls
all errors install privet.sh report shadow |
|
#cat install
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | grep users
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
install_to_users_homes()
users="$@"
for user in $users
install_to_users_bashrc()
users="$@"
for user in $users
install_to_users_bash_profile()
users="$@"
for user in $users
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
|
|
#cat install | grep -n users
12:install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
13:lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
85:install_to_users_homes()
88: users="$@"
90: for user in $users
110:install_to_users_bashrc()
112: users="$@"
113: for user in $users
121:install_to_users_bash_profile()
123: users="$@"
124: for user in $users
178:step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
179:step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
180:step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
|
|
#cat install | grep -c users
14 |
|
#cat install | grep 'users$'
for user in $users
for user in $users
for user in $users
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
|
|
#cat install | grep '^step'
step()
step "Installing dependencies" apt_get_install_deps
step "Downloading l3bashrc" ${wget} ${url_l3bashrc}
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
|
|
#cat install | grep '^'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | grep '^&'
|
|
#cat install | grep -c '^&'
0 |
|
#cat install | grep -c '^$'
31 |
|
#cat install | grep -v '^$'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#grep --help
ÐÑполÑзование: grep [ÐÐÐ ÐÐÐТР]⦠ШÐÐÐФÐÐÐ
² ÑÑандаÑÑном вводе.
Ðо ÑмолÑаниÑ, ШÐÐлÑÑное вÑÑажение (BRE).
ÐÑимеÑ: grep -i 'hello world' menu.h main.c
ÐÑÐ±Ð¾Ñ Ñипа ÑегÑлÑÑного вÑÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ð¸ его инÑеÑпÑеÑаÑиÑ:
-E, --extended-regexp ШÐÐÐие (ERE)
-F, --fixed-regexp ШÐÐÐделÑннÑе
Ñимволом новой ÑÑÑоки
-G, --basic-regexp ШÐÐÐ
RE)
...
ÐÑли в каÑеÑÑве ФÐÐаÑÑнÑй ввод.
ÐÑли ФÐÐой ÑÑÑоки -r, Ñо ÑиÑаеÑÑÑ
ÑекÑÑий каÑалог (.). ÐÑли Ñказано менее двÑÑ
ФÐÐÐ.
ÐÑи наÑ
ождении Ñовпадений лÑбой ÑÑÑоки, кодом завеÑÑÐµÐ½Ð¸Ñ Ð¿ÑогÑÐ°Ð¼Ð¼Ñ Ð±ÑдеÑ
0, и 1, еÑли ниÑего не Ñовпало. ÐÑи возникновении оÑибок и еÑли не Ñказан
паÑамеÑÑ -q, кодом завеÑÑÐµÐ½Ð¸Ñ Ð±ÑÐ´ÐµÑ 2.
Ðб оÑибкаÑ
ÑообÑайÑе по адÑеÑÑ <bug-grep@gnu.org>
Ðб оÑибкаÑ
в пеÑеводе ÑообÑайÑе по адÑеÑÑ <gnu@mx.ru>
ÐомаÑнÑÑ ÑÑÑаниÑа GNU Grep: <http://www.gnu.org/software/grep/>
СпÑавка по ÑабоÑе Ñ Ð¿ÑогÑаммами GNU: <http://www.gnu.org/gethelp/>
|
|
#cat install | grep '^[abc]'
apt_get_install_this="perl make libmodule-build-perl libc6-dev gcc"
apt_get_install_deps()
cd ${temp_dir}
cd /
|
|
#cat install | grep '^[^abc]'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3bashrc" ${wget} ${url_l3bashrc}
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | grep '^[[:alpha:]]'
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
lilalo_rc=.l3rc
lilalo_home=.lilalo
url_lilalo="http://xgu.ru/lilalo"
url_l3bashrc="${url_lilalo}"/l3bashrc
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | grep '^[[:ipper:]]'
grep: Неверное имя класса знаков |
|
#cat install | grep '^[[:apper:]]'
grep: Неверное имя класса знаков |
|
#cat install | grep '^[[:alnum:]]'
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
lilalo_rc=.l3rc
lilalo_home=.lilalo
url_lilalo="http://xgu.ru/lilalo"
url_l3bashrc="${url_lilalo}"/l3bashrc
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | grep '^.[[:alpha:]A-L]'
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
lilalo_rc=.l3rc
lilalo_home=.lilalo
url_lilalo="http://xgu.ru/lilalo"
url_l3bashrc="${url_lilalo}"/l3bashrc
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | grep '^.[f-k]'
lilalo_user=13-10-2014
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
lilalo_rc=.l3rc
lilalo_home=.lilalo
wget=wget
whiteC='\033[1;37m'
show_usage()
show_final_message()
If you use xgu.ru backend, your labs will be available at
Thank you gor using LiLaLo.
mkdir -p ${temp_dir}
show_final_message
|
|
#cat install | grep 'xgu.ru'
url_lilalo="http://xgu.ru/lilalo"
If you use xgu.ru backend, your labs will be available at
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | grep 'xguaru'
|
|
#cat install | grep 'xgu\.ru'
url_lilalo="http://xgu.ru/lilalo"
If you use xgu.ru backend, your labs will be available at
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#-- ВСТАВКА --
|
|
#cat install | grep - E'ht+p'
grep: Eht+p: Нет такого файла или каталога |
|
#cat install | grep -E 'ht+p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'ht+p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#ls -l `which grep`
-rwxr-xr-x 1 root root 175488 Май 13 2012 /bin/grep |
|
#ls -l `which egrep`
-rwxr-xr-x 1 root root 175456 Май 13 2012 /bin/egrep |
|
#cat install | egrep 'ht*p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'ht?p'
|
|
#cat install | egrep 'htt?p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'ht{2}p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'ht{2,5}p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'ht{2,}p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'ht{2,}p'
url_lilalo="http://xgu.ru/lilalo"
http://xgu.ru/l3/${lilalo_context}
For further information see http://xgu.ru/lilalo/ (in Russian).
|
|
#cat install | egrep 'if (which )?apt-get'
if which apt-get >& /dev/null
|
|
#cat install | egrep 'if (which |locate )?apt-get'
if which apt-get >& /dev/null
|
|
#ps lax
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 1 0 20 0 10648 828 - Ss ? 0:05 init [2] 1 0 2 0 20 0 0 0 - S ? 0:00 [kthreadd] 1 0 3 2 20 0 0 0 - S ? 0:00 [ksoftirqd/ 1 0 5 2 20 0 0 0 - S ? 0:00 [kworker/u: 1 0 6 2 -100 - 0 0 - S ? 0:00 [migration/ 5 0 7 2 -100 - 0 0 - S ? 0:03 [watchdog/0 1 0 8 2 0 -20 0 0 - S< ? 0:00 [cpuset] 1 0 9 2 0 -20 0 0 - S< ? 0:00 [khelper] 5 0 10 2 20 0 0 0 - S ? 0:00 [kdevtmpfs] ... 0 1002 8412 8411 20 0 24892 3524 - Ss+ pts/4 0:00 -bash 4 0 8493 2254 20 0 71292 3620 - Ss ? 0:00 sshd: user 5 1000 8495 8493 20 0 71292 1876 - S ? 0:01 sshd: user@ 0 1000 8496 8495 20 0 22176 2844 - Ss pts/5 0:00 -bash 0 1000 8541 8496 20 0 18164 836 - S+ pts/5 0:00 script -f - 1 1000 8612 8541 20 0 18168 468 - S+ pts/5 0:00 script -f - 0 1000 8613 8612 20 0 24612 3276 - Ss+ pts/6 0:02 l3script 0 0 9479 8304 20 0 7728 324 - T pts/2 0:00 cat 1 0 11083 2 20 0 0 0 - S ? 0:00 [kworker/0: 4 0 11099 8304 20 0 10536 844 - R+ pts/2 0:00 ps lax |
|
#ps lax | awk '$11~/?/'
awk: line 1: regular expression compile failed (missing operand) ? |
|
#ps lax | awk '$11~/\?/'
4 0 1 0 20 0 10648 828 - Ss ? 0:05 init [2] 1 0 2 0 20 0 0 0 - S ? 0:00 [kthreadd] 1 0 3 2 20 0 0 0 - S ? 0:00 [ksoftirqd/0] 1 0 5 2 20 0 0 0 - S ? 0:00 [kworker/u:0] 1 0 6 2 -100 - 0 0 - S ? 0:00 [migration/0] 5 0 7 2 -100 - 0 0 - S ? 0:03 [watchdog/0] 1 0 8 2 0 -20 0 0 - S< ? 0:00 [cpuset] 1 0 9 2 0 -20 0 0 - S< ? 0:00 [khelper] 5 0 10 2 20 0 0 0 - S ? 0:00 [kdevtmpfs] 1 0 11 2 0 -20 0 0 - S< ? 0:00 [netns] ... 1 1000 5436 1 20 0 47780 10464 - Ss ? 6:09 l3-agent 1 0 7884 2 20 0 0 0 - S ? 0:01 [kworker/0:1] 4 0 8225 2254 20 0 71292 3772 - Ss ? 0:01 sshd: root@pts/0 4 0 8325 2254 20 0 71292 3624 - Ss ? 0:00 sshd: ivan [priv] 5 1001 8327 8325 20 0 71292 1872 - S ? 0:00 sshd: ivan@pts/3 4 0 8409 2254 20 0 71292 3616 - Ss ? 0:00 sshd: petr [priv] 5 1002 8411 8409 20 0 71292 1864 - S ? 0:00 sshd: petr@pts/4 4 0 8493 2254 20 0 71292 3620 - Ss ? 0:00 sshd: user [priv] 5 1000 8495 8493 20 0 71292 1876 - S ? 0:01 sshd: user@pts/5 1 0 11083 2 20 0 0 0 - S ? 0:00 [kworker/0:2] |
|
#ps lax | awk '$11!~/\?/'
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 2278 1 20 0 18368 972 - Ss+ tty1 0:00 /sbin/getty 38400 tty1 4 0 2279 1 20 0 18368 964 - Ss+ tty2 0:00 /sbin/getty 38400 tty2 4 0 2280 1 20 0 18368 972 - Ss+ tty3 0:00 /sbin/getty 38400 tty3 4 0 2281 1 20 0 18368 964 - Ss+ tty4 0:00 /sbin/getty 38400 tty4 4 0 2282 1 20 0 18368 972 - Ss+ tty5 0:00 /sbin/getty 38400 tty5 4 0 2283 1 20 0 18368 976 - Ss+ tty6 0:00 /sbin/getty 38400 tty6 4 0 8227 8225 20 0 22080 2744 - Ss pts/0 0:00 -bash 0 0 8272 8227 20 0 18164 844 - S+ pts/0 0:00 script -f -c l3script -q /root/.lilalo//1391229526113434213-1443508607.script 1 0 8303 8272 20 0 18168 472 - S+ pts/0 0:00 script -f -c l3script -q /root/.lilalo//1391229526113434213-1443508607.script 0 0 8304 8303 20 0 21980 2560 - Ss pts/2 0:02 l3script 0 1001 8328 8327 20 0 24696 3328 - Ss+ pts/3 0:00 -bash 0 1002 8412 8411 20 0 24892 3524 - Ss+ pts/4 0:00 -bash 0 1000 8496 8495 20 0 22176 2844 - Ss pts/5 0:00 -bash 0 1000 8541 8496 20 0 18164 836 - S+ pts/5 0:00 script -f -c l3script -q /home/user/.lilalo//505813078662917291-1443508849.script 1 1000 8612 8541 20 0 18168 468 - S+ pts/5 0:00 script -f -c l3script -q /home/user/.lilalo//505813078662917291-1443508849.script 0 1000 8613 8612 20 0 24612 3276 - Ss+ pts/6 0:02 l3script 0 0 9479 8304 20 0 7728 324 - T pts/2 0:00 cat 4 0 11125 8304 20 0 10536 844 - R+ pts/2 0:00 ps lax 0 0 11126 8304 20 0 6764 608 - S+ pts/2 0:00 awk $11!~/\?/ |
|
#ps lax | awk '$11!~/\//'
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND 4 0 1 0 20 0 10648 828 - Ss ? 0:05 init [2] 1 0 2 0 20 0 0 0 - S ? 0:00 [kthreadd] 1 0 3 2 20 0 0 0 - S ? 0:00 [ksoftirqd/0] 1 0 5 2 20 0 0 0 - S ? 0:00 [kworker/u:0] 1 0 6 2 -100 - 0 0 - S ? 0:00 [migration/0] 5 0 7 2 -100 - 0 0 - S ? 0:03 [watchdog/0] 1 0 8 2 0 -20 0 0 - S< ? 0:00 [cpuset] 1 0 9 2 0 -20 0 0 - S< ? 0:00 [khelper] 5 0 10 2 20 0 0 0 - S ? 0:00 [kdevtmpfs] ... 0 0 5338 1 39 19 20628 6388 - RN ? 1445:06 john shadow 1 1000 5436 1 20 0 47780 10464 - Ss ? 6:09 l3-agent 4 0 8225 2254 20 0 71292 3772 - Ss ? 0:01 sshd: root@pts/0 4 0 8325 2254 20 0 71292 3624 - Ss ? 0:00 sshd: ivan [priv] 5 1001 8327 8325 20 0 71292 1872 - S ? 0:00 sshd: ivan@pts/3 4 0 8409 2254 20 0 71292 3616 - Ss ? 0:00 sshd: petr [priv] 5 1002 8411 8409 20 0 71292 1864 - S ? 0:00 sshd: petr@pts/4 4 0 8493 2254 20 0 71292 3620 - Ss ? 0:00 sshd: user [priv] 5 1000 8495 8493 20 0 71292 1876 - S ? 0:01 sshd: user@pts/5 1 0 11083 2 20 0 0 0 - S ? 0:00 [kworker/0:2] |
|
#ps lax | awk '$11~/\//'
4 0 8227 8225 20 0 22080 2744 - Ss pts/0 0:00 -bash 0 0 8272 8227 20 0 18164 844 - S+ pts/0 0:00 script -f -c l3script -q /root/.lilalo//1391229526113434213-1443508607.script 1 0 8303 8272 20 0 18168 472 - S+ pts/0 0:00 script -f -c l3script -q /root/.lilalo//1391229526113434213-1443508607.script 0 0 8304 8303 20 0 21980 2560 - Ss pts/2 0:02 l3script 0 1001 8328 8327 20 0 24696 3328 - Ss+ pts/3 0:00 -bash 0 1002 8412 8411 20 0 24892 3524 - Ss+ pts/4 0:00 -bash 0 1000 8496 8495 20 0 22176 2844 - Ss pts/5 0:00 -bash 0 1000 8541 8496 20 0 18164 836 - S+ pts/5 0:00 script -f -c l3script -q /home/user/.lilalo//505813078662917291-1443508849.script 1 1000 8612 8541 20 0 18168 468 - S+ pts/5 0:00 script -f -c l3script -q /home/user/.lilalo//505813078662917291-1443508849.script 0 1000 8613 8612 20 0 24612 3276 - Ss+ pts/6 0:02 l3script 0 0 9479 8304 20 0 7728 324 - T pts/2 0:00 cat 4 0 11143 8304 20 0 10536 848 - R+ pts/2 0:00 ps lax 0 0 11144 8304 20 0 6764 604 - S+ pts/2 0:00 awk $11~/\// |
|
#cat passwd
cat: passwd: Нет такого файла или каталога |
|
#cat /etc/passwd
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh ... list:x:38:38:Mailing List Manager:/var/list:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh Debian-exim:x:101:103::/var/spool/exim4:/bin/false user:x:1000:1000:user,,,:/home/user:/bin/bash sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin ivan:x:1001:1001::/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash |
|
#vim shell.sh
--- /dev/null 2015-09-25 17:23:00.264000008 +0300 +++ shell.sh 2015-09-29 14:52:14.399833962 +0300 @@ -0,0 +1 @@ +#!/bin/bash |
|
#vim shell.sh
--- /tmp/l3-saved-8304.19078.26612 2015-09-29 14:55:04.171833854 +0300
+++ shell.sh 2015-09-29 15:00:54.655833984 +0300
@@ -1 +1,4 @@
#!/bin/bash
+
+uid=$(grep '^UID_MIN' /etc/login.defs | awk '{print $2}')
+users=$(awk -F: '$3>=$uid{print $1}' /etc/passwd)
|
|
#bash shell.sh
user ivan petr |
|
#vim shell.sh
--- /tmp/l3-saved-8304.26714.8625 2015-09-29 15:06:18.303833962 +0300
+++ shell.sh 2015-09-29 15:10:53.411833930 +0300
@@ -2,4 +2,7 @@
uid=$(grep '^UID_MIN' /etc/login.defs | awk '{print $2}')
users=$(awk -F: '$3>=1000 && $3!=65534 {print $1}' /etc/passwd)
-echo $users
+for user in $users
+ do
+ usermod -s $1 $user
+ done
|
|
#vim shell.sh
|
|
#bash shell.sh
ÐÑполÑзование: usermod [паÑамеÑÑÑ] ÐÐÐ
, --comment ÐÐÐÐÐÐТÐÐ ÐРновое знаÑение Ð¿Ð¾Ð»Ñ GECOS
-d, --home ÐÐÐ_ÐÐТ новÑй домаÑний каÑалог ÑÑÑÑной запиÑи
-e, --expiredate ÐÐТÐ_УСТ ÑÑÑановиÑÑ Ð´Ð°ÑÑ Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ Ð´ÐµÐ¹ÑÑвиÑ
ÑÑÑÑной запиÑи в ÐÐТÐ_УСТ
-f, --inactive ÐÐÐÐТÐÐÐÐСТЬ ÑÑÑановиÑÑ Ð¿ÐµÑиод неакÑивноÑÑи паÑÐ¾Ð»Ñ Ð¿Ð¾Ñле
ÑÑÑаÑÐµÐ²Ð°Ð½Ð¸Ñ ÑÑÑÑной запиÑи ÑавнÑм ÐÐÐÐТÐÐÐÐСТЬ
-g, --gid ÐРУÐÐРпÑинÑдиÑелÑно назнаÑиÑÑ Ð¿ÐµÑвиÑнÑÑ ÐРУÐÐУ
-G, --groups ÐРУÐÐЫ ÑпиÑок дополниÑелÑнÑÑ
ÐРУÐÐ
-a, --append добавиÑÑ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ð² дополниÑелÑнÑе
...
имеÑÑимÑÑ (не ÑникалÑнÑм) UID
-p, --password ÐÐÐ ÐÐ¾Ð»Ñ Ð´Ð»Ñ
ÑÑÑÑной запиÑи
-R, --root ÐÐТ_CHROOT каÑалог, в коÑоÑÑй вÑполнÑеÑÑÑ chroot
-s, --shell ÐÐÐолоÑка Ð´Ð»Ñ ÑÑÑÑной
запиÑи
-u, --uid UID новÑй UID Ð´Ð»Ñ ÑÑÑÑной запиÑи
-U, --unlock ÑазблокиÑоваÑÑ ÑÑÑÑнÑÑ Ð·Ð°Ð¿Ð¸ÑÑ
-Z, --selinux-user SEUSER новое полÑзоваÑелÑÑкое ÑопоÑÑавление
SELinux Ð´Ð»Ñ ÑÑÑÑной запиÑи
|
|
#bash shell.sh
ÐÑполÑзование: usermod [паÑамеÑÑÑ] ÐÐÐ
, --comment ÐÐÐÐÐÐТÐÐ ÐРновое знаÑение Ð¿Ð¾Ð»Ñ GECOS
-d, --home ÐÐÐ_ÐÐТ новÑй домаÑний каÑалог ÑÑÑÑной запиÑи
-e, --expiredate ÐÐТÐ_УСТ ÑÑÑановиÑÑ Ð´Ð°ÑÑ Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ Ð´ÐµÐ¹ÑÑвиÑ
ÑÑÑÑной запиÑи в ÐÐТÐ_УСТ
-f, --inactive ÐÐÐÐТÐÐÐÐСТЬ ÑÑÑановиÑÑ Ð¿ÐµÑиод неакÑивноÑÑи паÑÐ¾Ð»Ñ Ð¿Ð¾Ñле
ÑÑÑаÑÐµÐ²Ð°Ð½Ð¸Ñ ÑÑÑÑной запиÑи ÑавнÑм ÐÐÐÐТÐÐÐÐСТЬ
-g, --gid ÐРУÐÐРпÑинÑдиÑелÑно назнаÑиÑÑ Ð¿ÐµÑвиÑнÑÑ ÐРУÐÐУ
-G, --groups ÐРУÐÐЫ ÑпиÑок дополниÑелÑнÑÑ
ÐРУÐÐ
-a, --append добавиÑÑ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ð² дополниÑелÑнÑе
...
имеÑÑимÑÑ (не ÑникалÑнÑм) UID
-p, --password ÐÐÐ ÐÐ¾Ð»Ñ Ð´Ð»Ñ
ÑÑÑÑной запиÑи
-R, --root ÐÐТ_CHROOT каÑалог, в коÑоÑÑй вÑполнÑеÑÑÑ chroot
-s, --shell ÐÐÐолоÑка Ð´Ð»Ñ ÑÑÑÑной
запиÑи
-u, --uid UID новÑй UID Ð´Ð»Ñ ÑÑÑÑной запиÑи
-U, --unlock ÑазблокиÑоваÑÑ ÑÑÑÑнÑÑ Ð·Ð°Ð¿Ð¸ÑÑ
-Z, --selinux-user SEUSER новое полÑзоваÑелÑÑкое ÑопоÑÑавление
SELinux Ð´Ð»Ñ ÑÑÑÑной запиÑи
|
|
#vim shell.sh
--- /tmp/l3-saved-8304.12189.9889 2015-09-29 15:11:30.787833972 +0300
+++ shell.sh 2015-09-29 15:16:32.667833886 +0300
@@ -4,5 +4,5 @@
users=$(awk -F: '$3>=1000 && $3!=65534 {print $1}' /etc/passwd)
for user in $users
do
- usermod -s $1 $user
+ grep "^$user.*bash" /etc/passwd &> || usermod -s $1 $user
done
|
|
#bash shell.sh
shell.sh: line 7: syntax error near unexpected token `||' shell.sh: line 7: ` grep "^$user.*bash" /etc/passwd &> || usermod -s $1 $user' |
|
#bash shell.sh
shell.sh: line 7: syntax error near unexpected token `||' shell.sh: line 7: ` grep "^$user.*bash" /etc/passwd &> || usermod -s $1 $user' |
|
#vim shell.sh
|
|
#bash shell.sh
shell.sh: line 7: syntax error near unexpected token `||' shell.sh: line 7: ` grep "^$user.*bash" /etc/passwd &> || usermod -s $1 $user' |
|
#vim shell.sh
--- /tmp/l3-saved-8304.26901.13301 2015-09-29 15:19:07.151833995 +0300
+++ shell.sh 2015-09-29 15:20:03.999833962 +0300
@@ -4,5 +4,5 @@
users=$(awk -F: '$3>=1000 && $3!=65534 {print $1}' /etc/passwd)
for user in $users
do
- grep "^$user.*bash" /etc/passwd &> || usermod -s $1 $user
+ grep "^$user.*bash" /etc/passwd &> /dev/null || usermod -s $1 $user
done
|
|
#bash shell.sh
|
|
#vim shell.sh
|
|
#vim /etc/passwd
--- /tmp/l3-saved-8304.991.21360 2015-09-29 15:20:56.735833766 +0300 +++ /etc/passwd 2015-09-29 15:21:20.071833833 +0300 @@ -18,7 +18,7 @@ nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh Debian-exim:x:101:103::/var/spool/exim4:/bin/false -user:x:1000:1000:user,,,:/home/user:/bin/bash +user:x:1000:1000:user,,,:/home/user:/bin/sh sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin -ivan:x:1001:1001::/home/ivan:/bin/bash +ivan:x:1001:1001::/home/ivan:/bin/sh petr:x:1002:1002::/home/petr:/bin/bash |
|
#vim shell.sh
|
|
#~
ÐÑполÑзование: usermod [паÑамеÑÑÑ] ÐÐÐ
, --comment ÐÐÐÐÐÐТÐÐ ÐРновое знаÑение Ð¿Ð¾Ð»Ñ GECOS
-d, --home ÐÐÐ_ÐÐТ новÑй домаÑний каÑалог ÑÑÑÑной запиÑи
-e, --expiredate ÐÐТÐ_УСТ ÑÑÑановиÑÑ Ð´Ð°ÑÑ Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ Ð´ÐµÐ¹ÑÑвиÑ
ÑÑÑÑной запиÑи в ÐÐТÐ_УСТ
-f, --inactive ÐÐÐÐТÐÐÐÐСТЬ ÑÑÑановиÑÑ Ð¿ÐµÑиод неакÑивноÑÑи паÑÐ¾Ð»Ñ Ð¿Ð¾Ñле
ÑÑÑаÑÐµÐ²Ð°Ð½Ð¸Ñ ÑÑÑÑной запиÑи ÑавнÑм ÐÐÐÐТÐÐÐÐСТЬ
-g, --gid ÐРУÐÐРпÑинÑдиÑелÑно назнаÑиÑÑ Ð¿ÐµÑвиÑнÑÑ ÐРУÐÐУ
-G, --groups ÐРУÐÐЫ ÑпиÑок дополниÑелÑнÑÑ
ÐРУÐÐ
-a, --append добавиÑÑ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ð² дополниÑелÑнÑе
...
имеÑÑимÑÑ (не ÑникалÑнÑм) UID
-p, --password ÐÐÐ ÐÐ¾Ð»Ñ Ð´Ð»Ñ
ÑÑÑÑной запиÑи
-R, --root ÐÐТ_CHROOT каÑалог, в коÑоÑÑй вÑполнÑеÑÑÑ chroot
-s, --shell ÐÐÐолоÑка Ð´Ð»Ñ ÑÑÑÑной
запиÑи
-u, --uid UID новÑй UID Ð´Ð»Ñ ÑÑÑÑной запиÑи
-U, --unlock ÑазблокиÑоваÑÑ ÑÑÑÑнÑÑ Ð·Ð°Ð¿Ð¸ÑÑ
-Z, --selinux-user SEUSER новое полÑзоваÑелÑÑкое ÑопоÑÑавление
SELinux Ð´Ð»Ñ ÑÑÑÑной запиÑи
|
|
#vim /etc/passwd
--- /tmp/l3-saved-8304.31444.20017 2015-09-29 15:21:41.647833949 +0300 +++ /etc/passwd 2015-09-29 15:22:12.047833980 +0300 @@ -1,4 +1,4 @@ -root:x:0:0:root:/root:/bin/bash +:root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh |
|
#bash shell.sh
ÐÑполÑзование: usermod [паÑамеÑÑÑ] ÐÐÐ
, --comment ÐÐÐÐÐÐТÐÐ ÐРновое знаÑение Ð¿Ð¾Ð»Ñ GECOS
-d, --home ÐÐÐ_ÐÐТ новÑй домаÑний каÑалог ÑÑÑÑной запиÑи
-e, --expiredate ÐÐТÐ_УСТ ÑÑÑановиÑÑ Ð´Ð°ÑÑ Ð¾ÐºÐ¾Ð½ÑÐ°Ð½Ð¸Ñ Ð´ÐµÐ¹ÑÑвиÑ
ÑÑÑÑной запиÑи в ÐÐТÐ_УСТ
-f, --inactive ÐÐÐÐТÐÐÐÐСТЬ ÑÑÑановиÑÑ Ð¿ÐµÑиод неакÑивноÑÑи паÑÐ¾Ð»Ñ Ð¿Ð¾Ñле
ÑÑÑаÑÐµÐ²Ð°Ð½Ð¸Ñ ÑÑÑÑной запиÑи ÑавнÑм ÐÐÐÐТÐÐÐÐСТЬ
-g, --gid ÐРУÐÐРпÑинÑдиÑелÑно назнаÑиÑÑ Ð¿ÐµÑвиÑнÑÑ ÐРУÐÐУ
-G, --groups ÐРУÐÐЫ ÑпиÑок дополниÑелÑнÑÑ
ÐРУÐÐ
-a, --append добавиÑÑ Ð¿Ð¾Ð»ÑзоваÑÐµÐ»Ñ Ð² дополниÑелÑнÑе
...
имеÑÑимÑÑ (не ÑникалÑнÑм) UID
-p, --password ÐÐÐ ÐÐ¾Ð»Ñ Ð´Ð»Ñ
ÑÑÑÑной запиÑи
-R, --root ÐÐТ_CHROOT каÑалог, в коÑоÑÑй вÑполнÑеÑÑÑ chroot
-s, --shell ÐÐÐолоÑка Ð´Ð»Ñ ÑÑÑÑной
запиÑи
-u, --uid UID новÑй UID Ð´Ð»Ñ ÑÑÑÑной запиÑи
-U, --unlock ÑазблокиÑоваÑÑ ÑÑÑÑнÑÑ Ð·Ð°Ð¿Ð¸ÑÑ
-Z, --selinux-user SEUSER новое полÑзоваÑелÑÑкое ÑопоÑÑавление
SELinux Ð´Ð»Ñ ÑÑÑÑной запиÑи
|
|
#bash shell.sh /bin/bash
|
|
#vim /etc/passwd
|
|
#~
l3script: ./shell.sh: Отказано в доступе |
|
#cat install | sed -n '/^$/d'
|
|
#cat install | sed '/^$/d'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed 's/step/STEP/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
STEP "Downloading l3prompt" ${wget} ${url_l3prompt}
STEP "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
STEP "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
STEP "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
STEP "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
STEP "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed '1,10s/step/STEP/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed '1,50s/step/STEP/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed '50,s/step/STEP/'
sed: -e выражение #1, символ 4: непредвиденный символ `,' |
|
#cat install | sed '50,$s/step/STEP/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
STEP "Downloading l3prompt" ${wget} ${url_l3prompt}
STEP "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
STEP "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
STEP "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
STEP "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
STEP "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed '150,$s/step/STEP/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
STEP "Downloading l3prompt" ${wget} ${url_l3prompt}
STEP "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
STEP "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
STEP "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
STEP "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
STEP "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed '150,$s/STEP/step/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed 's/users/USERS/'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_USERS=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/USERS/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to USERS home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_USERS_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_USERS_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed 's/users/USERS/g'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_USERS=${USERS:-"root user"} # USERS who will use l3agent and l3script
lilalo_context="/USERS/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to USERS home directories" install_to_USERS_homes $install_l3bashrc_for_this_USERS
step "Adding l3bashrc invocation to ~/.bashrc " install_to_USERS_bashrc $install_l3bashrc_for_this_USERS
step "Adding l3-agent invocation to ~/.bash_profile " install_to_USERS_bash_profile $install_l3bashrc_for_this_USERS
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | sed 's/users$/USERS/g'
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_USERS
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_USERS
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_USERS
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | tr 3 4
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=14-10-2014
lab=NT-LNet
install_l4bashrc_for_this_users=${users:-"root user"} # users who will use l4agent and l4script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l4prompt" ${wget} ${url_l4prompt}
step "Downloading l4-agent" '${wget} ${url_l4agent}; ${wget} ${url_l4config_pm}; ${wget} ${url_l4config}'
step "Downloading perl modules for l4-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Installing perl modules for l4-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
step "Installing l4bashrc to users home directories" install_to_users_homes $install_l4bashrc_for_this_users
step "Adding l4bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l4bashrc_for_this_users
step "Adding l4-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l4bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | tr 123 456
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=46-40-5044
lab=NT-LNet
install_l6bashrc_for_this_users=${users:-"root user"} # users who will use l6agent and l6script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l6prompt" ${wget} ${url_l6prompt}
step "Downloading l6-agent" '${wget} ${url_l6agent}; ${wget} ${url_l6config_pm}; ${wget} ${url_l6config}'
step "Downloading perl modules for l6-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Installing perl modules for l6-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make install; cd ..; done; }'
step "Installing l6bashrc to users home directories" install_to_users_homes $install_l6bashrc_for_this_users
step "Adding l6bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l6bashrc_for_this_users
step "Adding l6-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l6bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | tr -s l
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before instalation:
lilalo_user=13-10-2014
lab=NT-LNet
instal_l3bashrc_for_this_users=${users:-"root user"} # users who wil use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Instaling perl modules for l3-agent" '{ for i in ${perl_modules}; do tar xvfz $i.tar.gz; cd $i*[^z]; perl Makefile.PL; make; make instal; cd ..; done; }'
step "Instaling l3bashrc to users home directories" instal_to_users_homes $instal_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " instal_to_users_bashrc $instal_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " instal_to_users_bash_profile $instal_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | tr -s \n
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | tr -s "\n"
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
...
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
|
|
#cat install | tr -d l
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variabes before instaation:
iao_user=13-10-2014
ab=NT-LNet
insta_3bashrc_for_this_users=${users:-"root user"} # users who wi use 3agent and 3script
iao_context="/users/${iao_user}/${ab}/${hostname}"
...
step "Downoading 3prompt" ${wget} ${ur_3prompt}
step "Downoading 3-agent" '${wget} ${ur_3agent}; ${wget} ${ur_3config_pm}; ${wget} ${ur_3config}'
step "Downoading per modues for 3-agent" '{ for i in ${per_modues}; do ${wget} ${ur_per_modues}/$i.tar.gz; done; }'
step "Instaing per modues for 3-agent" '{ for i in ${per_modues}; do tar xvfz $i.tar.gz; cd $i*[^z]; per Makefie.PL; make; make insta; cd ..; done; }'
step "Instaing 3bashrc to users home directories" insta_to_users_homes $insta_3bashrc_for_this_users
step "Adding 3bashrc invocation to ~/.bashrc " insta_to_users_bashrc $insta_3bashrc_for_this_users
step "Adding 3-agent invocation to ~/.bash_profie " insta_to_users_bash_profie $insta_3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_fina_message
|
|
#cat install | tr -d [:punct:]
binsh hostnamehostname uname a egrep qi freebsddarwin hostnamehostname f Set this variables before installation lilalouser13102014 labNTLNet installl3bashrcforthisusersusersroot user users who will use l3agent and l3script lilalocontextuserslilalouserlabhostname lilalorcl3rc lilalohomelilalo ... step Downloading l3prompt wget urll3prompt step Downloading l3agent wget urll3agent wget urll3configpm wget urll3config step Downloading perl modules for l3agent for i in perlmodules do wget urlperlmodulesitargz done step Installing perl modules for l3agent for i in perlmodules do tar xvfz itargz cd iz perl MakefilePL make make install cd done step Installing l3bashrc to users home directories installtousershomes installl3bashrcforthisusers step Adding l3bashrc invocation to bashrc installtousersbashrc installl3bashrcforthisusers step Adding l3agent invocation to bashprofile installtousersbashprofile installl3bashrcforthisusers cd rm rf tempdir showfinalmessage |
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh proxy:x:13:13:proxy:/bin:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/sh backup:x:34:34:backup:/var/backups:/bin/sh list:x:38:38:Mailing List Manager:/var/list:/bin/sh irc:x:39:39:ircd:/var/run/ircd:/bin/sh gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh libuuid:x:100:101::/var/lib/libuuid:/bin/sh Debian-exim:x:101:103::/var/spool/exim4:/bin/false user:x:1000:1000:user,,,:/home/user:/bin/bash sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin ivan:x:1001:1001::/home/ivan:/bin/bash petr:x:1002:1002::/home/petr:/bin/bash
#!/bin/sh
hostname=`hostname`
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
###############################################################################
#
# Set this variables before installation:
lilalo_user=13-10-2014
lab=NT-LNet
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
#
###############################################################################
lilalo_rc=.l3rc
lilalo_home=.lilalo
url_lilalo="http://xgu.ru/lilalo"
url_l3bashrc="${url_lilalo}"/l3bashrc
url_l3agent="${url_lilalo}"/l3-agent
url_l3config_pm="${url_lilalo}"/l3config.pm
url_l3config="${url_lilalo}"/l3-config
url_l3prompt="${url_lilalo}"/l3prompt
url_perl_modules=${url_lilalo}/
perl_modules="Term-VT102 Text-Iconv"
apt_get_install_this="perl make libmodule-build-perl libc6-dev gcc"
wget=wget
uname -a | egrep -qi '(bsd|darwin)' && wget=fetch
normC='\033[0;39m'
whiteC='\033[1;37m'
redC='\033[0;31m'
greenC='\033[0;32m'
apt_get_install_deps()
{
return 0
if which apt-get >& /dev/null
then
apt-get install -y $apt_get_install_this
else
echo "Please install this dependencies manually:"
echo $apt_get_install_this
echo "Have you installed this already (y/n)?"
echo y | read answer
if echo $answer | grep -q ^[yY]
then
true
else
echo Please install the dependencies and rerun the script
exit 1
fi
fi
}
step()
{
msg="$1"
shift
printf "${whiteC}""$msg""...${normC}\n"
# eval "$@" 2>&1 | sed 's/^/|\ \ \ /' && printf "Ok\n" || printf "Failed\n"
eval "$@" 2>&1 > log 2>&1 && \
{
cat log | sed 's/^/|\ \ \ /'
printf "${greenC}""Ok\n""${normC}"
} || \
{
cat log | sed 's/^/|\ \ \ /'
printf "${redC}""Failed\n""${normC}"
}
}
get_user_home()
{
uname -a | egrep -qi '(freebsd|darwin)' && pw user show "$@"| awk -F: '{print $9}' || getent passwd "$@"| awk -F: '{print $6}'
}
install_to_users_homes()
{
. l3bashrc
users="$@"
set -x
for user in $users
do
user_home=`get_user_home "$user"`
mkdir -p ${user_home}/${lilalo_home}
mkdir /etc/lilalo/
cp l3config.pm /etc/lilalo/
cp l3-agent /usr/local/bin
cp l3-config /usr/local/bin
ln -s `which bash` /usr/local/bin/l3script
chmod 755 /usr/local/bin/l3-{agent,config}
cp l3bashrc ${user_home}/${lilalo_home}
cp l3prompt ${user_home}/${lilalo_home}
chmod 755 ${user_home}/${lilalo_home}/l3prompt
chown -R $user ${user_home}/${lilalo_home}
echo l3cd=${lilalo_context}/$user > ${user_home}/${lilalo_rc}
chown -R $user ${user_home}/${lilalo_rc}
done
set +x
}
install_to_users_bashrc()
{
users="$@"
for user in $users
do
user_home=`get_user_home "$user"`
grep -q lilalo ${user_home}/.bashrc 2> /dev/null\
|| echo "[ \$0 == l3script ] && . ${user_home}/.lilalo/l3bashrc && _l3_start" >> ${user_home}/.bashrc; chown -R ${user} ${user_home}/.bashrc
done
}
install_to_users_bash_profile()
{
users="$@"
for user in $users
do
user_home=`get_user_home "$user"`
grep -q l3-agent ${user_home}/.bash_profile 2> /dev/null \
|| { echo >> ${user_home}/.bash_profile ; cat ${user_home}/.bash_profile | sed '1s/^/l3-agentX/' | tr X '\n' > /tmp/$$$$l3 ; mv /tmp/$$$$l3 ${user_home}/.bash_profile; chown -R ${user} ${user_home}/.bash_profile; }
done
}
show_usage()
{
cat <<USAGE
Usage:
$0
USAGE
}
show_final_message()
{
cat <<FINAL_MESSAGE
Installation is successfully completed.
Now restart your shell or relogin
to start script writing.
Your current lilalo context is ${lilalo_context}/USER
If you use xgu.ru backend, your labs will be available at
http://xgu.ru/l3/${lilalo_context}
Use commands
$ l3cd ${lilalo_context%/*/*}/MY-NEW-CONTEXT/${hostname}/USER
$ l3pwd
to change and to know your current context.
For further information see http://xgu.ru/lilalo/ (in Russian).
Thank you gor using LiLaLo.
Happy Labbing!
(don't forget to restart bash or relogin)
FINAL_MESSAGE
}
temp_dir=/tmp/lilalo-install-temp-$$
mkdir -p ${temp_dir}
cd ${temp_dir}
step "Installing dependencies" apt_get_install_deps
step "Downloading l3bashrc" ${wget} ${url_l3bashrc}
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
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; }'
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
cd /
rm -rf ${temp_dir}
show_final_message
| Время первой команды журнала | 10:32:18 2015- 9-29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Время последней команды журнала | 14:33:53 2015- 9-29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Количество командных строк в журнале | 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Процент команд с ненулевым кодом завершения, % | 19.80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Процент синтаксически неверно набранных команд, % | 0.00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Суммарное время работы с терминалом *, час | 2.04 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Количество командных строк в единицу времени, команда/мин | 0.82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Частота использования команд |
|
В журнал автоматически попадают все команды, данные в любом терминале системы.
Для того чтобы убедиться, что журнал на текущем терминале ведётся, и команды записываются, дайте команду w. В поле WHAT, соответствующем текущему терминалу, должна быть указана программа script.
Команды, при наборе которых были допущены синтаксические ошибки, выводятся перечёркнутым текстом:
$ l s-l bash: l: command not found |
Если код завершения команды равен нулю, команда была выполнена без ошибок. Команды, код завершения которых отличен от нуля, выделяются цветом.
$ test 5 -lt 4 |
Команды, ход выполнения которых был прерван пользователем, выделяются цветом.
$ find / -name abc find: /home/devi-orig/.gnome2: Keine Berechtigung find: /home/devi-orig/.gnome2_private: Keine Berechtigung find: /home/devi-orig/.nautilus/metafiles: Keine Berechtigung find: /home/devi-orig/.metacity: Keine Berechtigung find: /home/devi-orig/.inkscape: Keine Berechtigung ^C |
Команды, выполненные с привилегиями суперпользователя, выделяются слева красной чертой.
# id uid=0(root) gid=0(root) Gruppen=0(root) |
Изменения, внесённые в текстовый файл с помощью редактора, запоминаются и показываются в журнале в формате ed. Строки, начинающиеся символом "<", удалены, а строки, начинающиеся символом ">" -- добавлены.
$ vi ~/.bashrc
|
Для того чтобы изменить файл в соответствии с показанными в диффшоте изменениями, можно воспользоваться командой patch. Нужно скопировать изменения, запустить программу patch, указав в качестве её аргумента файл, к которому применяются изменения, и всавить скопированный текст:
$ patch ~/.bashrc |
Для того чтобы получить краткую справочную информацию о команде, нужно подвести к ней мышь. Во всплывающей подсказке появится краткое описание команды.
Если справочная информация о команде есть, команда выделяется голубым фоном, например: vi. Если справочная информация отсутствует, команда выделяется розовым фоном, например: notepad.exe. Справочная информация может отсутствовать в том случае, если (1) команда введена неверно; (2) если распознавание команды LiLaLo выполнено неверно; (3) если информация о команде неизвестна LiLaLo. Последнее возможно для редких команд.
Большие, в особенности многострочные, всплывающие подсказки лучше всего показываются браузерами KDE Konqueror, Apple Safari и Microsoft Internet Explorer. В браузерах Mozilla и Firefox они отображаются не полностью, а вместо перевода строки выводится специальный символ.
Время ввода команды, показанное в журнале, соответствует времени начала ввода командной строки, которое равно тому моменту, когда на терминале появилось приглашение интерпретатора
Имя терминала, на котором была введена команда, показано в специальном блоке. Этот блок показывается только в том случае, если терминал текущей команды отличается от терминала предыдущей.
Вывод не интересующих вас в настоящий момент элементов журнала, таких как время, имя терминала и других, можно отключить. Для этого нужно воспользоваться формой управления журналом вверху страницы.
Небольшие комментарии к командам можно вставлять прямо из командной строки. Комментарий вводится прямо в командную строку, после символов #^ или #v. Символы ^ и v показывают направление выбора команды, к которой относится комментарий: ^ - к предыдущей, v - к следующей. Например, если в командной строке было введено:
$ whoami
user
$ #^ Интересно, кто я?в журнале это будет выглядеть так:
$ whoami
user
| Интересно, кто я? |
Если комментарий содержит несколько строк, его можно вставить в журнал следующим образом:
$ whoami
user
$ cat > /dev/null #^ Интересно, кто я?
Программа whoami выводит имя пользователя, под которым мы зарегистрировались в системе. - Она не может ответить на вопрос о нашем назначении в этом мире.В журнале это будет выглядеть так:
$ whoami user
|
Комментарии, не относящиеся непосредственно ни к какой из команд, добавляются точно таким же способом, только вместо симолов #^ или #v нужно использовать символы #=
1
2
3
4
Группы команд, выполненных на разных терминалах, разделяются специальной линией.
Под этой линией в правом углу показано имя терминала, на котором выполнялись команды.
Для того чтобы посмотреть команды только одного сенса,
нужно щёкнуть по этому названию.
LiLaLo (L3) расшифровывается как Live Lab Log.
Программа разработана для повышения эффективности обучения Unix/Linux-системам.
(c) Игорь Чубин, 2004-2008