<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Posteet: spirit</title> 
    <link>http://www.posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>Modifier les arguments d'une commande précédente et les réutiliser</title>
        <link>http://www.posteet.com/view/1345</link>
        <description>
        <![CDATA[<pre># :h Remove a trailing file name component, leaving only the head.
# :t Remove all leading file name components, leaving the tail.
# :r Remove a trailing suffix of the form .xxx, leaving the basename.
# :e Remove all but the trailing suffix.

ls /usr/local/share/doc/3dm/3DM_help.htm
cd !$:h           # Enleve le nom de fichier, récupère uniquement le répertoire du dernier argument de la commande précédente
cat !-2$:t       # Ne garde que le nom de fichier du dernier argument de l'avant dernière commande (2eme de la fin)</pre> <a href="http://www.posteet.com/tags/arguments">[arguments]</a>  <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/cd">[cd]</a>  <a href="http://www.posteet.com/tags/commande">[commande]</a>  <a href="http://www.posteet.com/tags/directory">[directory]</a>  <a href="http://www.posteet.com/tags/filename">[filename]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Thu, 30 Oct 2008 15:50:33 +0000</pubDate>

            <category>arguments</category>
            <category>bash</category>
            <category>cd</category>
            <category>commande</category>
            <category>directory</category>
            <category>filename</category>
            <category>shell</category>
    
    </item>

  
    <item>
        <title>Bash commande de copie de fichiers optimisée</title>
        <link>http://www.posteet.com/view/1344</link>
        <description>
        <![CDATA[<pre>cp filename{,-old}        # cp filename filename-old
cp filename{-old,}        # cp filename-old filename
cp filename{-v1,-v2}    # cp filename-v1 filename-v2</pre> <a href="http://www.posteet.com/tags/accolades">[accolades]</a>  <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/brackets">[brackets]</a>  <a href="http://www.posteet.com/tags/cp">[cp]</a>  <a href="http://www.posteet.com/tags/expansion">[expansion]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Thu, 30 Oct 2008 15:30:15 +0000</pubDate>

            <category>accolades</category>
            <category>bash</category>
            <category>brackets</category>
            <category>cp</category>
            <category>expansion</category>
    
    </item>

  
    <item>
        <title>utf8_unicode_ci vs utf8_general_ci</title>
        <link>http://www.posteet.com/view/1340</link>
        <description>
        <![CDATA[<pre>You can check and compare sort orders provided by these two collations here:

http://www.collation-charts.org/mysql60/mysql604.utf8_general_ci.european.html
http://www.collation-charts.org/mysql60/mysql604.utf8_unicode_ci.european.html

utf8_general_ci is a very simple collation. What it does - it just
- removes all accents
- then converts to upper case
and uses the code of this sort of &quot;base letter&quot; result letter to compare.

For example, these Latin letters: ÀÁÅåāă (and all other Latin letters &quot;a&quot; with any accents and in any cases) are all compared as equal to &quot;A&quot;.

utf8_unicode_ci uses the default Unicode collation element table (DUCET).

The main differences are:

1. utf8_unicode_ci supports so called expansions and ligatures, for example: German letter ß (U+00DF LETTER SHARP S) is sorted near &quot;ss&quot; Letter Œ (U+0152 LATIN CAPITAL LIGATURE OE) is sorted near &quot;OE&quot;.

utf8_general_ci does not support expansions/ligatures, it sorts all these letters as single characters, and sometimes in a wrong order.

2. utf8_unicode_ci is *generally* more accurate for all scripts. For example, on Cyrillic block: utf8_unicode_ci is fine for all these languages: Russian, Bulgarian, Belarusian, Macedonian, Serbian, and Ukrainian. While utf8_general_ci is fine only for Russian and Bulgarian subset of Cyrillic. Extra letters used in Belarusian, Macedonian, Serbian, and Ukrainian
are sorted not well.

+/- The disadvantage of utf8_unicode_ci is that it is a little bit slower than utf8_general_ci.

So when you need better sorting order - use utf8_unicode_ci, and when you utterly interested in performance - use utf8_general_ci.</pre> <a href="http://www.posteet.com/tags/charset">[charset]</a>  <a href="http://www.posteet.com/tags/collation">[collation]</a>  <a href="http://www.posteet.com/tags/interclassement">[interclassement]</a>  <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/unicode">[unicode]</a>  <a href="http://www.posteet.com/tags/utf8">[utf8]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Tue, 28 Oct 2008 09:15:36 +0000</pubDate>

            <category>charset</category>
            <category>collation</category>
            <category>interclassement</category>
            <category>mysql</category>
            <category>unicode</category>
            <category>utf8</category>
    
    </item>

  
    <item>
        <title>Apache Tips: Disable the HTTP TRACE method</title>
        <link>http://www.posteet.com/view/1337</link>
        <description>
        <![CDATA[<pre>This needs to be added in the main server config and the default is enabled (on):

TraceEnable Off</pre> <a href="http://www.posteet.com/tags/apache">[apache]</a>  <a href="http://www.posteet.com/tags/http">[http]</a>  <a href="http://www.posteet.com/tags/securite">[securite]</a>  <a href="http://www.posteet.com/tags/security">[security]</a>  <a href="http://www.posteet.com/tags/tips">[tips]</a>  <a href="http://www.posteet.com/tags/trace">[trace]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Sat, 25 Oct 2008 14:36:46 +0000</pubDate>

            <category>apache</category>
            <category>http</category>
            <category>securite</category>
            <category>security</category>
            <category>tips</category>
            <category>trace</category>
    
    </item>

  
    <item>
        <title>Xen Date/Time Synchronization</title>
        <link>http://www.posteet.com/view/1336</link>
        <description>
        <![CDATA[<pre># [Default] All domains have the same time synchronized from ntp-client in dom0.
echo 0 &gt; /proc/sys/xen/independent_wallclock

# If, however, this is not the case, you will have to run ntp-client on all guests. For this to work, you will need to set  to 1, i.e. 
echo 1 &gt; /proc/sys/xen/independent_wallclock</pre> <a href="http://www.posteet.com/tags/clock">[clock]</a>  <a href="http://www.posteet.com/tags/date">[date]</a>  <a href="http://www.posteet.com/tags/dom0">[dom0]</a>  <a href="http://www.posteet.com/tags/synch">[synch]</a>  <a href="http://www.posteet.com/tags/time">[time]</a>  <a href="http://www.posteet.com/tags/xen">[xen]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Sat, 25 Oct 2008 11:53:58 +0000</pubDate>

            <category>clock</category>
            <category>date</category>
            <category>dom0</category>
            <category>synch</category>
            <category>time</category>
            <category>xen</category>
    
    </item>

  
    <item>
        <title>Barre de progression à largeur automatique</title>
        <link>http://www.posteet.com/view/1316</link>
        <description>
        <![CDATA[<pre>#!/bin/sh

# ex :
# ~$ test.sh &quot;command1&quot; &quot;command2&quot;
# [||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||] 100.00%

barre_progression ()
{
	nb_iterations=$1
	liste_length=$2
	pourcent=`echo &quot;scale=2;($nb_iterations * 100) / $liste_length&quot; | bc`
	pourcent=`printf &quot;% 3.2f&quot; &quot;$pourcent&quot;`
	
	chaine=&quot;$pourcent&quot;
	nb_etoiles=`echo &quot;scale=0;$chaine / $diviseur_barre&quot; | bc`
	etoiles=&quot;&quot;
	while test $nb_etoiles -gt 0
	do
		etoiles=&quot;${caractere_barre}${etoiles}&quot;
		nb_etoiles=`echo &quot;$nb_etoiles - 1&quot; | bc`
	done
	etoiles=`printf &quot;[%-${largeur_barre}s]&quot; &quot;$etoiles&quot;`
	pourcentage=`printf &quot;%7s&quot; &quot;$chaine&quot;`
	#echo &quot;\r${etoiles}${pourcentage}%\r\c&quot;
	printf &quot;%b%b%b&quot; &quot;\r${etoiles}&quot; &quot;${pourcentage}&quot; &quot;%\r\c&quot;
}

# INITIALISATION DE LA BARRE DE PROGRESSION
init_progress_bar ()
{
	# caractere qui sera affiche dans la barre de progression
	caractere_barre=&quot;|&quot;
	
	# detection de l'OS
	os=`uname -s | tr [a-z] [A-Z]`
	
	# recuperation de la largeur en caracteres du terminal
	if test &quot;$os&quot; = &quot;LINUX&quot;
	then
		largeur_ecran=`stty -a | grep columns | cut -d ' ' -f7 | tr -d ';'`
	elif test &quot;$os&quot; = &quot;SUNOS&quot;
	then
		largeur_ecran=`stty | grep columns | cut -d ' ' -f6 | tr -d ';'`
	else
		echo &quot;Systeme d'exploitation incompatible, programme stoppe&quot;
		exit 1
	fi
	
	# calcul de la largeur optimale de la barre de progression 
	largeur_barre=`echo &quot;$largeur_ecran - 7 - 2 - 1&quot; | bc`
	diviseur_barre=`echo &quot;scale=2;100 / $largeur_barre&quot; | bc`
	
	# protection des variables
	readonly largeur_ecran largeur_barre diviseur_barre caractere_barre
}

# gestion de la langue de l'environnement
LC_NUMERIC=C

init_progress_bar

liste_length=$#
nb_iterations=0
if test $liste_length -gt 0
then
	for i in &quot;$@&quot;
	do
		nb_iterations=`echo &quot;$nb_iterations + 1&quot; | bc`
		$i 2&gt;&amp;1 &gt;/dev/null
		barre_progression &quot;$nb_iterations&quot; &quot;$liste_length&quot;
		# sleep 1
	done
fi

echo &quot; &quot;</pre> <a href="http://www.posteet.com/tags/barre">[barre]</a>  <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/bc">[bc]</a>  <a href="http://www.posteet.com/tags/printf">[printf]</a>  <a href="http://www.posteet.com/tags/progression">[progression]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/stty">[stty]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Wed, 15 Oct 2008 13:14:46 +0000</pubDate>

            <category>barre</category>
            <category>bash</category>
            <category>bc</category>
            <category>printf</category>
            <category>progression</category>
            <category>shell</category>
            <category>stty</category>
    
    </item>

  
    <item>
        <title>Monitor a log file and execute commands based on patterns</title>
        <link>http://www.posteet.com/view/1311</link>
        <description>
        <![CDATA[<pre>#!/bin/sh
tail -fn0 /var/log/file.log | while read line ; do
        echo &quot;$line&quot; | grep &quot;pattern&quot;
        if [ $? = 0 ]
        then
                # Actions
                echo &quot;Yeah: $line&quot;
        fi
done</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/log">[log]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/tail">[tail]</a>  <a href="http://www.posteet.com/tags/while">[while]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Fri, 10 Oct 2008 13:42:42 +0000</pubDate>

            <category>bash</category>
            <category>log</category>
            <category>shell</category>
            <category>tail</category>
            <category>while</category>
    
    </item>

  
    <item>
        <title>Calculer le temps d'exécution d'un code PHP</title>
        <link>http://www.posteet.com/view/1310</link>
        <description>
        <![CDATA[<pre>$start = microtime(TRUE);
// Code PHP à bencher
for ($i = 0; $i &lt; 10000; $i++)
{
    isset($array['id']);
}

echo number_format(microtime(TRUE) - $start, 6).&quot; seconds: isset\n&quot;;</pre> <a href="http://www.posteet.com/tags/exec">[exec]</a>  <a href="http://www.posteet.com/tags/performance">[performance]</a>  <a href="http://www.posteet.com/tags/php">[php]</a>  <a href="http://www.posteet.com/tags/time">[time]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Fri, 10 Oct 2008 12:08:16 +0000</pubDate>

            <category>exec</category>
            <category>performance</category>
            <category>php</category>
            <category>time</category>
    
    </item>

  
    <item>
        <title>onlogdo - monitor a log file and execute commands based on patterns</title>
        <link>http://www.posteet.com/view/1309</link>
        <description>
        <![CDATA[<pre>#!/bin/bash

# Author: Ben Wong &lt;ben@wongs.net&gt;
# Created on: &lt;2001-08-08 11:56:03 hackerb9&gt;
# Time-stamp: &lt;2002-11-20 14:13:11 bbb&gt;

# onlogdo: a hack to handle a common problem: when a certain message
# shows up in the log file, an action should be performed. E.g.: when
# a PC-card network device is inserted, it should be ifconfig'd or
# perhaps dhclient should be run. This program can do that in a fairly
# reasonable way.



### FIRST, THE HELPER FUNCTIONS ###

function showmanpage () {
    cat &lt;&lt;'EOF'
NAME

   onlogdo - monitor a log file and execute commands based on patterns


SYNOPSIS

   onlogdo &lt;logfile&gt; &lt;pattern&gt; &lt;command&gt; [ &lt;pattern&gt; &lt;command&gt; ... ]

     logfile: a file that gets appended to (e.g., /var/log/messages),
     pattern: a string (can use bash's extended pathname globbing syntax),
     command: the command to run when the previous pattern is seen.


DESCRIPTION

    Onlogdo is a hack to handle a common problem: when a certain
    message shows up in a log file, an action should be performed.
    E.g.: when a PC-card network device is inserted, it should be
    ifconfig'd or perhaps dhclient should be run. This program can do
    that in a fairly reasonable way.

    Onlogdo continuously reads lines as they are appended to a log
    file. When a line matches a given pattern, the command associated
    with that pattern is run in the background. The patterns
    recognized are standard pathname globbing (*, ?, []) plus bash's
    extended pattern matching (extglob) syntax (see bash(1)).

    The log file is reopened properly, if the log file being read is
    rotated. Also, since it blocks when waiting for new lines, onlogdo
    takes up almost no CPU time.


PATTERN MATCHING SYNTAX

    Don't worry about learning the pattern matching the first time you
    read this manual; you'll rarely need it, unless you're anal about
    being as succinct as possible. (Like the author).

    The following is an excerpt from bash's man page; see bash(1) for
    full details. In the following description, a pattern-list is a
    list of one or more patterns separated by a |. Composite patterns
    may be formed using one or more of the following sub-patterns:

       *      Matches any string, including the null string.

       ?      Matches any single character.

       [...]  Matches any one of the enclosed characters. A pair of
              characters separated by a hyphen denotes a range
              expression. If the first character following the [ is a
              ! or a ^ then any character not enclosed is matched.

      ?(pattern-list)
	     Matches zero or one occurrence of the  given patterns
      *(pattern-list)
	     Matches  zero  or  more  occurrences  of the given patterns
      +(pattern-list)
	     Matches one or more occurrences of the given patterns
      @(pattern-list)
	     Matches exactly one of the given patterns
      !(pattern-list)
	     Matches  anything  except  one  of the given patterns


EXAMPLES

    Pipelines are okay:
      onlogdo /var/log/messages '*' 'sleep 5; echo olleH | rev'

    Wildcards match filenames as usual in a command:
      onlogdo /var/log/messages 'Segfault' 'rm /*.core'

    Multiple pattern and command pairs are allowed:
      onlogdo /var/log/messages \
	    'ep0 at pcmcia' '/etc/rc.d/dhclient start' \
	    'ep0 detached'  '/etc/rc.d/dhclient stop'  \
	    'wi0 at pcmcia' '/etc/rc.d/dhclient start' \
	    'wi0 detached'  '/etc/rc.d/dhclient stop'

    Bash's extended pathname globbing to do the same as above:
      onlogdo /var/log/messages \
	    '@(ep|wi)[0-9] at pcmcia' '/etc/rc.d/dhclient start' \
	    '@(ep|wi)[0-9] detached'  '/etc/rc.d/dhclient stop'

    A useful example for NetBSD/hpcmips:
      onlogdo /var/log/messages 'hpcapm: resume' 'sleep 1; xrefresh'

    Under NetBSD/hpcmips-1.5.1, the X server screen is overwritten by the
    console on an APM resume. I put the last &quot;onlogdo&quot; example in my
    system xinitrc, so xrefresh will be run automatically. (The sleep
    is there to wait for the console to finish junking up the screen).


SEE ALSO

    tail(1), bash(1)

BUGS

    If this had been written in Perl it would have used &quot;normal&quot;
    regexp syntax instead of pathname expansion. Bash's extensions
    make the patterns as powerful as regexps, but more recondite.

    There is no (documented) way for a command to refer to specifics
    in the line that matched. E.g., if the pattern was &quot;@(ep|wi)0&quot;,
    the command wouldn't know if the line contained ep0 or wi0.

    The author has spent way too much time perfecting a kludge. No
    matter what you're using onlogdo for, there's probably a more
    &quot;correct&quot; way to do it. On the other hand, onlogdo is widely
    applicable and easy to use, so at least you won't be wasting much
    time while doing it the &quot;wrong&quot; way.

    There should be a real man page.


AUTHOR

    Ben Wong &lt;Benjamin.Wong@cc.gatech.edu&gt;


HISTORY

    Onlogdo started life as a one line kludge to work around a bug in
    the interaction between APM and the X server in NetBSD-1.5/hpcmips
    in September of 2001.

EOF
}





### USAGE AND ARGUMENT SANITY CHECKING ###

if [[ $# -lt 3 ]]; then
    showmanpage
    exit 1
fi

# Emacs's syntax highlighting doesn't handle single ticks (') properly.



# Check if -v (verbose) flag was given.
if [[ &quot;$1&quot; == &quot;-v&quot; ]]; then 
    ifverbose=echo		# Echo commands verbosely, if -v.
    shift
else
    ifverbose=:			# Usually just run a no-op.
fi


# Make sure the log file is readable.
if [[ ! -r &quot;$1&quot; ]]; then
    echo &quot;onlogdo: \&quot;$1\&quot; is not readable&quot; &gt;&amp;2
    exit 1
fi
if [[ -d &quot;$1&quot; ]]; then
    echo &quot;onlogdo: \&quot;$1\&quot; is a directory&quot; &gt;&amp;2
    exit 1
fi






### SIGNAL HANDLING AND EXIT CLEANUP ###

# Run cleanup function when shell exits.
trap cleanup EXIT


cleanup () {
    echo &quot;onlogdo: cleaning up...&quot; &gt;&amp;2
    if [[ &quot;$TAILPID&quot; ]]; then
	kill $TAILPID		# Kill the bg tail process.
    fi
    rm -f &quot;$PIPE&quot;		# Delete the named pipe.
    rmdir &quot;$PIPEDIR&quot;
    return 0
}




### MAIN ROUTINE STARTS HERE ###

# Don't expand wildcards in pattern arguments as filenames.
set -o noglob

# Use bash's extended pattern matching operators
shopt -s extglob

# Create a pipe to read the log file a line at a time; 
# Use mktemp for security.

PIPEDIR=$(mktemp -d /tmp/onlogdo.XXXXXX)
PIPE=&quot;$PIPEDIR/$(echo $1 | sed 's#^/##; s#/#.#g')&quot;	# var.log.messages
rm -f $PIPE
mknod $PIPE p
tail -Fn0 $1 &gt;$PIPE &amp;		# FSF tail: &quot;tail --retry -fn0&quot;
TAILPID=$!
exec 5&lt; $PIPE

# Copy the positional paramaters in to a variable that can be indexed.
params=(&quot;$0&quot; &quot;$@&quot;)


# Repeatedly read from the pipe, process each line.
while :; do
    while read REPLY &lt;&amp;5; do

	$ifverbose -e &quot;\nline: \&quot;$REPLY\&quot;&quot;
	for ((i=2; i&lt;$#; i+=2)); do
	    pattern=${params[$i]}
	    command=${params[$((i+1))]}
	    $ifverbose &quot;pattern: \&quot;$pattern\&quot;&quot;
	    if [[ -z &quot;${REPLY##*$pattern*}&quot; ]]; then
		$ifverbose &quot;*MATCHED*&quot;
		$ifverbose &quot;command: \&quot;$command\&quot;&quot;
		set +o noglob	# Allow pathname matching in commands
		eval $command &amp;
		set -o noglob	# No pathname expansion for patterns
	    fi
	done
    done

    # We get here whenever the pipe first blocks (returns EOF)
    sleep 1			# Don't loop too quickly
done


### MAIN ROUTINE ENDS HERE ###


# Note: if we ever get here, the cleanup() function will be called
# automatically since we're trapping on signal 0.</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/cron">[cron]</a>  <a href="http://www.posteet.com/tags/log">[log]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/tail">[tail]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Thu, 09 Oct 2008 12:09:30 +0000</pubDate>

            <category>bash</category>
            <category>cron</category>
            <category>log</category>
            <category>shell</category>
            <category>tail</category>
    
    </item>

  
    <item>
        <title>Script d'import automatique d'un projet dans Subversion et création des rep trunk, branches et tags</title>
        <link>http://www.posteet.com/view/1257</link>
        <description>
        <![CDATA[<pre>#!/bin/bash

# Vous pouvez éditer ces variables selon vos besoins
SVN_ROOT=&quot;/var/svn&quot;
SVN_TMP_PATH=&quot;/tmp/svn&quot;
APACHE_USER=&quot;www-data&quot;
APAGE_GROUP=&quot;www-data&quot;
TRAC_ROOT=&quot;/var/trac&quot;
TRAC_SHARE=&quot;/usr/share/trac&quot;

# Ce script doit être executer avec les droits de superutilisateur
test -w /root; 
if [ ! &quot;$?&quot; -eq &quot;0&quot; ]; then 
	echo &quot;Vous devez executer ce script en tant que superutilisateur.&quot;
	exit 0
fi 

echo &quot;#######################################&quot;
echo &quot;Création d'un nouveau projet Subversion&quot;
echo &quot;#######################################&quot;
echo &quot;&quot;
echo &quot;Tapez le nom du nouveau projet :&quot;
read PROJECT_NAME

if [ -z &quot;$PROJECT_NAME&quot; ]; then
        echo &quot;$PROJECT_NAME n'est pas un nom de projet valide.&quot;;
        exit 0  
fi

echo &quot;Tapez maintenant le chemin du répertoire source :&quot;
echo &quot;(Note: les répertoires trunk, branches et tags seront créés automatiquement)&quot;
read PROJECT_SOURCE_PATH

if [ -z &quot;$PROJECT_SOURCE_PATH&quot; -o ! -d $PROJECT_SOURCE_PATH ]; then
	echo &quot;$PROJECT_SOURCE_PATH n'est pas un répertoire valide.&quot;;
	exit 0
fi

echo &quot;Création du projet $PROJECT_NAME depuis $PROJECT_SOURCE_PATH...&quot;

# Si le répertoire $SVN_ROOT n'existe pas, on le crée
if [ ! -d $SVN_ROOT ]; then
	mkdir $SVN_ROOT
fi

# Si le répertoire $SVN_TMP_PATH n'existe pas, on le crée
if [ ! -d $SVN_TMP_PATH ]; then
	mkdir $SVN_TMP_PATH
fi	

# Création du répertoire du dépôt
mkdir $SVN_ROOT/$PROJECT_NAME

# Création d'un répertoire temporaire de stockage avant import
mkdir $SVN_TMP_PATH/$PROJECT_NAME
mkdir $SVN_TMP_PATH/$PROJECT_NAME/branches
mkdir $SVN_TMP_PATH/$PROJECT_NAME/tags
mkdir $SVN_TMP_PATH/$PROJECT_NAME/trunk

# Copie des fichiers originaux dans le répertoire temporaire
cp -R $PROJECT_SOURCE_PATH/* $SVN_TMP_PATH/$PROJECT_NAME/trunk/

# Création du dépôt et import depuis le répertoire créé
svnadmin create $SVN_ROOT/$PROJECT_NAME
svn import $SVN_TMP_PATH/$PROJECT_NAME file://$SVN_ROOT/$PROJECT_NAME -m &quot;Initial import&quot;

# Attribution des permissions à Apache sur le repertoire du dépot
chown -R $APACHE_USER:$APACHE_GROUP $SVN_ROOT/$PROJECT_NAME

# Attribution de droits supplémentaires
sudo chown -R $APACHE_USER:$APACHE_GROUP $TRAC_SHARE

# Suppression du répertoire temporaire
rm -rf $SVN_TMP_PATH/$PROJECT_NAME	

# Done !
echo &quot;&quot;
echo &quot;Projet subversion $PROJECT_NAME créé avec succès dans $SVN_ROOT/$PROJECT_NAME !&quot;</pre> <a href="http://www.posteet.com/tags/import">[import]</a>  <a href="http://www.posteet.com/tags/script">[script]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/svn">[svn]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Wed, 10 Sep 2008 19:02:21 +0000</pubDate>

            <category>import</category>
            <category>script</category>
            <category>shell</category>
            <category>svn</category>
    
    </item>

  
    <item>
        <title>SVN: Merging a Branch into Trunk</title>
        <link>http://www.posteet.com/view/1239</link>
        <description>
        <![CDATA[<pre>1/ Find the revision your branch began at: svn log --verbose --stop-on-copy svn+ssh://server/path/to/branch. The final revision printed by this command is the revision in which branch was created by copying.
2/ Change your current working directory to trunk
3/ Perform an SVN update: svn up
4/ This will update your copy of trunk to the most recent version, and tell you the revision you are at: rYYYY
5/ Now we can perform an SVN merge: svn merge -rXXXX:YYYY svn+ssh://server/path/to/branch
6/ Resolve any conflicts that arose during the merge
7/ Commit: svn ci -m &quot;MERGE myProject myBranch [XXXX]:[YYYY] into trunk&quot;</pre> <a href="http://www.posteet.com/tags/branch">[branch]</a>  <a href="http://www.posteet.com/tags/merge">[merge]</a>  <a href="http://www.posteet.com/tags/svn">[svn]</a>  <a href="http://www.posteet.com/tags/trunk">[trunk]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Tue, 02 Sep 2008 08:27:41 +0000</pubDate>

            <category>branch</category>
            <category>merge</category>
            <category>svn</category>
            <category>trunk</category>
    
    </item>

  
    <item>
        <title>How to make a dry-run with svn update</title>
        <link>http://www.posteet.com/view/1238</link>
        <description>
        <![CDATA[<pre>svn merge --dry-run -r BASE:HEAD .
alias svnupdry='svn merge --dry-run -r BASE:HEAD .'</pre> <a href="http://www.posteet.com/tags/dryrun">[dryrun]</a>  <a href="http://www.posteet.com/tags/merge">[merge]</a>  <a href="http://www.posteet.com/tags/svn">[svn]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Mon, 01 Sep 2008 13:41:16 +0000</pubDate>

            <category>dryrun</category>
            <category>merge</category>
            <category>svn</category>
    
    </item>

  
    <item>
        <title>Commandes utiles pour l'utilisation courante de svn</title>
        <link>http://www.posteet.com/view/1237</link>
        <description>
        <![CDATA[<pre>#-------- Vérifier ses modifications ----------#
# Indique l'état de la version locale (ou d'un fichier précis de la version locale) par rapport à la dernière opération de 'synchronisation' avec le serveur (fichiers pas encore ajoutés, non commités, ...)
svn status [$fichiers$]

# Modifications par rapport à la dernière révision du référentiel (n'affichera pas les possibles conflits)
svn status -u [$fichiers$]

#-------- Annuler ses modifications ----------#
# Supprime toutes les modifications locales (non commitées) apportées au fichier spécifié depuis le dernier update. 
svn revert [$fichiers$]

# Pour utiliser la commande sur un répertoire de façon récursive
svn revert -R [$répertoire$]

# Reverter ses modification commités (ex: annuler la révision 303)
svn merge -c -303 http://svn.example.com/repos/calc/trunk
svn merge -r 303:202 http://svn.example.com/repos/calc/trunk

# Reverter ses dernières modifications
svn merge -r PREV:HEAD my_file.txt

#-------- Résoudre les conflits ----------#
mv monfichieragarder.rXXX monfichieragarder
svn resolved monfichieragarder

# Résolution en masse
svn status | grep ^C | awk '{print $2}' | xargs svn resolved

#-------- Log ----------#
# suivre l'évolution dans le temps d'une ressource du référentiel ou de la copie locale
svn log [-r vInitiale:vCible] [$fichiers$]

# A quelle révision une branche a-t-elle été créée? La dernière révision apparaissant avec la commande suivante
svn log --verbose --stop-on-copy svn+ssh://svn.example.com/home/svn/module/branches/project

# Les changements des derniers 6 mois
svn log -r {2006-12-25}:{2007-6-25} somefile.py

#-------- Merger / backporter ----------#
# Cette syntaxe applique les modifications de la branche $brancheorigine$ effectuées de la révision vInitiale à la révision vCible à la branche branchedest. Si branchedest n'est pas spécifié, l'application sera réalisée sur le répertoire courant. 
svn merge -r vInitiale:vCible $brancheorigine$ [$branchedest$]
svn ci

# Ex: d'une branche (créée à la révision 17) vers le trunk (on est situé dans la copie locale du trunk)
svn merge -r 17:HEAD svn+ssh://svn.example.com/home/svn/module/branches/project

# Ex: du trunk vers une branche(créée à la révision 17) (on est situé dans la copie locale de la branche)
svn merge -r 17:HEAD svn+ssh://svn.example.com/home/svn/module/trunk/project

#/!\ Un point important est de noter que la branche reçoit le dernier numéro de version. La prochaine fois que l'on veut backporter les modifs du trunk dans cette branche il faudra utiliser CE numéro de version.

#-------- Créer une version taggée ou une branche ----------#
svn copy trunk tags/$montag$
svn copy trunk branches/$mabranche$</pre> <a href="http://www.posteet.com/tags/branching">[branching]</a>  <a href="http://www.posteet.com/tags/merge">[merge]</a>  <a href="http://www.posteet.com/tags/svn">[svn]</a>  <a href="http://www.posteet.com/tags/tagging">[tagging]</a>  <a href="http://www.posteet.com/tags/usage">[usage]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Mon, 01 Sep 2008 13:17:20 +0000</pubDate>

            <category>branching</category>
            <category>merge</category>
            <category>svn</category>
            <category>tagging</category>
            <category>usage</category>
    
    </item>

  
    <item>
        <title>Récupérer une ancre dans l'URL en javascript</title>
        <link>http://www.posteet.com/view/1235</link>
        <description>
        <![CDATA[<pre>anchor = window.location.hash;
anchor = anchor.substring(1,anchor.length); // enleve le #

//-- Juste pour l'archivage, voici le code que j'utilisais avant de savoir qu'une fonction js existait
var url = document.location.toString();
if (myFile.match('#')) {
    var anchor = myFile.split('#')[1];
}</pre> <a href="http://www.posteet.com/tags/anchor">[anchor]</a>  <a href="http://www.posteet.com/tags/javascript">[javascript]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Mon, 01 Sep 2008 09:10:03 +0000</pubDate>

            <category>anchor</category>
            <category>javascript</category>
    
    </item>

  
    <item>
        <title>Configuration de base d'un postfix</title>
        <link>http://www.posteet.com/view/1225</link>
        <description>
        <![CDATA[<pre>apt-get install postfix
# Choisir configuration type 'Site internet'

//////////////////////////
//-- etc/postfix/main.cf
//////////////////////////
myhostname = bart
mydomain = mydomain.com
myorigin = $myhostname.$mydomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, $myorigin, localhost.$mydomain, localhost
mynetworks = 127.0.0.0/8,192.168.10.0/24 # Defines networks allowed for SMTP connections
#luser_relay = user  # used with the local daemon in the transport map,
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
transport_maps = hash:/etc/postfix/transport

//////////////////////////
//-- /etc/postfix/transport
//////////////////////////
extdomain.com smtp:[192.168.10.1]  # relay
.extdomain.com smtp:[192.168.10.1] # tous les sous domaines
* discard # jeter tous les autres messages

//////////////////////////
postmap /etc/postfix/transport
/etc/init.d/postfix reload
# Consulter les logs dans mail.info</pre> <a href="http://www.posteet.com/tags/debian">[debian]</a>  <a href="http://www.posteet.com/tags/mail">[mail]</a>  <a href="http://www.posteet.com/tags/postfix">[postfix]</a>  <a href="http://www.posteet.com/tags/relay">[relay]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Fri, 29 Aug 2008 15:52:38 +0000</pubDate>

            <category>debian</category>
            <category>mail</category>
            <category>postfix</category>
            <category>relay</category>
    
    </item>


</channel>
</rss>
