File: metview_create_user_dir

package info (click to toggle)
metview 5.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 242,296 kB
  • sloc: cpp: 437,117; ansic: 41,433; xml: 19,944; f90: 13,059; sh: 6,562; python: 3,953; yacc: 1,774; lex: 1,121; perl: 701; makefile: 92
file content (59 lines) | stat: -rwxr-xr-x 1,485 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash

# **************************** LICENSE START ***********************************
#
# Copyright 2012 ECMWF and INPE. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************

#
# Create basic user directories by copying
# the prepared directories and files.
#
# Called by the main Metview script.
#
# Parameter:
#       User Metview directory (full path)
#


USER_SOURCE_DIR=$METVIEW_DIR/app-defaults/UserDir


if [ x$1 = x ]
then
   USER_DIR=$HOME/metview
else
   USER_DIR=$1
fi

if [ -d $USER_DIR ]
then
    echo "NOTE: directory $USER_DIR already exists. Metview will write new files into this directory."
fi


echo " creating Metview user directories in $USER_DIR..."
mkdir -p $USER_DIR

if [ -d $USER_SOURCE_DIR ]
then
   cp -r $USER_SOURCE_DIR/* $USER_DIR
   chmod -R u+w $USER_DIR
   cp "$USER_SOURCE_DIR/.mv_iconlist" "$USER_DIR/._mv_iconlist_"
   cp "$USER_SOURCE_DIR/Getting Started/.mv_iconlist" "$USER_DIR/Getting Started/._mv_iconlist_"
   chmod -R u+w $USER_DIR

   echo " created !"
else
   echo " UNABLE TO CREATE USER DIRECTORY: $USER_SOURCE_DIR"
   rmdir $USER_DIR
   exit 1
fi

# for neatness, unset these env vars
unset USER_SOURCE_DIR
unset USER_DIR