Понедельник (07/16/18)

/dev/pts/0
12:49:13
#tac install
show_final_message
rm -rf ${temp_dir}
cd /
step "Adding l3-agent invocation to ~/.bash_profile " install_to_users_bash_profile $install_l3bashrc_for_this_users
step "Adding l3bashrc invocation to ~/.bashrc " install_to_users_bashrc $install_l3bashrc_for_this_users
step "Installing l3bashrc to users home directories" install_to_users_homes $install_l3bashrc_for_this_users
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 "Downloading perl modules for l3-agent" '{ for i in ${perl_modules}; do ${wget} ${url_perl_modules}/$i.tar.gz; done; }'
step "Downloading l3-agent" '${wget} ${url_l3agent}; ${wget} ${url_l3config_pm}; ${wget} ${url_l3config}'
step "Downloading l3prompt" ${wget} ${url_l3prompt}
step "Downloading l3bashrc" ${wget} ${url_l3bashrc}
step "Installing dependencies" apt_get_install_deps
cd ${temp_dir}
mkdir -p ${temp_dir}
temp_dir=/tmp/lilalo-install-temp-$$
}
FINAL_MESSAGE
(don't forget to restart bash or relogin)
Happy Labbing!
Thank you gor using LiLaLo.
For further information see http://xgu.ru/lilalo/ (in Russian).
to change and to know your current context.
 $ l3pwd
 $ l3cd ${lilalo_context%/*/*}/MY-NEW-CONTEXT/${hostname}/USER
Use commands
http://xgu.ru/l3/${lilalo_context}
If you use xgu.ru backend, your labs will be available at
Your current lilalo context is ${lilalo_context}/USER
to start script writing.
Now restart your shell or relogin
Installation is successfully completed.
    cat <<FINAL_MESSAGE
{
show_final_message()
}
USAGE
    $0
Usage:
    cat <<USAGE
{
show_usage()
}
    done
        || { 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; }
        grep -q l3-agent ${user_home}/.bash_profile 2> /dev/null \
        user_home=`get_user_home "$user"`
    do
    for user in $users
    users="$@"
{
install_to_users_bash_profile()
}
    done
        || echo "[ \$0 == l3script ] && . ${user_home}/.lilalo/l3bashrc && _l3_start" >> ${user_home}/.bashrc; chown -R ${user} ${user_home}/.bashrc
        grep -q lilalo ${user_home}/.bashrc 2> /dev/null\
        user_home=`get_user_home "$user"`
    do
    for user in $users
    users="$@"
{
install_to_users_bashrc()
}
    set +x
    done
        chown -R $user ${user_home}/${lilalo_rc}
        echo l3cd=${lilalo_context}/$user > ${user_home}/${lilalo_rc}
        chown -R $user ${user_home}/${lilalo_home}
        chmod 755 ${user_home}/${lilalo_home}/l3prompt
        cp l3prompt ${user_home}/${lilalo_home}
        cp l3bashrc ${user_home}/${lilalo_home}
        chmod 755 /usr/local/bin/l3-{agent,config}
        ln -s `which bash` /usr/local/bin/l3script
        cp l3-config /usr/local/bin
        cp l3-agent /usr/local/bin
        cp l3config.pm /etc/lilalo/
        mkdir /etc/lilalo/
        mkdir -p ${user_home}/${lilalo_home}
        user_home=`get_user_home "$user"`
    do
    for user in $users
    set -x
    users="$@"
    . l3bashrc
{
install_to_users_homes()
}
    uname -a | egrep -qi '(freebsd|darwin)' && pw user show "$@"| awk -F: '{print $9}' || getent passwd "$@"| awk -F: '{print $6}'
{
get_user_home()
}
    }
        printf "${redC}""Failed\n""${normC}"
        cat log | sed 's/^/|\ \ \ /'
    {
    } || \
          printf "${greenC}""Ok\n""${normC}"
          cat log | sed 's/^/|\ \ \ /'
    {
    eval "$@" 2>&1 > log 2>&1 && \
#    eval "$@" 2>&1 | sed 's/^/|\ \ \ /' && printf "Ok\n" || printf "Failed\n"
    printf "${whiteC}""$msg""...${normC}\n"
    shift
    msg="$1"
{
step()
}
    fi
        fi
            exit 1
            echo Please install the dependencies and rerun the script
        else
            true
        then
        if echo $answer | grep -q ^[yY]
        echo y | read answer
        echo "Have you installed this already (y/n)?"
        echo $apt_get_install_this
        echo "Please install this dependencies manually:"
    else
        apt-get install -y $apt_get_install_this
    then
    if which apt-get >& /dev/null
    return 0
{
apt_get_install_deps()
greenC='\033[0;32m'
redC='\033[0;31m'
whiteC='\033[1;37m'
normC='\033[0;39m'
uname -a | egrep -qi '(bsd|darwin)' && wget=fetch
wget=wget
apt_get_install_this="perl make libmodule-build-perl libc6-dev gcc"
perl_modules="Term-VT102 Text-Iconv"
url_perl_modules=${url_lilalo}/
url_l3prompt="${url_lilalo}"/l3prompt
url_l3config="${url_lilalo}"/l3-config
url_l3config_pm="${url_lilalo}"/l3config.pm
url_l3agent="${url_lilalo}"/l3-agent
url_l3bashrc="${url_lilalo}"/l3bashrc
url_lilalo="http://xgu.ru/lilalo"
lilalo_home=.lilalo
lilalo_rc=.l3rc
###############################################################################
#
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
install_l3bashrc_for_this_users=${users:-"root user"}  # users who will use l3agent and l3script
lab=NT-LNet
lilalo_user=13-10-2014
# Set this variables before installation:
#
###############################################################################
uname -a | egrep -qi '(freebsd|darwin)' || hostname=`hostname -f`
hostname=`hostname`
#!/bin/sh