Commit 9e8ff2c9ad43525b1a555578449e7d9996deb8c3
1 parent
57d13a0e
Exists in
dev_env_minimal
Adding script to update noosfero-spb pkg > dev_env
Showing
1 changed file
with
55 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,55 @@ |
1 | +#!/bin/bash | |
2 | +# This script updates the packet of noosfero-spb | |
3 | +# It's should be used just on dev environment | |
4 | + | |
5 | +# Main dir | |
6 | +SPB_DIR=$HOME/softwarepublico/src | |
7 | +TAR_DIR=$SPB_DIR/noosfero-spb | |
8 | +PKG_DIR=$SPB_DIR/pkg-rpm | |
9 | +CONFIG_FILES=/usr/share | |
10 | + | |
11 | +# Package dir | |
12 | +RPMBUILD_DIR=$HOME/rpmbuild | |
13 | +SOURCE_DIR=$RPMBUILD_DIR/SOURCES | |
14 | +SPEC_DIR=$RPMBUILD_DIR/SPECS | |
15 | +RPM_DIR=$RPMBUILD_DIR/RPMS | |
16 | + | |
17 | +# Config files | |
18 | +LAST_HASH=$CONFIG_FILES/hash_commit | |
19 | + | |
20 | +function buildinstall { | |
21 | + # Prepare the env | |
22 | + rm $RPMBUILD_DIR -rf | |
23 | + rpmdev-setuptree | |
24 | + | |
25 | + # Create tarball | |
26 | + pushd $TAR_DIR | |
27 | + make dist | |
28 | + popd | |
29 | + mv $TAR_DIR/*.tar.gz $SOURCE_DIR/ | |
30 | + cp $PKG_DIR/noosfero-spb/noosfero-spb.spec $SPEC_DIR/ | |
31 | + | |
32 | + # Build RPM | |
33 | + pushd $SPEC_DIR | |
34 | + rpmbuild -ba noosfero-spb.spec | |
35 | + popd | |
36 | + | |
37 | + # Install package | |
38 | + pushd $RPM_DIR | |
39 | + sudo yum install $RPM_DIR/noarch/noosfero-spb-* | |
40 | + popd | |
41 | +} | |
42 | + | |
43 | +# Clonning and updating repo | |
44 | +git config http.sslVerify "false" | |
45 | +git clone -b design_validation http://softwarepublico.gov.br/gitlab/softwarepublico/softwarepublico.git ~/softwarepublico | |
46 | +pushd $SPB_DIR | |
47 | + git pull | |
48 | + GIT_CURR_HASH=$(git log --pretty=format:'%h' -n 1) | |
49 | + GIT_LAST_HASH=$(cat $LAST_HASH) | |
50 | + if [ $GIT_CURR_HASH != $GIT_LAST_HASH ] | |
51 | + then | |
52 | + echo $GIT_LAST_HASH > $LAST_HASH | |
53 | + buildinstall | |
54 | + fi | |
55 | +popd | ... | ... |