From 6c3bcb9808dd81ec7cd4ca531e70cfa86495260b Mon Sep 17 00:00:00 2001 From: teldra Date: Sun, 26 Jun 2022 18:53:44 +0200 Subject: [PATCH] small fixes --- add_archive.sh | 26 ++++++++++++++++++-------- push.sh | 12 +----------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/add_archive.sh b/add_archive.sh index 8d5a48a..3cbdc0e 100755 --- a/add_archive.sh +++ b/add_archive.sh @@ -26,28 +26,38 @@ else echo "" fi -for i in "${files[@]}"; do - if ! unzip -l "${i}"|grep -q "index.de.md"; then +for file in "${files[@]}"; do + fname="$(basename ${file%.*})" + folder="content/posts/${fname}" + if ! unzip -l "${file}"|grep -q "index.de.md"; then err "maybe wrong archive, this is not compatible" exit 1 fi - fname="$(basename ${i%.*})" if ! [ -d content ]; then err "folder 'content' not found" exit 1 fi set -x - mkdir -p "content/posts/${fname}/" - unzip -d "content/posts/${fname}/" "${i}" + mkdir -p "${folder}" + unzip -d "${folder}" "${file}" + git add "${folder}" + git commit -m "{$fname}" done + output="Done." output_temp="" -for i in "${files[@]}"; do - fname="$(basename ${i%.*})" +for file in "${files[@]}"; do + banner="false" + fname="$(basename ${file%.*})" folder="content/posts/${fname}" - if ! [ -e "${folder}/banner*" ]; then + for f in $(find "${folder}" -type f); do + if echo ${i}|grep -q "banner"; then + banner="true" + fi + done + if [ ${banner} == "false" ]; then output_temp="${output_temp}banner missing\n " fi done diff --git a/push.sh b/push.sh index 283ec2d..de8a58f 100755 --- a/push.sh +++ b/push.sh @@ -1,18 +1,8 @@ #!/bin/bash date="$(date +%Y-%m-%d)-test" -if ! git switch "${date}"; then - git switch -c "${date}" -fi - -changedfiles=$(git diff --name-status|awk '{print $2}') - -set -x -git add . && \ -git commit -m "${date}: ${changedfiles}" && \ git pull --rebase upstream main && \ -git push --set-upstream origin origin/"${date}" && \ -git switch main +git push --set-upstream origin origin/main && \ exit git add content/posts