#!/bin/sh -uex # Based on byhand-tags # Tarball to unpack TBALL="${1:?"Usage: ${0} "}" # Check the # Where to move the Translation files (FIXME) DESTDIR=/srv/ftp.debian.org/ # Check the structure of the tarball FILES=$(tar tzf "${TBALL}") for f in ${FILES}; do if [ "D${f}" = "Dmain/" -o "D${f}" = "Dmain/i18n/" ]; then continue; fi # Check top level directory D1=$(echo ${f} |cut -d'/' -f1); if [ "D${D1}" != "Dmain" ]; then echo "Wrong top directory, should be ./main/ (${f})" exit 1 fi D2=$(echo ${f} |cut -d'/' -f2); if [ "D${D2}" != "Di18n" ]; then echo "Wrong directory structure, should be ./main/i18n/ (${f})" exit 1 fi FN=$(echo ${f} |cut -d'/' -f3); # FN should be Translation-xx_YY, so we will split it to check if the # name are correctly FNT=$(echo ${FN} |cut -d'-' -f1); FNL=$(echo ${FN} |cut -d'-' -f2); # Check if it is called 'Translation' if [ "D${FNT}" != "DTranslation" ]; then echo "Wrong filename, it should be Translation-xx_YY (${FN})" exit 1 fi # Check if it is called 'Translation' LANGRE='^[a-z]{2,3}(_[A-Z]{2})?$' echo ${FNL} |grep -E "${LANGRE}" > /dev/null # 0: It works # 1: It fails if [ $? -eq 1 ]; then echo "Wrong language name, it should be xx_YY (${FN})" exit 1 fi done umask 002 TEMPDIR=$(mktemp -d -p ./ ddtp.XXXXXXXX); cleanup() { rm -rf "${TEMPDIR}" } trap cleanup EXIT tar xzf "${TBALL}" -C "${TEMPDIR}" ZFILES=$(find ${TEMPDIR} -size 0) if [ ! -z "${ZFILES}" ]; then echo "Ooops, files with zero bytes not allowed!" echo "${ZFILES}" exit 1 fi trap - EXIT exit 0