1 | #!/bin/bash |
---|
2 | |
---|
3 | ## Create minimal developement environment for NEMO |
---|
4 | ################################################### |
---|
5 | |
---|
6 | ## Optional arguments (developer ID, 'repo' to replicate the layout of the whole repository) |
---|
7 | |
---|
8 | dir='NEMO_dev'; repo='0'; root='/NEMO' |
---|
9 | rel='4.0'; ver='4.0.3' |
---|
10 | |
---|
11 | year=$( date +%Y ) |
---|
12 | |
---|
13 | while (( $# )); do |
---|
14 | [ "$1" == 'repo' ] && { dir='NEMO_repo' && repo='1' && root='/'; shift; } |
---|
15 | id=$1 |
---|
16 | shift |
---|
17 | done |
---|
18 | |
---|
19 | [ -d $dir ] && { echo $dir 'already exists => QUIT'; exit 2; } |
---|
20 | |
---|
21 | ## Copy of the repository with empty root directories |
---|
22 | echo 'Download a void working copy of' $root "from the repository ('svn co --depth empty ...')" |
---|
23 | svn co --depth empty http://forge.ipsl.jussieu.fr/nemo/svn/$root $dir |
---|
24 | echo |
---|
25 | |
---|
26 | ## Switch to developer role if ID is provided |
---|
27 | if [[ -n "$id" && -f ~/.ssh/id_rsa.pub ]]; then |
---|
28 | echo 'Switch to developer role by relocating the URL scheme from HTTP to SVN+SSH' |
---|
29 | echo "('svn sw --relocate http://... svn+ssh://...')" |
---|
30 | ssh-copy-id -i ~/.ssh/id_rsa.pub $id@forge.ipsl.jussieu.fr 2> /dev/null |
---|
31 | svn sw --relocate http://forge.ipsl.jussieu.fr \ |
---|
32 | svn+ssh://$id@forge.ipsl.jussieu.fr/ipsl/forge/projets \ |
---|
33 | $dir |
---|
34 | echo |
---|
35 | fi |
---|
36 | |
---|
37 | ## If requested by 'repo', |
---|
38 | if [ "$repo" == '1' ]; then |
---|
39 | echo "With 'repo' arg, create a lightweight copy of the repository" |
---|
40 | echo 'for the developement of the sources defined as "externals"' |
---|
41 | |
---|
42 | for item in utils/build/{arch,makenemo,mk} utils/tools \ |
---|
43 | vendors/{AGRIF/dev,FCM,IOIPSL} ; do |
---|
44 | echo '¤' $item |
---|
45 | svn up -q --parents $dir/$item |
---|
46 | done |
---|
47 | |
---|
48 | dir+=/'NEMO' |
---|
49 | echo |
---|
50 | fi |
---|
51 | |
---|
52 | ## Get the 1st level tree under 'branches' and 'releases' |
---|
53 | echo "Get empty folders under /NEMO/branches ('svn up --depth empty ...'):" |
---|
54 | |
---|
55 | for item in branches releases; do |
---|
56 | svn up -q --parents --depth immediates $dir/$item |
---|
57 | done |
---|
58 | |
---|
59 | echo |
---|
60 | |
---|
61 | ## Download trunk and last release |
---|
62 | echo "Full download of 2 main branches ('svn up'): trunk and last stable" |
---|
63 | echo '¤ /NEMO/trunk' |
---|
64 | svn up -q $dir/trunk |
---|
65 | |
---|
66 | echo "¤ /NEMO/releases/r$rel/r$ver" |
---|
67 | svn up -q --parents $dir/releases/r$rel/r$ver |
---|
68 | |
---|
69 | exit 0 |
---|