Debian Codegraph @

pm-setup

raw
1 #!/bin/sh
2
3 # Public domain notice for all NCBI EDirect scripts is located at:
4 # https://www.ncbi.nlm.nih.gov/books/NBK179288/#chapter6.Public_Domain_Notice
5
6 # pm-setup
7
8 pth=$( dirname "$0" )
9
10 case "$pth" in
11 /* )
12 ;; # already absolute
13 * )
14 pth=$(cd "$pth" && pwd)
15 ;;
16 esac
17
18 case ":$PATH:" in
19 *:"$pth":* )
20 ;;
21 * )
22 PATH="$PATH:$pth"
23 export PATH
24 ;;
25 esac
26
27 # handle common flags - dot command is equivalent of "source"
28
29 if [ ! -f "$pth"/xcommon.sh ]
30 then
31 echo "ERROR: Unable to find '$pth/xcommon.sh' file" >&2
32 exit 1
33 fi
34
35 . "$pth"/xcommon.sh
36
37 # initialize specific flags
38
39 dbase=""
40
41 while [ $# -gt 0 ]
42 do
43 case "$1" in
44 -db )
45 dbase=$2
46 shift
47 shift
48 ;;
49 -* )
50 exec >&2
51 echo "$0: Unrecognized option $1" >&2
52 exit 1
53 ;;
54 * )
55 break
56 ;;
57 esac
58 done
59
60 if [ -z "$dbase" ]
61 then
62 echo "Must supply database in -db argument" >&2
63 exit 1
64 fi
65
66 for dir in Archive Sentinels Data Postings Source Extras Index Invert Merged Scratch Current Indexed Inverted
67 do
68 target=$( FindLocalArchiveFolder "$dbase" "$dir" "false" )
69 # remove trailing slash
70 target=${target%/}
71 if [ ! -d "$target" ]
72 then
73 echo "Creating $target" >&2
74 mkdir -p "$target"
75 fi
76 done
77
78 exit 0