.
Aurium.Colivre.Coop.br Esse site é Legal Demais para Internet Explorer

Aurium :: ScriptShellPackTWikiPlugin

Últimas blogadas:

%HEADLINES{"http://softwarelivre.org/aurium/blog/feed" refresh="600" header="SoftwareLivre.org" limit="15" format=" * $title" }% %HEADLINES{"http://cirandas.net/aurium/blog/feed" refresh="600" header="Cirandas.net" limit="15" format=" * $title" }%



Script Shell packTWikiPlugin

You must to give a file as parameter to this script. The file must have the name of the plugin on the first line and the files on the other lines. You can use special chars like "*" to help.

Example:
$ ./packTWikiPlugin files_to_pack_FlowchartPlugin.txt

Were the file "files_to_pack_FlowchartPlugin.txt" have this content:
FlowchartPlugin
lib/TWiki/Plugins/FlowchartPlugin.pm
data/TWiki/FlowchartPlugin*
pub/TWiki/FlowchartPluginExample/*

The Script

#!/bin/sh
# This script helps to create TWiki plugin packages
# 2005 - by Aurelio A. Heckert
# Licenced under the GNU-GPL

# Config: # # # # # # # # # # # # # # # # # # # # # #
# Put your local path for this twiki directories:
   libDir='/var/lib/twiki/lib/'
   dataDir='/var/lib/twiki/data/'
   pubDir='/var/www/twiki/pub/'
# # # # # # # # # # # # # # # # # # # # # # # # # # #

if [ "$1" = "" ]; then
  echo "
  You must to give a file as parameter to this script. The file must
  have the name of the plugin on the first line and the files on the
  other lines. You can use special chars like \"*\" to help.
  Example:
  $ $0 files_to_pack_FlowchartPlugin.txt
  Were the file \"files_to_pack_FlowchartPlugin.txt\" have this content:
 - - - - - - - - - - - - - - - - - - - - - - - - -
  FlowchartPlugin
  lib/TWiki/Plugins/FlowchartPlugin.pm
  data/TWiki/FlowchartPlugin*
  pub/TWiki/FlowchartPluginExample/*
 - - - - - - - - - - - - - - - - - - - - - - - - -
"
  exit
fi

echo "Starting the TWiki Plugin Packager"

myDir="`pwd`"
tmpDir='/tmp/TWikiPluginPack/'
dirsToCreate='/tmp/TWikiPluginPackDirs.txt'
mkdir "$tmpDir"

while read line; do
  if [ "$pluginName" = "" ]; then
    pluginName=$line
    echo -e "Creating package for $pluginName\n"
    cd "$tmpDir"
  else
    # cut off the last iten (the file), and separate in lines:
    echo "$line" | sed -e 's/\(.*\)\/[^/]*$/\1/' | sed -e 's/\//\n/g' > $dirsToCreate
    dirPathToCreate="$tmpDir"
    while read dirToCreate; do
      dirPathToCreate="$dirPathToCreate/$dirToCreate"
      mkdir "$dirPathToCreate"
    done < "$dirsToCreate"
    area="`echo "$line" | cut -f1 -d/`"
    pathToCopy="`echo "$line" | cut -f2- -d/`"
    [ "$area" = "lib"  ]  &&  cp $libDir/$pathToCopy  "$dirPathToCreate"
    [ "$area" = "data" ]  &&  cp $dataDir/$pathToCopy "$dirPathToCreate"
    [ "$area" = "pub"  ]  &&  cp $pubDir/$pathToCopy  "$dirPathToCreate"
  fi
done < "$1"

zip -r "$pluginName.zip" *

cp "$pluginName.zip" "$myDir"
cd "$myDir"
rm -rf "$tmpDir" "$dirsToCreate"
echo -e "\nThe package \"$pluginName.zip\" was saved in this directory"

DiggThis

Copyright © 2004 - 2019 Aurélio A. Heckert
Conteúdo licenciado sob Creative Commons by-nc-sa