Update zip file/clean up skip with skip information

This commit is contained in:
Clemens Schwaighofer
2024-09-04 13:43:24 +09:00
parent 0bd40cdd73
commit 5659cc010f

View File

@@ -422,9 +422,13 @@ if [ ${INFO} -eq 1 ]; then
exit; exit;
fi; fi;
# check if there are any files in the SSH_KEYGEN_FOLDER, else skip zip file creation and file move # check if there are any files in the SSH_KEYGEN_FOLDER, else skip zip file creation and file move
has_pem_files=0;
if (shopt -s nullglob dotglob; f=("${SSH_KEYGEN_FOLDER}"*".pem"*); ((${#f[@]}))); then if (shopt -s nullglob dotglob; f=("${SSH_KEYGEN_FOLDER}"*".pem"*); ((${#f[@]}))); then
# zip everything and remove data in ssh key folder, delete output file with passwords has_pem_files=1;
if [ ${TEST} -eq 0 ]; then fi;
# zip everything and remove data in ssh key folder, delete output file with passwords
if [ ${TEST} -eq 0 ]; then
if [ "${has_pem_files}" -eq 1 ]; then
zip -r \ zip -r \
"${ROOT_FOLDER}${output_zip_folder}${output_zip}" \ "${ROOT_FOLDER}${output_zip_folder}${output_zip}" \
"${input_file}" \ "${input_file}" \
@@ -432,26 +436,32 @@ if (shopt -s nullglob dotglob; f=("${SSH_KEYGEN_FOLDER}"*".pem"*); ((${#f[@]})))
"${SSH_KEYGEN_FOLDER}" \ "${SSH_KEYGEN_FOLDER}" \
-x\*.gitignore; -x\*.gitignore;
else else
echo "zip -r \\" echo "- Skip ZIP file creation, no pem files";
echo "${ROOT_FOLDER}${output_zip_folder}${output_zip} \\"
echo "${input_file} \\"
echo "${output_file} \\"
echo "${SSH_KEYGEN_FOLDER} \\"
echo "-x\*.gitignore;"
fi; fi;
echo "Download: ${ROOT_FOLDER}${output_zip_folder}${output_zip}"; else
# cleam up user log file and ssh keys echo "zip -r \\"
if [ ${TEST} -eq 0 ]; then echo "${ROOT_FOLDER}${output_zip_folder}${output_zip} \\"
echo "${input_file} \\"
echo "${output_file} \\"
echo "${SSH_KEYGEN_FOLDER} \\"
echo "-x\*.gitignore;"
fi;
echo "Download: ${ROOT_FOLDER}${output_zip_folder}${output_zip}";
# cleam up user log file and ssh keys
if [ ${TEST} -eq 0 ]; then
if [ "${has_pem_files}" -eq 1 ]; then
# move pub to created folders # move pub to created folders
mv "${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}"*.pub "${ROOT_FOLDER}${SSH_KEYGEN_FOLDER_CREATED_PUB}"; mv "${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}"*.pub "${ROOT_FOLDER}${SSH_KEYGEN_FOLDER_CREATED_PUB}";
# delete the rest # delete the rest
rm "${ROOT_FOLDER}${output_file}"; rm "${ROOT_FOLDER}${output_file}";
rm "${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}"*; rm "${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}"*;
else else
echo "$> mv ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}*.pub ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER_CREATED_PUB};"; echo "- Skip pub file move and cleanup, no pem files";
echo "$> rm ${ROOT_FOLDER}${output_file}";
echo "$> rm ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}*";
fi; fi;
else
echo "$> mv ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}*.pub ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER_CREATED_PUB};";
echo "$> rm ${ROOT_FOLDER}${output_file}";
echo "$> rm ${ROOT_FOLDER}${SSH_KEYGEN_FOLDER}*";
fi; fi;
# __END__ # __END__