2017-11-25 04:00:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
genRandStr(){
|
2018-04-15 07:06:43 +00:00
|
|
|
cat /dev/urandom | tr -dc [:alnum:] | head -c $1
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
#Set some vars
|
|
|
|
_database_password_=root
|
|
|
|
_judger_socket_port_=2333
|
2018-04-15 02:58:57 +00:00
|
|
|
_judger_socket_password_=$(genRandStr 32)
|
2017-11-25 04:00:00 +00:00
|
|
|
_main_judger_password_=$(genRandStr 32)
|
2018-04-15 02:58:57 +00:00
|
|
|
_svn_ourroot_password_=$(genRandStr 32)
|
2017-11-25 04:00:00 +00:00
|
|
|
_svn_certroot_password_=$(genRandStr 32)
|
|
|
|
|
|
|
|
getAptPackage(){
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n==> Getting environment packages\n"
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set MySQL root password
|
2018-12-15 11:55:03 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
(echo "mysql-server mysql-server/root_password password $_database_password_";echo "mysql-server mysql-server/root_password_again password $_database_password_") | debconf-set-selections
|
2018-04-15 07:06:43 +00:00
|
|
|
#Update apt sources and install
|
2018-12-25 15:58:33 +00:00
|
|
|
dpkg -s gnupg 2>/dev/null || (apt-get update && apt-get install -y gnupg)
|
2018-12-15 11:55:03 +00:00
|
|
|
echo "deb http://ppa.launchpad.net/pinepain/libv8/ubuntu artful main" | tee /etc/apt/sources.list.d/pinepain-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C60AA4
|
2018-09-20 14:05:15 +00:00
|
|
|
apt-get update && apt-get install -y vim ntp zip unzip curl wget subversion apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring mysql-server cmake fp-compiler re2c libv8-6.6-dev libyaml-dev python python3 python-requests
|
2018-04-15 07:06:43 +00:00
|
|
|
#Install PHP extensions
|
2018-12-15 11:55:03 +00:00
|
|
|
cp -a /opt/libv8*/* /usr && printf "\n\n" | pecl install v8js yaml
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
getOracleJDK(){
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n==> Getting JDK runtime files\n"
|
2018-04-15 07:06:43 +00:00
|
|
|
#Add judger user
|
|
|
|
useradd -m local_main_judger && usermod -a -G www-data local_main_judger
|
2018-09-21 16:42:01 +00:00
|
|
|
#Set Oracle JDK do not track usage
|
|
|
|
mkdir -p /etc/oracle/java/ && echo 'com.oracle.usagetracker.track.last.usage=false' >/etc/oracle/java/usagetracker.properties
|
2018-04-15 07:06:43 +00:00
|
|
|
#Get newest jdk dist file
|
2018-09-20 14:05:15 +00:00
|
|
|
JDK_MIRROR_LINK=https://build.funtoo.org/distfiles/oracle-java/
|
2018-04-15 07:06:43 +00:00
|
|
|
curl -s ${JDK_MIRROR_LINK} | grep -oP '>jdk-[7,8].*-linux-x64.tar' | sed -e 's/[\",>]//g' -e 's/-linux-x64.tar//g' >jdkdist.list
|
2018-12-25 15:58:33 +00:00
|
|
|
wget --progress=dot:giga ${JDK_MIRROR_LINK}$(sed -n '1p' jdkdist.list)-linux-x64.tar.gz ${JDK_MIRROR_LINK}$(sed -n '$p' jdkdist.list)-linux-x64.tar.gz
|
|
|
|
#Change compiler version to faq.php
|
2018-09-21 16:42:01 +00:00
|
|
|
sed -i -e 's/Ubuntu Linux 14.04 LTS x64/Ubuntu Linux 18.04 LTS x64/' \
|
|
|
|
-e 's/g++ 4.8.4/g++ 7.3.0/' -e 's/gcc 4.8.4/gcc 7.3.0/' -e 's/fpc 2.6.2/fpc 3.0.4/' -e 's/Python 2.7和3.4/Python 2.7和3.6/' \
|
|
|
|
-e "s/jdk-7u76/$(sed -n '1p' jdkdist.list)/g" -e "s/jdk-8u31/$(sed -n '$p' jdkdist.list)/g" ../../uoj/1/app/controllers/faq.php
|
2018-12-25 15:58:33 +00:00
|
|
|
#Move jdk file to judger user root
|
2018-04-15 07:06:43 +00:00
|
|
|
chown local_main_judger jdkdist.list jdk-*-linux-x64.tar.gz
|
|
|
|
mv jdkdist.list jdk-*-linux-x64.tar.gz /home/local_main_judger/
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setLAMPConf(){
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n==> Setting LAMP configs\n"
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set Apache UOJ site conf
|
|
|
|
cat >/etc/apache2/sites-available/000-uoj.conf <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
<VirtualHost *:80>
|
2018-04-15 07:06:43 +00:00
|
|
|
#ServerName local_uoj.ac
|
|
|
|
ServerAdmin opensource@uoj.ac
|
|
|
|
DocumentRoot /var/www/uoj
|
2017-11-25 04:00:00 +00:00
|
|
|
|
2018-04-15 07:06:43 +00:00
|
|
|
#LogLevel info ssl:warn
|
|
|
|
ErrorLog \${APACHE_LOG_DIR}/uoj_error.log
|
|
|
|
CustomLog \${APACHE_LOG_DIR}/uoj_access.log combined
|
2017-11-25 04:00:00 +00:00
|
|
|
|
2018-04-15 07:06:43 +00:00
|
|
|
XSendFile On
|
|
|
|
XSendFilePath /var/uoj_data
|
|
|
|
XSendFilePath /var/www/uoj/app/storage
|
|
|
|
XSendFilePath /home/local_main_judger/judge_client/uoj_judger/include
|
2017-11-25 04:00:00 +00:00
|
|
|
</VirtualHost>
|
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
#Enable modules and make UOJ site conf enabled
|
|
|
|
a2ensite 000-uoj.conf && a2dissite 000-default.conf
|
2018-09-20 14:05:15 +00:00
|
|
|
a2enmod rewrite headers && sed -i -e '172s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
2018-04-15 07:06:43 +00:00
|
|
|
#Create UOJ session save dir and make PHP extensions available
|
|
|
|
mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions
|
2018-09-20 14:05:15 +00:00
|
|
|
sed -i -e '865a\extension=v8js.so\nextension=yaml.so' /etc/php/7.2/apache2/php.ini
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set MySQL user directory and connection config
|
|
|
|
usermod -d /var/lib/mysql/ mysql
|
|
|
|
cat >/etc/mysql/mysql.conf.d/uoj_mysqld.cnf <<UOJEOF
|
|
|
|
[mysqld]
|
|
|
|
character-set-server=utf8
|
|
|
|
collation-server=utf8_unicode_ci
|
|
|
|
init_connect='SET NAMES utf8'
|
|
|
|
init_connect='SET collation_connection = utf8_unicode_ci'
|
|
|
|
skip-character-set-client-handshake
|
|
|
|
sql-mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
|
|
|
|
UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setSVNServe(){
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n==> Setting SVN server\n"
|
2018-04-15 07:06:43 +00:00
|
|
|
#Make SVN work dir
|
|
|
|
mkdir /var/svn && svnserve -d -r /var/svn
|
2018-12-15 11:55:03 +00:00
|
|
|
mkdir /var/svn/problem && chown -R www-data /var/svn/problem
|
2018-04-15 07:06:43 +00:00
|
|
|
svnadmin create /var/svn/uoj && svnadmin create /var/svn/judge_client
|
|
|
|
#Set SVN server config file and password db
|
|
|
|
sed -i -e 's/# store-plaintext-passwords = no/store-plaintext-passwords = yes/g' /etc/subversion/servers
|
|
|
|
sed -i -e 's/# anon-access/anon-access/g' -e 's/# auth-access/auth-access/g' -e 's/# password-db/password-db/g' /var/svn/uoj/conf/svnserve.conf
|
|
|
|
rm -r /var/svn/judge_client/conf/passwd && ln -s /var/svn/uoj/conf/passwd /var/svn/judge_client/conf/passwd
|
|
|
|
cat /var/svn/uoj/conf/svnserve.conf >/var/svn/judge_client/conf/svnserve.conf
|
|
|
|
cat >/var/svn/uoj/conf/passwd <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
[users]
|
2018-12-25 15:58:33 +00:00
|
|
|
root = _svn_certroot_password_
|
2017-11-25 04:00:00 +00:00
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set SVN hook scripts
|
|
|
|
cat >/var/svn/uoj/hooks/post-commit <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
#!/bin/sh
|
2018-12-25 15:58:33 +00:00
|
|
|
cd /var/svn/uoj/cur/uoj && svn update --username root --password _svn_certroot_password_
|
2017-11-25 04:00:00 +00:00
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
chmod +x /var/svn/uoj/hooks/post-commit
|
|
|
|
cat >/var/svn/judge_client/hooks/post-commit <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
#!/bin/sh
|
|
|
|
su local_main_judger -c '~/judge_client/judge_client update'
|
|
|
|
exit \$?
|
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
chmod +x /var/svn/judge_client/hooks/post-commit
|
|
|
|
cat >/var/svn/problem/new_problem.sh <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
if [ \$# -ne 1 ]
|
|
|
|
then
|
2018-04-15 07:06:43 +00:00
|
|
|
echo 'invalid argument'
|
|
|
|
exit 1
|
2017-11-25 04:00:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
path=/var/svn/problem/\$1
|
|
|
|
mkdir \$path
|
|
|
|
svnadmin create \$path
|
|
|
|
cat >\$path/conf/svnserve.conf <<EOD
|
|
|
|
[general]
|
|
|
|
anon-access = none
|
|
|
|
auth-access = write
|
|
|
|
password-db = passwd
|
|
|
|
EOD
|
|
|
|
|
|
|
|
svnusr="our-root"
|
2018-12-25 15:58:33 +00:00
|
|
|
svnpwd="_svn_ourroot_password_"
|
2017-11-25 04:00:00 +00:00
|
|
|
|
|
|
|
cat >\$path/conf/passwd <<EOD
|
|
|
|
[users]
|
|
|
|
\$svnusr = \$svnpwd
|
|
|
|
EOD
|
|
|
|
|
|
|
|
mkdir \$path/cur && cd \$path/cur
|
|
|
|
svn checkout svn://127.0.0.1/problem/\$1 --username \$svnusr --password \$svnpwd
|
|
|
|
mkdir /var/uoj_data/\$1
|
|
|
|
|
|
|
|
cat >\$path/hooks/post-commit <<EODEOD
|
|
|
|
#!/bin/sh
|
|
|
|
/var/svn/problem/post-commit.sh \$1
|
|
|
|
EODEOD
|
|
|
|
chmod +x \$path/hooks/post-commit
|
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
chmod +x /var/svn/problem/new_problem.sh
|
|
|
|
cat >/var/svn/problem/post-commit.sh <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
#!/bin/sh
|
|
|
|
svnusr="our-root"
|
2018-12-25 15:58:33 +00:00
|
|
|
svnpwd="_svn_ourroot_password_"
|
2017-11-25 04:00:00 +00:00
|
|
|
cd /var/svn/problem/\$1/cur/\$1
|
|
|
|
svn update --username \$svnusr --password \$svnpwd
|
2018-12-15 11:55:03 +00:00
|
|
|
chown -R www-data /var/svn/problem/\$1
|
2017-11-25 04:00:00 +00:00
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
chmod +x /var/svn/problem/post-commit.sh
|
|
|
|
#Precheckout to cur folder
|
|
|
|
mkdir /var/svn/uoj/cur /var/svn/judge_client/cur
|
2018-12-25 15:58:33 +00:00
|
|
|
svn co svn://127.0.0.1/uoj --username root --password '_svn_certroot_password_' /var/svn/uoj/cur/uoj
|
|
|
|
svn co svn://127.0.0.1/judge_client --username root --password '_svn_certroot_password_' /var/svn/judge_client/cur/judge_client
|
2018-12-15 11:55:03 +00:00
|
|
|
chown -R local_main_judger /var/svn/judge_client/cur/judge_client
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setWebConf(){
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n==> Setting web files\n"
|
2018-04-15 07:06:43 +00:00
|
|
|
#Commit web source file
|
2018-12-25 15:58:33 +00:00
|
|
|
svn co svn://127.0.0.1/uoj --username root --password '_svn_certroot_password_'
|
|
|
|
cp -r ../../uoj/1 uoj/1 && cd uoj
|
|
|
|
svn add 1 && svn ci -m "Installtion commit" --username root --password '_svn_certroot_password_'
|
|
|
|
cd .. && rm -r uoj
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set webroot path
|
2018-12-25 15:58:33 +00:00
|
|
|
ln -sf /var/svn/uoj/cur/uoj/1 /var/www/uoj
|
2018-12-15 11:55:03 +00:00
|
|
|
chown -R www-data /var/www/uoj/app/storage
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set web config file
|
|
|
|
php -a <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
\$config = include '/var/www/uoj/app/.default-config.php';
|
|
|
|
\$config['database']['password']='$_database_password_';
|
|
|
|
\$config['judger']['socket']['port']='$_judger_socket_port_';
|
|
|
|
file_put_contents('/var/www/uoj/app/.config.php', "<?php\nreturn ".str_replace('\'_httpHost_\'','UOJContext::httpHost()',var_export(\$config, true)).";\n");
|
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
#Import MySQL database
|
2018-09-20 14:05:15 +00:00
|
|
|
service mysql restart
|
2018-04-15 07:06:43 +00:00
|
|
|
mysql -u root --password=$_database_password_ <app_uoj233.sql
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setJudgeConf(){
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n==> Setting judge_client files\n"
|
2018-04-15 07:06:43 +00:00
|
|
|
#Commit judge_client source file
|
2018-12-25 15:58:33 +00:00
|
|
|
svn co svn://127.0.0.1/judge_client --username root --password '_svn_certroot_password_'
|
|
|
|
cp -r ../../judge_client/1 judge_client/1 && cd judge_client
|
|
|
|
svn add 1 && svn ci -m "Installation commit" --username root --password '_svn_certroot_password_'
|
2018-12-15 11:55:03 +00:00
|
|
|
cd .. && rm -r judge_client
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set uoj_data path
|
|
|
|
mkdir /var/uoj_data
|
2018-12-15 11:55:03 +00:00
|
|
|
chown -R www-data /var/uoj_data && chgrp -R www-data /var/uoj_data
|
2018-04-15 07:06:43 +00:00
|
|
|
#Compile judge_client and set runtime
|
|
|
|
su local_main_judger <<EOD
|
2018-12-25 15:58:33 +00:00
|
|
|
svn update /var/svn/judge_client/cur/judge_client --username root --password '_svn_certroot_password_'
|
2017-11-25 04:00:00 +00:00
|
|
|
ln -s /var/svn/judge_client/cur/judge_client/1 ~/judge_client
|
|
|
|
ln -s /var/uoj_data ~/judge_client/uoj_judger/data
|
|
|
|
cd ~/judge_client && chmod +x judge_client
|
2018-09-21 16:42:01 +00:00
|
|
|
cat >uoj_judger/include/uoj_work_path.h <<UOJEOF
|
|
|
|
#define UOJ_WORK_PATH "/home/local_main_judger/judge_client/uoj_judger"
|
|
|
|
#define UOJ_JUDGER_BASESYSTEM_UBUNTU1804
|
|
|
|
#define UOJ_JUDGER_PYTHON3_VERSION "3.6"
|
|
|
|
#define UOJ_JUDGER_FPC_VERSION "3.0.4"
|
|
|
|
UOJEOF
|
2018-12-25 15:58:33 +00:00
|
|
|
cd uoj_judger && make -j$(($(grep -c ^processor /proc/cpuinfo) + 1))
|
2017-11-25 04:00:00 +00:00
|
|
|
mkdir ~/judge_client/uoj_judger/run/runtime && cd ~/judge_client/uoj_judger/run/runtime
|
|
|
|
mv ~/jdkdist.list ~/jdk-*-linux-x64.tar.gz .
|
|
|
|
tar -xzf jdk-7*-linux-x64.tar.gz && tar -xzf jdk-8*-linux-x64.tar.gz
|
2018-09-21 07:05:58 +00:00
|
|
|
mv jdk1.7* jdk1.7.0 && mv jdk1.8* jdk1.8.0
|
2017-11-25 04:00:00 +00:00
|
|
|
EOD
|
2018-04-15 07:06:43 +00:00
|
|
|
#Set judge_client config file
|
|
|
|
cat >/home/local_main_judger/judge_client/.conf.json <<UOJEOF
|
2017-11-25 04:00:00 +00:00
|
|
|
{
|
2018-04-15 07:06:43 +00:00
|
|
|
"uoj_protocol": "http",
|
|
|
|
"uoj_host": "127.0.0.1",
|
|
|
|
"judger_name": "main_judger",
|
2018-12-25 15:58:33 +00:00
|
|
|
"judger_password": "_main_judger_password_",
|
2018-04-15 07:06:43 +00:00
|
|
|
"socket_port": $_judger_socket_port_,
|
2018-12-25 15:58:33 +00:00
|
|
|
"socket_password": "_judger_socket_password_",
|
2018-04-15 07:06:43 +00:00
|
|
|
"svn_username": "root",
|
2018-12-25 15:58:33 +00:00
|
|
|
"svn_password": "_svn_certroot_password_"
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
UOJEOF
|
2018-04-15 07:06:43 +00:00
|
|
|
chmod 600 /home/local_main_judger/judge_client/.conf.json
|
|
|
|
chown local_main_judger /home/local_main_judger/judge_client/.conf.json
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
2018-12-25 15:58:33 +00:00
|
|
|
initProgress(){
|
|
|
|
printf "\n\n==> Doing initial config and start service\n"
|
|
|
|
#Replace password placeholders
|
|
|
|
sed -i "s/_svn_ourroot_password_/$_svn_ourroot_password_/g" /var/svn/problem/new_problem.sh /var/svn/problem/post-commit.sh /var/www/uoj/app/.config.php
|
|
|
|
sed -i "s/_svn_certroot_password_/$_svn_certroot_password_/g" /var/svn/uoj/conf/passwd /var/svn/uoj/hooks/post-commit /home/local_main_judger/judge_client/.conf.json
|
|
|
|
sed -i -e "s/_main_judger_password_/$_main_judger_password_/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /home/local_main_judger/judge_client/.conf.json
|
|
|
|
sed -i -e "s/salt0/$(genRandStr 32)/g" -e "s/salt1/$(genRandStr 16)/g" -e "s/salt2/$(genRandStr 16)/g" -e "s/salt3/$(genRandStr 16)/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /var/www/uoj/app/.config.php
|
|
|
|
#Import judge_client to MySQL database
|
|
|
|
service mysql start
|
|
|
|
echo "insert into judger_info (judger_name, password) values (\"main_judger\", \"$_main_judger_password_\")" | mysql app_uoj233 -u root --password=$_database_password_
|
2018-04-15 07:06:43 +00:00
|
|
|
#Using cli upgrade to latest
|
|
|
|
php /var/www/uoj/app/cli.php upgrade:latest
|
|
|
|
#Start services
|
|
|
|
service ntp restart
|
|
|
|
service mysql restart
|
|
|
|
service apache2 restart
|
|
|
|
su local_main_judger -c '~/judge_client/judge_client start'
|
2018-12-25 15:58:33 +00:00
|
|
|
#Touch SetupDone flag file
|
|
|
|
touch /var/svn/.UOJSetupDone
|
2018-12-15 11:55:03 +00:00
|
|
|
printf "\n\n***Installation complete. Enjoy!***\n"
|
2017-11-25 04:00:00 +00:00
|
|
|
}
|
|
|
|
|
2018-12-25 15:58:33 +00:00
|
|
|
prepProgress(){
|
|
|
|
getAptPackage;getOracleJDK;setLAMPConf;setSVNServe;setWebConf;setJudgeConf
|
|
|
|
}
|
|
|
|
|
2018-04-15 07:06:43 +00:00
|
|
|
if [ $# -le 0 ] ;then
|
|
|
|
echo 'Installing UOJ System bundle...'
|
2018-12-25 15:58:33 +00:00
|
|
|
prepProgress;initProgress
|
2017-11-25 04:00:00 +00:00
|
|
|
fi
|
2018-04-15 07:06:43 +00:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
2018-12-25 15:58:33 +00:00
|
|
|
-p | --prep)
|
|
|
|
echo 'Preparing UOJ System bundle environment...'
|
|
|
|
prepProgress
|
2018-04-15 07:06:43 +00:00
|
|
|
;;
|
2018-12-25 15:58:33 +00:00
|
|
|
-i | --init)
|
|
|
|
echo 'Initing UOJ System bundle...'
|
|
|
|
initProgress
|
2018-04-15 07:06:43 +00:00
|
|
|
;;
|
2018-12-15 11:55:03 +00:00
|
|
|
-? | --*)
|
2018-04-15 07:06:43 +00:00
|
|
|
echo "Illegal option $1"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift $(( $#>0?1:0 ))
|
|
|
|
done
|