Ethercalc ********* Ethercalc permet à l'instar de google doc d'avoir un tableur dans un navigateur. Pre-requis ~~~~~~~~~~ .. code-block:: bash apt-get update apt-get install vim git-core curl build-essential openssl libssl-dev redis-server echo "" > /var/log/ethercalc.log chmod a+r /var/log/ethercalc.log chmod a+w /var/log/ethercalc.log Installation node.js et npm ~~~~~~~~~~~~~~~~~~~~~~~~~~~ On clone le git de node.js .. code-block:: bash git clone https://github.com/joyent/node.git cd node on visualise les versions disponible et on installe la version 0.8.9 .. code-block:: bash git tag # Gives you a list of released versions git checkout v0.8.9 on compile node.js et on vérifie la version .. code-block:: bash ./configure make make install node -v npm -v Installation d'ethercalc ~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: bash npm i -g ethercalc Pour récuperer les sources .. code-block:: bash cd /opt git clone https://github.com/audreyt/ethercalc.git cd ethercalc Industrialisation d'ethercalc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ on va rendre ethercalc comme un daemon .. code-block:: bash echo "" > /etc/init.d/ethercalc chmod a+x /etc/init.d/ethercalc le contenu du fichier /etc/init.d/ethercalc .. code-block:: bash #!/bin/sh ### BEGIN INIT INFO # Provides: ethercalc # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts ethercalc # Description: starts ethercalc lite using start-stop-daemon ### END INIT INFO PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin" LOGFILE="/var/log/ethercalc.log" EPLITE_DIR="/usr/local/bin/" EPLITE_BIN="ethercalc" USER="root" GROUP="root" DESC="Ethercalc" NAME="ethercalc" set -e . /lib/lsb/init-functions start() { echo "Starting $DESC... " start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true echo "done" } #We need this function to ensure the whole process tree will be killed killtree() { local _pid=$1 local _sig=${2-TERM} for _child in $(ps -o pid --no-headers --ppid ${_pid}); do killtree ${_child} ${_sig} done kill -${_sig} ${_pid} } stop() { echo "Stopping $DESC... " while test -d /proc/$(cat /var/run/$NAME.pid); do killtree $(cat /var/run/$NAME.pid) 15 sleep 0.5 done rm /var/run/$NAME.pid echo "done" } status() { status_of_proc -p /var/run/$NAME.pid "" "ethercalc" && exit 0 || exit $? } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status ;; *) echo "Usage: $NAME {start|stop|restart|status}" >&2 exit 1 ;; esac exit 0 On active le script au démarrage .. code-block:: bash update-rc.d ethercalc defaults On lance le serveur ethercalc .. code-block:: bash /etc/init.d/ethercalc start On retrouve maintenant ethercalc sur http://My.IP.Address.Local:8000/ .. note:: par la suite le site est hébergé sur /usr/local/lib/node_modules/ethercalc/ et non sur /opt/ethercalc mais je ne sais pas pourquoi On peut avant le premier lancement changer les couleurs et les icones .. code-block:: python import glob import os.path def listdirectory(path): fichier=[] l = glob.glob(path+'/*') for i in l: if os.path.isdir(i): fichier.extend(listdirectory(i)) else: fichier.append(i) return fichier for f in listdirectory('./ethercalc'): print(f) fichier = open(f,'r') txt='' for i in fichier.readlines(): txt = txt + i.replace('404040','#15428B').replace('#808080','#BFDBFF') fichier.close() result = open(f,'w') result.write(txt) result.close() modification icone et background :download:`ici `