修改svn库中 hooks/pre-commit
##控制上传文件大小
#!/bin/sh
REPOS="$1"
TXN="$2"
RES="OK"
SVNLOOK=/usr/bin/svnlook
MAX_SIZE=51200000
files=$($SVNLOOK changed -t $TXN $REPOS|cut -c5-)
for f in $files
do
filesize=$($SVNLOOK cat -t $TXN $REPOS $f | wc -c)
if [ $filesize -gt $MAX_SIZE ] ; then
#export LANG=zh_CN.GBK
export LANG=en_US.UTF-8
echo "New File $f Is Too Large(Must<=50MB)" >&2
exit 1
fi
##限制中文文件名
######################
FILE=$SVNLOOK changed -t $TXN $REPOS
#echo "$SVNLOOK changed -t "$TXN" "$REPOS"| cut -c5-
" > /tmp/svn.log
var=echo $FILE|awk '{print $2}'|awk -F/ '{print $1}'
case $var in
dev)
$SVNLOOK changed -t "$TXN" "$REPOS" |cut -c5-| grep "[?\\ -]" >> /dev/null
if [ $? -eq 0 ]; then
echo "**dev****Chinese filename are not allow!******" >&2
exit 1;
fi
;;
export)
$SVNLOOK changed -t "$TXN" "$REPOS" |cut -c5-| grep "[?\\ -]" >> /dev/null
# $SVNLOOK changed -t "$TXN" "$REPOS" | awk '{print $2}' | grep "[^0-9A-Za-z+.()_-/$]" > /dev/null
if [ $? -eq 0 ]; then
echo "**export****Chinese filename are not allow!******" >&2
exit 1;
fi
;;
*)
# var2=echo $FILE|awk '{print $2}'|awk -F/ '{print $4}'
# case $var2 in
# export)
# $SVNLOOK changed -t "$TXN" "$REPOS"| awk '{print $2}' | grep "[^0-9A-Za-z._$/\\-]" > /dev/null
# if [ $? -eq 0 ]; then
# echo "***art/export***Chinese filename are not allow!******" >&2
# exit 1;
# fi
# ;;
# *)
# ;;
# esac
;;
esac
done
如果您喜欢本站,点击这儿可以捐赠本站
这些信息可能会帮助到你: 联系作者 | 报毒说明
修改版本软件,加群提示等均为修改者自留,非本站信息,注意鉴别
这些信息可能会帮助到你: 联系作者 | 报毒说明
修改版本软件,加群提示等均为修改者自留,非本站信息,注意鉴别
评论(0)