#!/bin/bash err() { echo "${1}" zenity --error --no-wrap --text "${1}" } warn() { echo "${1}" zenity --warning --no-wrap --text "${1}" } if ! command -v unzip &> /dev/null then err "'unzip' could not be found" exit 1 fi if [ ${#@} -eq 0 ]; then # no arguments IFS=$'\n' files=($(zenity --file-selection --multiple --separator=$'\n' --title="Choose files")) else # arguments echo "" fi for i in "${files[@]}"; do if ! unzip -l "${i}"|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}" done output="Done." output_temp="" for i in "${files[@]}"; do fname="$(basename ${i%.*})" folder="content/posts/${fname}" if ! [ -e "${folder}/banner*" ]; then output_temp="${output_temp}banner missing\n " fi done warn "${output_temp}"