design_update
1.2 KB
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
#!/bin/bash
# This script updates the packet of noosfero-spb
# It's should be used just on dev environment
# Main dir
SPB_DIR=$HOME/softwarepublico/src
TAR_DIR=$SPB_DIR/noosfero-spb
PKG_DIR=$SPB_DIR/pkg-rpm
CONFIG_FILES=/usr/share
# Package dir
RPMBUILD_DIR=$HOME/rpmbuild
SOURCE_DIR=$RPMBUILD_DIR/SOURCES
SPEC_DIR=$RPMBUILD_DIR/SPECS
RPM_DIR=$RPMBUILD_DIR/RPMS
# Config files
LAST_HASH=$CONFIG_FILES/hash_commit
function buildinstall {
# Prepare the env
rm $RPMBUILD_DIR -rf
rpmdev-setuptree
# Create tarball
pushd $TAR_DIR
make dist
popd
mv $TAR_DIR/*.tar.gz $SOURCE_DIR/
cp $PKG_DIR/noosfero-spb/noosfero-spb.spec $SPEC_DIR/
# Build RPM
pushd $SPEC_DIR
rpmbuild -ba noosfero-spb.spec
popd
# Install package
pushd $RPM_DIR
sudo yum install $RPM_DIR/noarch/noosfero-spb-*
popd
}
# Clonning and updating repo
git config http.sslVerify "false"
git clone -b design_validation http://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico.git ~/softwarepublico
pushd $SPB_DIR
git pull
GIT_CURR_HASH=$(git log --pretty=format:'%h' -n 1)
GIT_LAST_HASH=$(cat $LAST_HASH)
if [ $GIT_CURR_HASH != $GIT_LAST_HASH ]
then
echo $GIT_LAST_HASH > $LAST_HASH
buildinstall
fi
popd