Subversion Repositories DevTools

Rev

Rev 6564 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#!/bin/sh
#set -x

USAGE="Usage: make_readonly archive pkgname pkgversion"
case "$1" in
  -h*|--h*)     echo "$USAGE"; exit 0 ;;
esac
if [ $# != 3 ]; then
  echo "$USAGE" 1>&2
  exit 100
fi

# Log operations
LOGDIR=/home/releasem/logs
LOGFILE=`date +release.%Y.%m.%d.log`
mkdir -p $LOGDIR
echo `date` " make_readonly $1 $2 $3" >> $LOGDIR/$LOGFILE


case "$1" in
  dpkg_archive)         ARCHIVE="/export/devl/dpkg_archive" ;;
  deploy_archive)       ARCHIVE="/export/devl/deploy_archive" ;;
  releases)             ARCHIVE="/export/devl/releases" ;;
  *)                    echo "$0: Invalid archive: $1" 1>&2
                        exit 101
                        ;;
esac

if [ "`echo $2 | sed 's/[A-Za-z][-_A-Za-z0-9]*/x/'`" != "x" ]; then
  echo "$0: Invalid package name: $2" 1>&2
  exit 102
fi
if [ "`echo $3 | sed 's/[A-Za-z0-9][-_.A-Za-z0-9]*/x/'`" != "x" ]; then
  echo "$0: Invalid package version: $3" 1>&2
  exit 103
fi

PKGDIR="$ARCHIVE/$2/$3"
if [ ! -d "$PKGDIR" ]; then
  echo "$0: Not a directory: $PKGDIR" 1>&2
  exit 105
fi

#
#   Package Post Install Process for known packages
#   These packages are generally build system related
#
if [ "$2" = "core_devl" -o "$2" = "buildtool"  -o "$2" = "jats-installer" -o "$2" = "generate_release_notes" ] ; then
    if [ -f "$PKGDIR/PostInstall.sh" ]; then
      echo "PostInstall script found"
      ( cd "$PKGDIR"; chmod +x PostInstall.sh; ./PostInstall.sh "$archive" "$2" "$3" )
      echo "PostInstall script execution complete"
    fi
fi

#
# Fix owner and perms on files and directories
#   Do not do links
#   Remove write access
#   Set owner to root
#   Remove 'releasem' user placed to allow release note insertion
#
#find "$PKGDIR"  ! -type l -exec chmod a-w {} \; -exec chown root:ccperdev {} \;
#setfacl -R -m group::r-x "$PKGDIR"
#setfacl -R -x user:releasem "$PKGDIR"

find "$PKGDIR"  ! -type l -exec chown root:ccperdev {} \;
setfacl -R -x user:releasem "$PKGDIR"
setfacl -R -x user:buildadm "$PKGDIR"
setfacl -R -x user:pkgadm "$PKGDIR"
setfacl -R -x group:ccperdev "$PKGDIR"
setfacl -R -m user::r-X,group::r-X,other::r-X "$PKGDIR"