Debian Codegraph @

apps/scripts/create_common

raw
1 #!/bin/csh
2 # Intent: Script for loading database files with images
3 # $Revision: 1.4 $
4
5 echo This script loads the common database with the images provided by
6 echo MIR. You may choose to alter it for your own purposes.
7 echo ""
8
9 set ROOT = /mir_ctn
10 echo The default root directory for the MIR CTN data files is $ROOT.
11 echo You can choose a different directory at this point by entering
12 echo the directory name. If you wish to use the default, just hit RETURN.
13 echo ""
14 set a = $<
15 if ($a != "") then
16 echo Do you wish to use $a as the root directory "(y/n)?"
17 set b = $<
18 if (($b != "y") && ($b != "Y")) then
19 echo Script exiting. Please try again.
20 exit
21 endif
22 set ROOT = $a
23 endif
24
25 echo Before running this script, you should run img_layout to create
26 echo directories for the images. Once that is done, you should copy the
27 echo image directories distributed by MIR to $ROOT/img/db/common. That
28 echo directory should contain the following subdirectories:
29 echo " cr1 cr2 cr3 ct1 ct2 ct3 ct4 mr1 mr2 mr3 mr4"
30 echo " nm1 nm2 nm3 us1 us2 us3"
31 echo " xray1 xray2 xray3"
32
33 set PASS = TRUE
34 #foreach i (cr1 cr2 cr3 ct1 ct2 ct3 ct4 mr1 mr2 mr3 mr4 xray1 xray2 xray3)
35 foreach i (cr1 ct1 mr1 xray1)
36 echo Checking for existence of $ROOT/img/db/common/$i
37 if (!(-e $ROOT/img/db/common/$i)) then
38 set PASS = FALSE
39 echo $ROOT/img/db/common/$i missing
40 endif
41 end
42 #foreach i (nm1 nm2 nm3 us1 us2 us3)
43 foreach i (nm1 us1)
44 echo Checking for existence of $ROOT/img/db/common/$i
45 if (!(-e $ROOT/img/db/common/$i)) then
46 set PASS = FALSE
47 echo $ROOT/img/db/common/$i missing
48 endif
49 end
50
51 if ($PASS == "FALSE") then
52 echo ""
53 echo This script failed because one or more image subdirectories is missing.
54 echo Please copy the image subdirectories to $ROOT/img/db/common and try
55 echo again.
56 exit
57 endif
58
59 umask 0
60 if (-e $ROOT/img/db/common/db) then
61 echo ""
62 echo A database file $ROOT/img/db/common/db already exists. You want
63 echo to delete that file before continuing. If you do not delete that
64 echo file, you run the risk of having some of your image files deleted
65 echo \(it is a side effect of our code for the demo\). Should I delete
66 echo the file for you "(y/n)?"
67
68 set a = $<
69 if (($a == "y") || ($a == "Y")) then
70 rm -f $ROOT/img/db/common/db
71 if (-e $ROOT/img/db/common/db) then
72 echo ""
73 echo I could not delete $ROOT/img/db/common/db. I am quitting.
74 exit
75 endif
76 else
77 echo I will not delete $ROOT/img/db/common/db. Should I continue to
78 echo fill the database "(y/n)?"
79 set a = $<
80 if (!(($a == "y") || ($a == "Y"))) then
81 echo Exiting with no changes made
82 exit
83 endif
84 endif
85 endif
86
87 echo ""
88 echo The next step is the last part of the script and will take some
89 echo time \(6 minutes on a Sparc 10\). Please hit RETURN when you
90 echo are ready to begin.
91 set a = $<
92
93 #foreach i (cr1 cr2 cr3 ct1 ct2 ct3 ct4 mr1 mr2 mr3 mr4 xray1 xray2 xray3)
94 foreach i (cr1 ct1 mr1 xray1)
95 echo Populating database for $ROOT/img/db/common/$i
96 dbfill $ROOT/img/db/common/db $ROOT/img/db/common/$i/*
97 end
98
99 #foreach i (nm1 nm2 nm3 us1 us2 us3)
100 foreach i (nm1 us1)
101 echo Populating database for $ROOT/img/db/common/$i
102 dbfill $ROOT/img/db/common/db $ROOT/img/db/common/$i/*
103 end