#!/bin/sh
-GIT_URL="http://git.auf.org/?p=progfou.git;a=blob_plain;f=wcs/"
-SCRIPTS="update-wcs-scripts wcs-extract wcs-extract-all"
+URL="http://git.auf.org/?p=progfou.git;a=blob_plain;f=wcs/"
-[ "`id -un`" = "root" ] && cd /usr/local/sbin
-for script in $SCRIPTS ; do
- if wget -q -O "tmp.${script}" "${GIT_URL}$script" ; then
- if ! cmp -s "tmp.${script}" "${script}" ; then
- echo "Mise à jour de '${script}'..."
- cat "tmp.${script}" > "${script}"
+update_scripts() {
+ url="$1" ; dir="$2" ; shift 2
+ scripts="$@"
+ [ "`id -un`" = "root" ] && cd "${dir}"
+ for script in ${scripts} ; do
+ if wget -q -O "tmp.${script}" "${url}${script}" ; then
+ if ! cmp -s "tmp.${script}" "${script}" ; then
+ echo "Mise à jour de '${script}'..."
+ cat "tmp.${script}" > "${script}"
+ fi
+ else
+ echo "Script '${script}' indisponible !?"
fi
- else
- echo "Script '${script}' indisponible !?"
- fi
- rm -f "tmp.${script}"
-done
+ rm -f "tmp.${script}"
+ done
+}
+
+update_scripts "$URL" /usr/local/sbin update-wcs-scripts wcs-extract wcs-extract-all
+update_scripts "$URL" /usr/local/lib list2form.py wcs-dynexport