Home | History | Annotate | Download | only in scripts
      1 #!/bin/bash
      2 
      3 PWD=`pwd`
      4 WIKIDIR=../selinux.wiki
      5 
      6 if [ \! -d $WIKIDIR ]; then
      7     git clone git@github.com:SELinuxProject/selinux.wiki.git $WIKIDIR
      8 fi
      9 
     10 DEST=$WIKIDIR/files/releases/$(date '+%Y%m%d')
     11 DIRS="libsepol libselinux libsemanage checkpolicy secilc policycoreutils mcstrans restorecond semodule-utils"
     12 DIRS_NEED_PREFIX="dbus gui python sandbox"
     13 
     14 git tag -a $(date '+%Y%m%d') -m "Release $(date '+%Y%m%d')"
     15 
     16 rm -rf $DEST
     17 mkdir -p $DEST
     18 
     19 for i in $DIRS; do
     20 	cd $i
     21 	VERS=`cat VERSION`
     22 	ARCHIVE=$i-$VERS.tar.gz
     23 	git tag $i-$VERS > /dev/null 2>&1
     24 	git archive --format=tar --prefix=$i-$VERS/ $i-$VERS | gzip > ../$DEST/$ARCHIVE
     25 	cd ..
     26 done
     27 
     28 for i in $DIRS_NEED_PREFIX; do
     29 	cd $i
     30 	VERS=`cat VERSION`
     31 	ARCHIVE=selinux-$i-$VERS.tar.gz
     32 	git tag selinux-$i-$VERS > /dev/null 2>&1
     33 	git archive --format=tar --prefix=selinux-$i-$VERS/ selinux-$i-$VERS | gzip > ../$DEST/$ARCHIVE
     34 	cd ..
     35 done
     36 
     37 cd $DEST
     38 
     39 git add .
     40 
     41 echo "Add the following to the $WIKIDIR/Releases.md wiki page:"
     42 
     43 echo ""
     44 
     45 echo "## Release $(date '+%Y-%m-%d')"
     46 
     47 for i in *.tar.gz; do
     48 
     49 	echo -n "[$i](https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/$(date '+%Y%m%d')/$i) "
     50 	sha256sum $i | cut -d " " -f 1
     51 	echo ""
     52 done
     53 
     54 echo "And then run:"
     55 echo "  cd $WIKIDIR"
     56 echo "  git commit  -m \"Release $(date '+%Y%m%d')\" -a -s"
     57 echo "  git push"
     58 
     59 echo ""
     60 echo "Push the release and its tags to git via:"
     61 echo "  git push"
     62 echo "  git push --tags"
     63