patch for very long file names

This commit is contained in:
Jorge Holgado 2022-07-22 18:56:02 +02:00
parent bb7349a0ad
commit b3d5ff40f4
Signed by: dodger
GPG Key ID: F6701F6CB4D1C826

View File

@ -130,7 +130,18 @@ generate_split_metadata()
SCHEMA="postgres" SCHEMA="postgres"
fi fi
OUTPUTDIR="${BACKUPDIR}/${DBNAME}/${SCHEMA// /_}/${TYPE// /_}" OUTPUTDIR="${BACKUPDIR}/${DBNAME}/${SCHEMA// /_}/${TYPE// /_}"
OUTPUTFILE="${OBJECT}.sql" # PATCH for very long file names
OUTPUTFILE="${OBJECT::240}"
OUTPUTFILE="${OUTPUTFILE// /_}"
if [[ -f ${OUTPUTDIR}/${OUTPUTFILE}.sql ]] ; then
for ((x=1; x<1000 ;x++)) ; do
if [[ ! -f ${OUTPUTDIR}/${OUTPUTFILE}_${x}.sql ]] ; then
OUTPUTFILE="${OUTPUTFILE}_${x}"
fi
done
fi
OUTPUTFILE="${OUTPUTFILE}.sql"
mkdir -p "${OUTPUTDIR}" mkdir -p "${OUTPUTDIR}"
echo -e "${OUTPUTDIR}/${OUTPUTFILE}" echo -e "${OUTPUTDIR}/${OUTPUTFILE}"
echo -e "${LINE}" > "${OUTPUTDIR}/${OUTPUTFILE}" echo -e "${LINE}" > "${OUTPUTDIR}/${OUTPUTFILE}"