#
# Set this variables before installation:
lilalo_user=13-10-2014
lab
lilalo_user=13-10-2014
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lab=NT-LNet
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
install_l3bashrc_for_this_users=${users:-"root user"} # users who will use l3agent and l3script
lilalo_context="/users/${lilalo_user}/${lab}/${hostname}"
#
###############################################################################
#
###############################################################################
-a -qi '(bsd|darwin)' && wget
lilalo_rc
lilalo_home
normC='\033[0;39m'
url_lilalo="http://xgu.ru/lilalo"
whiteC='\033[1;37m'
url_l3bashrc="${url_lilalo}"
{edC='\033[0;31m'//xgu.ru/lilalo"
{rl_l3agent="${url_lilalo}"
greenC='\033[0;32m'_lilalo}"/l3bashrc
url_l3config_pm="${url_lilalo}"
url_l3a apt-get install -y $apt_get_install_this
url_l3config="${url_lilalo}"
elseecho "Please install this dependencies manually:"
url_l3precho $apt_get_install_this
{rl_l3c echo "Have you installed this already (y/n)?"
url_perlecho y | readl_lilalo}
retuif echo $answer | grep -q ^[yY]
perl_modthen="Term-VT102 Text-Iconv"
if l_mo true=${ur>&lilalo}/
else
thenule echo Please install the dependencies and rerun the script
apt_get_instexit 1is="perl make libmodule-build-perl libc6-dev gcc"
fi
} fit_install_this="perl make libmodule-build-perl libc6-dev gcc"
wget
step()
{
msg="$1"
65,1 4%
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
{
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!
} 161,1 80%
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}'
}
}nstall_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}
41,1 32%