####################################################################### # Auto Generate HTML Page for htpp://aor8200.narod.ru # Author: Petrov Roman, maycom#mail.ru # Create date: 17/09/09 # Modification: 19/03/2010 alt="" # Modification 06.10.2010 Reading meta tegs from a root directory ####################################################################### #!/bin/bash date=$(date +%Y) ehdir="/" #end directry hdir="aor8200" #home directory txt="meta" #keywords and descriptions from meta tegs nt=4 #cols in table def=90 #default quallity grafic files dsize="800x600" #size pictures width="900" #width page ###################################################################### cdir=`pwd` #current path from directory b=`basename $cdir` lv=0 #echo "-$lv- $cdir Current directory" while [ "$b" != "$hdir" ] do if [ "$ehdir" != "$b" ] #limit search then let "lv+=1" d=$(dirname $cdir) # path b=$(basename $d) #name cdir=$d #echo "-$lv- $b #path from Home directory" else echo "-- Error Directory !!! --"; exit 0 fi done case "$lv" in "1") way="..";; "2") way="../..";; "3") way="../../..";; "4") way="../../../..";; esac #echo "Way: $way" ################################################################### # Default variable ################################################################### b=$(basename `pwd`) title=$b #Default Title keywords=$b #Default Keywords dname=$b #################################################################### echo -n "Enter width page (Default: $width): " ; read; if [ "$REPLY" ] then width=$REPLY; echo "Enter width page: $width" else echo "Default widh page: $width" fi echo -n "Enter Name File (Default $dname): "; read; if [ "$REPLY" ] then html=$REPLY; if [ "$html" ] then cp -v $html old-$html else touch $html echo "Create File Name: " $html; fi else html=$dname.html # Default name HTML file # if [ -f "$html" ] then cp -v $html old-$html cat /dev/null > $html else touch $html echo "--Default Create File Name: " $html; fi fi ###################################################################### b=$title echo -n "Enter Title (Default Title: $title): "; read title; if [ "$title" ] # Param: $title OK then echo "Enter Title: $title" else echo "--Default Title: $b" title=$b fi ####################################################################### echo -n "Enter Author (Default Petrov Roman): "; read author; if [ $author ] then echo " Author: " $author; else author="Petrov Roman"; # Default name author # echo "--Default Enter Author: " $author; fi ########################################################################## echo -n "Enter Description: "; read if [ "$REPLY" ] then description=$REPLY echo Enter Description: $REPLY else ############################################### if [ -f "$way/$txt" ] # then description=$(cat $way/$txt) # read file metatag echo "Enter Description: $description" else echo " Error Not Description!!!" description=$b #b=($basename `pwd`) fi ############################################### fi ####################################################################### echo -n "Enter Keywords:"; read ; if [ "$REPLY" ] then keywords=$REPLY echo "Enter Keywords $REPLY" else if [ -f "$way/$txt" ] then keywords=$(cat $way/$txt) echo "--Default Enter Keywords: $keywords" else echo "Erorr. No keywords!!!" keywords=$b # b=$(basename `pwd`) fi fi #echo "Title: $title " echo " Keywords: $keywords" #echo " Author: $author" ######################################################################## ## Search graficfiles ## ####################################################################### ####################################################################### #Search grafic Files #Rename Grafic Files ######################################################################### if [ -d "pic" ] then files=$(ls pic/*.[bJjgtrp][mPpian][pGgfw]) # search grafic files printf "$files \n" else files=$(ls * | grep [bJjgtrp][mPpian][pGgfw]) # search grafic files printf "$files OK \n" fi if [ "$files" ] then echo -n "Enter Name Grafics File (Default Name: $title): "; read ; if [ $REPLY ] then name=$REPLY echo " File Grafic Name: " $name; else name="$title" # Default name file # echo " --Default Name Grafic File: " $title; fi ######################################################################## echo -n "Enter Format Grafic File (jpg, gif, tif Default: jpg): "; read format; if [ "$format" ] then echo " Format Grafic File: " $format; else format=jpg; # Default format file # echo "--Default Format Grafic File: " $format; fi #################################################################### echo -n "Enter Quallity:10-100 (Default: $def):" read if [ "$REPLY" ] then qlt=$REPLY; echo "Enter quallity: $qlt" else qlt=$def; echo "Default Quallity: $qlt" fi echo -n "Enter Size Pictures: 600x400 (Default size: $dsize): " read if [ "$REPLY" ] then size=$REPLY; echo "Enter size: $size" else echo "default size; $dsize" size=$dsize # default size pictures fi ############################################################################# # Rotate Files in directories "left" and "right" ############################################################################## if [ -d "left" ] # Proverka ir "left" an "" then ff=0 ls=$(ls left/*.$format) for lf in $ls do let "ff+=1" echo "--$ff-- Rotate -90 $lf -> $ff-left.$format OK" convert -rotate -90 $lf $ff-left.$format rm -r left done elif [ -d "right" ] then ff=0 ls=$(ls right/*.$format) for lf in $ls do let "ff+=1" echo "--$ff-- Rotate +90 $lf -> $ff-right.$format OK" convert -rotate +90 $lf $ff-right.$format done rm -r right fi if [ -d "pic" ] then mv *.$format pic/ ls pic > tmp nn=$(sort -n tmp) #echo " Files in pic:" # out file #printf "$nn \n" else mkdir pic; # echo "Create directory: pic" mv *.$format pic/ ls pic > tmp nn=$(sort -n tmp) #echo " Files in pic:" # out file #printf "$nn \n" fi ################################################################# ## Removal of files from a directory "tn" ################################################################### if [ -d "tn" ] then file=$(ls tn | grep $format ) for dd in $file do rm -v tn/$dd done else mkdir tn fi ############################################################### # Convertation ############################################################### a=0 at=0 table="ttmp" touch $table #temporary directory for "table" echo "" > $table for b in $nn do let "a+=1" let "at+=1" echo "-$a- pic/$b -> pic/$a-$name.$format <-> tn/$b -> tn/$a-$name.$format OK" convert -resize $size -quality $qlt pic/$b pic/$a-$name.$format echo "" > $table convert -thumbnail 150x100 -quality $qlt pic/$b tn/$a-$name.$format if [ "$at" == "$nt" ] then at=0 echo "" > $table fi ################################################### tvar="$a-$name.$format" if [ "$tvar" != "$b" ] then rm pic/$b fi ################################################## done echo "
\"$a-$name\"
" > $table rm -v tmp ########################################################################################## else echo "Not Grafic Files!!!" fi echo " $title
AOR8200
Your text.
   Главная   
   Схемы   
   Download   
   Shell   
   Linux   
   Гостевая   
   Контакты   
Them 1

  • text
  • text
  • text
  • text
Them 2

  • text
  • text
  • text
  • text
Them

  • text
  • text
  • text
  • text
" > $html title=`cat $table` echo "$title
Последние обновления, `date +%Y`

  Наверх    
" > $html rm -v $table #rm -v shablo* chmod 755 $html