downloads/sbmigrate-site
... ...
@@ -11,6 +11,26 @@ echo "SBGrid site migration script"
11 11
echo "----------------------------"
12 12
echo "Running pre-migration checks:"
13 13
14
+if [ $(uname) == "Darwin" ]; then
15
+ echo "Running on macOS."
16
+ if [ ! -e '/etc/synthetic.conf' ]; then
17
+ echo " No /etc/synthetic.conf file found."
18
+ echo " This file is required for macOS to create"
19
+ echo " the SBGrid /programs path. See "
20
+ echo " https://sbgrid.org/wiki/macos"
21
+ echo " for more information."
22
+ echo " "
23
+ echo " Cannot continue migration. Exiting."
24
+ exit 1
25
+ else
26
+ echo " - /etc/synthetic.conf config found."
27
+ fi
28
+elif [ $(uname) == "Linux" ]; then
29
+ echo "Running on Linux."
30
+else
31
+ echo "Unknown OS."
32
+fi
33
+
14 34
touch "/programs/share/site_migrate_check" 2>/dev/null
15 35
if [ $? != 0 ]; then
16 36
echo " This user cannot write to /programs/share."
... ...
@@ -50,7 +70,7 @@ fi
50 70
51 71
echo "All required installation files found."
52 72
echo "---------------------------------"
53
-echo
73
+echo
54 74
55 75
if [ $1 ]; then
56 76
install_sitename=$1
... ...
@@ -60,14 +80,14 @@ else
60 80
echo "confirm your settings before the migration happens."
61 81
echo "You may need to confirm site name by email if your"
62 82
echo "advisor is not listed below. Email accounts@sbgrid.org."
63
- echo
83
+ echo
64 84
echo "The migration process will not impact running jobs or"
65 85
echo "prevent software from functioning normally."
66 86
echo "Exit at any time with a CTRL-c."
67 87
echo
68 88
69 89
unset install_sitename
70
-
90
+
71 91
echo "Please select your site from this list by number:"
72 92
echo " PI (site name)"
73 93
echo "1) Dessen (dessen_a_514i)"
... ...
@@ -80,29 +100,29 @@ else
80 100
echo "---------------------------------"
81 101
read labvar
82 102
83
- case $labvar in
84
- 1)
85
- install_sitename="dessen_a_514i"
86
- ;;
87
- 2)
88
- install_sitename="nicolet_y_359i"
89
- ;;
90
- 3)
91
- install_sitename="nury_h_512i"
92
- ;;
93
- 4)
94
- install_sitename="petosa_c_148i"
95
- ;;
96
- 5)
97
- install_sitename="schoehn_g_408i"
98
- ;;
99
- 6)
100
- install_sitename="weik_m_513i"
101
- ;;
102
- *)
103
- echo "Enter the SBGrid site name:"
104
- read install_sitename
105
- ;;
103
+ case $labvar in
104
+ 1)
105
+ install_sitename="dessen_a_514i"
106
+ ;;
107
+ 2)
108
+ install_sitename="nicolet_y_359i"
109
+ ;;
110
+ 3)
111
+ install_sitename="nury_h_512i"
112
+ ;;
113
+ 4)
114
+ install_sitename="petosa_c_148i"
115
+ ;;
116
+ 5)
117
+ install_sitename="schoehn_g_408i"
118
+ ;;
119
+ 6)
120
+ install_sitename="weik_m_513i"
121
+ ;;
122
+ *)
123
+ echo "Enter the SBGrid site name:"
124
+ read install_sitename
125
+ ;;
106 126
esac
107 127
fi
108 128
... ...
@@ -112,7 +132,7 @@ echo " $install_sitename"
112 132
echo " "
113 133
114 134
read confirmation
115
-if [ $confirmation == "Y" ] || [ $confirmation == "y" ] ; then
135
+if [ $confirmation == "Y" ] || [ $confirmation == "y" ]; then
116 136
echo "Great. Migrating this installation."
117 137
echo " "
118 138
else
... ...
@@ -137,8 +157,8 @@ else
137 157
echo "Will not overwrite $BACKUPCONFIG"
138 158
fi
139 159
140
-# do
141
-cat $INSTALLERCONFIG > $TMPCONFIG
160
+# do
161
+cat $INSTALLERCONFIG >$TMPCONFIG
142 162
143 163
head -n 1 $TMPCONFIG >${INSTALLERCONFIG}
144 164
echo "site = $install_sitename" >>${INSTALLERCONFIG}
... ...
@@ -171,10 +191,9 @@ else
171 191
exit 1
172 192
fi
173 193
174
-#check results
175
-if [ $(uname) == "Darwin" ] ; then
194
+if [ $(uname) == "Darwin" ]; then
176 195
sbgridcmd="/programs/i386-mac/sbgrid_installer/latest/sbgrid-cli info sbgrid-installer"
177
-elif [ $(uname) == "Linux" ] ; then
196
+elif [ $(uname) == "Linux" ]; then
178 197
sbgridcmd="/programs/i386-mac/sbgrid_installer/latest/sbgrid-cli info sbgrid-installer"
179 198
else
180 199
echo "unknown OS. No validation run."
... ...
@@ -186,7 +205,7 @@ sbgrid_exit=$?
186 205
187 206
echo " "
188 207
echo "------------------------------"
189
-if [ $sbgrid_exit == 0 ] ; then
208
+if [ $sbgrid_exit == 0 ]; then
190 209
echo " "
191 210
echo " "
192 211
echo "Test appears to have succeeded!"