Skip to content
Snippets Groups Projects
Commit a8118623 authored by Zihao Yu's avatar Zihao Yu
Browse files

init.sh: add retry

parent 7d0c8943
No related branches found
No related tags found
No related merge requests found
...@@ -3,16 +3,18 @@ ...@@ -3,16 +3,18 @@
log="" log=""
function init() { function init() {
if test -d $1; then if [ -d $1 ]; then
echo "$1 is already initialized, exiting..." echo "$1 is already initialized, exiting..."
return return
fi fi
git clone -b ics2017 https://github.com/NJU-ProjectN/$1.git while [ ! -d $1 ]; do
git clone -b ics2017 https://github.com/NJU-ProjectN/$1.git
done
log="$log$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n' log="$log$1 `cd $1 && git log --oneline --no-abbrev-commit -n1`"$'\n'
rm -rf $1/.git rm -rf $1/.git
if test $2; then if [ $2 ] ; then
sed -i -e "/^export $2=.*/d" ~/.bashrc sed -i -e "/^export $2=.*/d" ~/.bashrc
echo "export $2=`readlink -e $1`" >> ~/.bashrc echo "export $2=`readlink -e $1`" >> ~/.bashrc
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment