|
| 1 | +#!/usr/bin/env sh |
| 2 | +# Setup a repository during individual development. |
| 3 | +# |
| 4 | +# This script requires git program in the PATH. |
| 5 | + |
| 6 | +# Copyright (C) 2023 The C++ Plus Project. |
| 7 | +# |
| 8 | +# This program is free software: you can redistribute it and/or modify |
| 9 | +# it under the terms of the GNU Lesser General Public License as published by |
| 10 | +# the Free Software Foundation; either version 3 of the License, or |
| 11 | +# (at your option) any later version. |
| 12 | +# |
| 13 | +# This program is distributed in the hope that it will be useful, |
| 14 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | +# GNU Lesser General Public License for more details. |
| 17 | +# |
| 18 | +# You should have received a copy of the GNU Lesser General Public License |
| 19 | +# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 20 | + |
| 21 | +# Usage: ./setup.sh |
| 22 | +# |
| 23 | + |
| 24 | +# Usage: text_out [color_id] [level] [msg] |
| 25 | +text_out() |
| 26 | +{ |
| 27 | + echo "\033[$1m$2: $3 \033[0m" |
| 28 | +} |
| 29 | + |
| 30 | +# Usage: execute [command] |
| 31 | +execute() |
| 32 | +{ |
| 33 | + text_out 94 "$1" |
| 34 | + $1 |
| 35 | + return $? |
| 36 | +} |
| 37 | + |
| 38 | +if test -d './build-aux' |
| 39 | +then |
| 40 | + text_out 32 "Success" "'./build-aux' is exists, please don't remove it, and you can develop this package normally." |
| 41 | + exit 0 |
| 42 | +fi |
| 43 | + |
| 44 | +if test -d '../build-aux' |
| 45 | +then |
| 46 | + text_out 32 "Success" "'../build-aux' is exists, please don't remove it, and you can develop this package normally." |
| 47 | + exit 0 |
| 48 | +fi |
| 49 | + |
| 50 | +text_out 0 "Notice" "'../build-aux' for C++ Plus are not exists, cloning it......" |
| 51 | +execute "git clone https://github.com/cppp-project/build-aux" |
| 52 | +if [ $? -eq 0 ] |
| 53 | +then |
| 54 | + text_out 32 "Success" "'./build-aux' cloned successfully, please don't remove it, and you can develop this package normally." |
| 55 | +else |
| 56 | + text_out 31 "Error" "'./build-aux' cloned failed, you can clone it by yourself or copy it from C++ Plus release source package." |
| 57 | + text_out 0 "Notice" "try to run 'git clone https://github.com/cppp-project/build-aux'. " |
| 58 | +fi |
0 commit comments