Versioner sammenlignet

Nøgle

  • Linjen blev tilføjet.
  • Denne linje blev fjernet.
  • Formatering blev ændret.

...

Kodeblok
linenumberstrue
#!/bin/bash


source config.txt

IFS=$(echo -en "\n\b")
Database="Confluence"


# Arguments
Dir=$1
Space=$2
PageTitle=$3
MakeToc=$4
GrepFor=$5


# Check Arguments
if [ $# -lt 4 ] 
then
        	echo "There are not at least 4 Arguments: Dir Space PageTitle yes/no"
        	exit 0
fi
if [ Dir == "" ]
then
        	echo "Argument 1 is empty"
	exit 0
fi
if [ ! -d $ContentRoot/$Dir ]
then
	echo "Argument 1 Dir: $Dir does not exist"
	exit 0
fi
if [ ! -d /data/images/$Dir$LinksRoot ]
then
        echo "Argument 1 DirLinksRoot: $Dir$LinksRoot does not exist"
        exit 0
fi
if [ $MakeToc == "no" ]
then
        html=	echo "{make-top}" > /tmp/confluencewikimarkup.txt
else
        html=	echo "{toc} \n " > /tmp/confluencewikimarkup.txt
	echo "{make-top}" >> /tmp/confluencewikimarkup.txt
fi

cd $ContentRoot/data/images/"$Dir"
for file in `find . -type d | grep -v "thumbs" | grep -v "cache" | egrep -i "$GrepFor" | sort`
do
 
echo echo $file


        	NumOfPics=`ls -t "$file" | egrep -i "\.(jpg|gif|png|avi|flv|mov)$" | wc -l`
        	if [ $NumOfPics -gt 0 ]
        	then
	
                	file=$(echo "$file"|sed 's/\.\///g')
		if [ $file != "." ]
		then
			echo           html="$html \n h1. $file \n "h1. ${file}" >> /tmp/confluencewikimarkup.txt
			echo "{go-top}" \n "
                group=$file
                >> /tmp/confluencewikimarkup.txt
		fi

		group=$file


		for image in `ls "$file" | egrep -i "\.(jpg|gif|png)$"`
                do
                        		do


			file2=$(echo "$file"|sed 's/ /%20/g')
                        			if [ $file2 == "." ]
                        then

                                file2=""
                        else
                                file2="$file2/"
                        fi
                        html="$html 			then
				file2=""
			else
				md5=`openssl md5 $ContentRoot/$Dir/$file/$image`
				md5=`echo $md5  | rev | cut -d ' '  -f1 | rev`
				rm $LinksRoot/$md5
				ln -s $ContentRoot/$Dir/$file/$image $LinksRoot/$md5
			fi

			echo "{me-image:path=$Dir/$file2/|image=$image|group=$group|md5=$md5}"
                done
                >> /tmp/confluencewikimarkup.txt
		done


		for movie in `ls "$file" | egrep -i "\.(flv|avi|mov)$"` 
                do
                        	do


			file2=$(echo "$file"|sed 's/ /%20/g')
			md5=`openssl md5 $ContentRoot/$Dir/$file/$movie`
            md5=`echo $md5  | rev | cut -d ' ' html="$html {me-video:path=$Dir/$file2/|image=$movie}"
 -f1 | rev`
			rm $LinksRoot/$md5
            ln -s  done$ContentRoot/$Dir/$file/$movie $LinksRoot/$md5
                html="$html \n "	echo "{me-video:path=$Dir/$file2/|image=$movie}" >> /tmp/confluencewikimarkup.txt
        done
	fi
	
done
/opt/atlassian-cli/confluence.sh --action storePage --space "$Space" --title "$PageTitle" --content "$html"
file /tmp/confluencewikimarkup.txt

This is a sample output for the script - screenhot of a page:

...