#!/bin/sh USAGE="Usage: make_writable 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_writable $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 PKGNAMEDIR="$ARCHIVE/$2" if [ ! -d "$PKGNAMEDIR" ]; then echo "$0: Not a directory: $PKGNAMEDIR" 1>&2 exit 104 fi PKGDIR="$ARCHIVE/$2/$3" if [ ! -d "$PKGDIR" ]; then echo "$0: Not a directory: $PKGDIR" 1>&2 exit 105 fi chmod ug+rwx "$PKGNAMEDIR" if [ "$?" != 0 ]; then echo "$0: Could not chmod: $PKGNAMEDIR" 1>&2 exit 106 fi # # Fix perms on files and directories # Directories are rwx # Files are rw # Do not do links # #find "$PKGDIR" ! -type l -a -type d -exec chmod a+rw {} \; #find "$PKGDIR" ! -type l -a -type f -exec chmod a+rw {} \; setfacl -R -m user::rwX,group::rwX,other::rwX "$PKGDIR" setfacl -R -m user:releasem:rwx "$PKGDIR"