#!/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