forked from artefactual/archivematica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev-helper
executable file
·247 lines (229 loc) · 7.8 KB
/
dev-helper
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#!/bin/bash
# This file is part of Archivematica.
#
# Copyright 2010-2013 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Archivematica is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Archivematica. If not, see <http://www.gnu.org/licenses/>.
# @package Archivematica
# @author Joseph Perry <joseph@artefactual.com>
# @version svn: $Id$
cd `dirname $0`
fn_exists()
{
type $1 2>/dev/null | grep -q 'is a function'
}
colour () { "$@" 2>&1>&3|sed 's,.*,\x1B[31m&\x1B[0m,'>&2;} 3>&1
function git-pull() {
part="git pull"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
echo "Doing ${part} ..."
echo "Cleaning up..."
cd localDevSetup/
colour ./cleanup.sh
cd ..
currentBranch=`git status | grep '# On branch ' | awk '{print $4}'`
gitDiff=`git diff`
if [ -z "$gitDiff" -a "${gitDiff+xxx}" = "xxx" ]; then
echo "No changes to store."
else
echo "Storing changes (to be restored with 'git stash pop'), viewed with git-diff."
git stash
fi
colour git pull --rebase origin ${currentBranch}
if [ -z "$gitDiff" -a "${gitDiff+xxx}" = "xxx" ]; then
echo "No changes to restore"
else
echo "Restoring changes"
git stash pop
fi
echo "Integrating into environment..."
cd localDevSetup/
colour ./createLocalDevDirectories.sh
cd ..
else
echo "not going to ${part}"
fi
}
function package-update() {
part="update/install package requirements"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
echo "Going to ${part} ..."
cd localDevSetup/
colour sudo apt-get update
colour sudo ./installDependsFromDebianFile.py ./../src/archivematicaCommon/debian/control
#colour sudo ./installDependsFromDebianFile.py ./../src/createDublinCore/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/dashboard/debian/control
#./installDependsFromDebianFile.py ./../src/easy-extract/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/MCPClient/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/MCPrpcCLI/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/MCPServer/debian/control
colour #./installDependsFromDebianFile.py ./../src/metaPackage-forensic-tools/debian/control
colour #./installDependsFromDebianFile.py ./../src/metaPackage-shotgun/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/sanitizeNames/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/SIPCreationTools/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/transcoder/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/upload-qubit/debian/control
colour #./installDependsFromDebianFile.py ./../src/vm-includes/debian/control
colour sudo ./installDependsFromDebianFile.py ./../src/xubuntuGuiScriptsEditor/debian/control
sudo apt-get install python-pip -y
sudo pip install django==1.4.3
cd ..
else
echo "Not going to ${part}."
fi
}
function recreate-db() {
part="recreate the databases"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
echo "Going to ${part} ..."
cd localDevSetup/
sudo stop archivematica-mcp-server
sudo stop archivematica-mcp-client
sudo apache2ctl stop
colour ./recreateDB.sh
cd ..
sudo start archivematica-mcp-server
sudo start archivematica-mcp-client
sudo apachectl start
else
echo "Not going to ${part}."
fi
}
function FPRClient() {
part="Include FPRClient pull"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
./src/archivematicaCommon/lib/utilities/FPRClient/main.py
#./src/FPRClient/lib/main.py
else
echo "Not going to ${part}."
fi
}
function restart() {
part="restart archivematica services"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
echo "Going to ${part} ..."
sudo stop archivematica-mcp-server
sudo stop archivematica-mcp-client
sudo /etc/init.d/gearman-job-server stop
sudo /etc/init.d/elasticsearch stop
sleep 1
if [ -e "/tmp/archivematicaMCPServerPID" ]
then
sudo kill -9 `cat /tmp/archivematicaMCPServerPID`
fi
sleep 3
sudo /etc/init.d/elasticsearch start
sudo /etc/init.d/gearman-job-server start
sudo rm /tmp/archivematicaMCP*
colour sudo start archivematica-mcp-server
colour sudo start archivematica-mcp-client
colour sudo apache2ctl restart
else
echo "Not going to ${part}."
fi
}
function update-sampledata() {
part="update sample data in $HOME"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
cd ~/archivematica-sampledata
currentBranch=`git status | grep '# On branch ' | awk '{print $4}'`
colour git pull origin ${currentBranch}
cd `dirname $0`
else
echo "Not going to ${part}."
fi
}
function export-sampledata() {
part="export sample data from $HOME"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
cd ~/archivematica-sampledata
DATE=`date +%Y-%m-%d-%H-%M-%S`
echo exporting to "~/archivematica-sampledata-$DATE"
mkdir ~/archivematica-sampledata-$DATE
git archive master | tar -x -C ~/archivematica-sampledata-$DATE
cd `dirname $0`
else
echo "Not going to ${part}."
fi
}
function install-gui() {
part="re-create gui-scripts editor file"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
rm /home/$USER/.config/Thunar/uca.xml
tmp="`pwd`"
cd src/xubuntuGuiScriptsEditor/share
colour ./addArchivematicaGUIScripts.sh
cd "$tmp"
else
echo "Not going to ${part}."
fi
}
function update-atom() {
part="update AtoM and restart its atom-worker service"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
cd atom-git
sudo -u www-data git fetch origin
sudo -u www-data git reset --hard origin/stable/1.3.x
sudo -u www-data sed -i "s/'qbAclPlugin',/ 'qbAclPlugin',\n'qtSwordPlugin',/g" config/ProjectConfiguration.class.php
sudo -u www-data rm -rf cache/*
sudo -u www-data php symfony cc
cd -
colour sudo stop atom-worker
colour sudo start atom-worker
else
echo "Not going to ${part}."
fi
}
function example() {
part="example"
echo -n "\"Would you like to ${part}?\" (y/N) "
read a
if [[ $a == "Y" || $a == "y" ]]; then
echo "Going to ${part} ..."
else
echo "Not going to ${part}"
fi
}
# Run only one function if given
if [ ! -z ${1} ]; then
${1}
exit
fi
git-pull
package-update
recreate-db
FPRClient
restart
update-sampledata
export-sampledata
install-gui
update-atom