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")


# 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 [ ! -d $ContentRoot$MediaRoot ]
then
        echo "ContentRootMediaRoot in config.txt: $ContentRoot$MediaRoot does not exist"
        exit 0
fi


if [ $Dir == "" ]
then
	echo "Argument 1 is empty"
	exit 0
fi


if [ ! -d $ContentRoot$MediaRoot/$Dir ]
then
	echo "Argument 1 Dir: $Dir does not exist under $ContentRoot$MediaRoot"
	exit 0
fi


if [ ! -d $CLIHome ]
then
        echo "CLIHome  in config.txt: $CLIHome does not exist"
        exit 0
fi


if [ $MakeToc == "no" ]
then
	echo "{make-top}" > $WikiFile
else
	echo "{tocmake-top}" > $WikiFile
	echo "{make-toptoc}" >> $WikiFile
fi


# Create Thumbnails for images and video
if [ ! -e makeThumbs.sh ]
then
        echo "makeThumbs.sh script not found here"
        exit 0
fi


./makeThumbs.sh $ThumbSize $ContentRoot$MediaRoot/"$Dir"
./makeThumbs.sh $DisplaySize $ContentRoot$MediaRoot/"$Dir"


cd $ContentRoot$MediaRoot/"$Dir"


for file in `find . -type d | grep -v "thumbs" | grep -v "cache" | egrep -i "$GrepFor" | sort`
do
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 "h1. ${file}" >> $WikiFile
			echo "{go-top}" >> $WikiFile
		fi
		group=$file
		for image in `ls "$file" | egrep -i "\.(jpg|gif|png)$"`
		do
			file2=$(echo "$file"|sed 's/ /%20/g')
			if [ $file2 == "." ]
			then
				file2=""
			fi

			echo "{me-image:path=$Dir/$file2/|image=$image|group=$group}" >> $WikiFile
		done

		for movie in `ls "$file" | egrep -i "\.(flv|avi|mov)$"` 
        	do
			  file2=$(echo "$file"|sed 's/ /%20/g')
               	 	echo "{me-video:path=$Dir/$file2/|image=$movie}" >> $WikiFile
                done
	fi
	
done

$CLIHome/confluence.sh --action storePage --space "$Space" --title "$PageTitle" --file $WikiFile

...