File: create_common

package info (click to toggle)
ctn 3.2.0~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 15,336 kB
  • ctags: 21,262
  • sloc: ansic: 179,501; makefile: 7,004; java: 1,863; csh: 1,067; yacc: 523; sh: 424; cpp: 394; sql: 389; lex: 170
file content (103 lines) | stat: -rw-r--r-- 3,151 bytes parent folder | download | duplicates (9)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/csh
# Intent:       Script for loading database files with images
# $Revision: 1.4 $

echo This script loads the common database with the images provided by
echo MIR.  You may choose to alter it for your own purposes.
echo ""

set ROOT = /mir_ctn
echo The default root directory for the MIR CTN data files is $ROOT.
echo You can choose a different directory at this point by entering
echo the directory name.  If you wish to use the default, just hit RETURN.
echo ""
set a = $<
if ($a != "") then
echo Do you wish to use $a as the root directory "(y/n)?"
set b = $<
if (($b != "y") && ($b != "Y")) then
echo Script exiting.  Please try again.
exit
endif
set ROOT = $a
endif

echo Before running this script, you should run img_layout to create
echo directories for the images.  Once that is done, you should copy the
echo image directories distributed by MIR to $ROOT/img/db/common.  That
echo directory should contain the following subdirectories:
echo "    cr1   cr2   cr3   ct1   ct2   ct3   ct4   mr1   mr2   mr3   mr4"
echo "    nm1   nm2   nm3   us1   us2   us3"
echo "    xray1 xray2 xray3"

set PASS = TRUE
#foreach i (cr1 cr2 cr3 ct1 ct2 ct3 ct4 mr1 mr2 mr3 mr4 xray1 xray2 xray3)
foreach i (cr1 ct1 mr1 xray1)
echo Checking for existence of $ROOT/img/db/common/$i
if (!(-e $ROOT/img/db/common/$i)) then
set PASS = FALSE
echo $ROOT/img/db/common/$i missing
endif
end
#foreach i (nm1 nm2 nm3 us1 us2 us3)
foreach i (nm1 us1)
echo Checking for existence of $ROOT/img/db/common/$i
if (!(-e $ROOT/img/db/common/$i)) then
set PASS = FALSE
echo $ROOT/img/db/common/$i missing
endif
end

if ($PASS == "FALSE") then
echo ""
echo This script failed because one or more image subdirectories is missing.
echo Please copy the image subdirectories to $ROOT/img/db/common and try
echo again.
exit
endif

umask 0
if (-e $ROOT/img/db/common/db) then
echo ""
echo A database file $ROOT/img/db/common/db already exists.  You want
echo to delete that file before continuing.  If you do not delete that
echo file, you run the risk of having some of your image files deleted
echo \(it is a side effect of our code for the demo\).  Should I delete
echo the file for you "(y/n)?"

set a = $<
if (($a == "y") || ($a == "Y")) then
rm -f $ROOT/img/db/common/db
if (-e $ROOT/img/db/common/db) then
echo ""
echo I could not delete $ROOT/img/db/common/db.  I am quitting.
exit
endif
else
echo I will not delete $ROOT/img/db/common/db.  Should I continue to
echo fill the database "(y/n)?"
set a = $<
if (!(($a == "y") || ($a == "Y"))) then
echo Exiting with no changes made
exit
endif
endif
endif

echo ""
echo The next step is the last part of the script and will take some
echo time \(6 minutes on a Sparc 10\).  Please hit RETURN when you
echo are ready to begin.
set a = $<

#foreach i (cr1 cr2 cr3 ct1 ct2 ct3 ct4 mr1 mr2 mr3 mr4 xray1 xray2 xray3)
foreach i (cr1 ct1 mr1 xray1)
echo Populating database for $ROOT/img/db/common/$i
dbfill $ROOT/img/db/common/db $ROOT/img/db/common/$i/*
end

#foreach i (nm1 nm2 nm3 us1 us2 us3)
foreach i (nm1 us1)
echo Populating database for $ROOT/img/db/common/$i
dbfill $ROOT/img/db/common/db $ROOT/img/db/common/$i/*
end