## ---------------------------------------------------------------------------- ## Makefile pour synchro site distant via FTP ## ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- ## Definitions ## ---------------------------------------------------------------------------- url_ftp := LE_SERVEUR_FTP user_ftp := USER_FTP dir_distant := /.../LE_REP_DISTANT_SUR_LE_SERVEUR_FTP dir_prefix := /.../LE_REP_LOCAL_A_SYNCHRONIISER exclude_rep := un_repertoire exclude_file := toto* *.pdf exclude_all := $(exclude_rep) $(exclude_file) sitecopyrc := sitecopyrc storepath := .sitecopy ## ---------------------------------------------------------------------------- ## Targets ## ---------------------------------------------------------------------------- all: sitecopy sitecopy: # Initialisation (1er mirroir) if [[ ! -d $(storepath) ]]; then \ mkdir $(storepath); \ chmod 700 $(storepath); \ fi if [[ ! -e $(sitecopyrc) ]]; then \ echo "site $(url_ftp)" > $(sitecopyrc);\ echo " server $(url_ftp)" >> $(sitecopyrc);\ echo " remote $(dir_distant)" >> $(sitecopyrc);\ echo " username $(user_ftp)" >> $(sitecopyrc);\ echo " local $(dir_prefix)" >> $(sitecopyrc);\ for rep in $(exclude_rep);\ do \ echo " exclude $$rep" >> $(sitecopyrc);\ done;\ for file in $(exclude_file);\ do \ echo " exclude $$file" >> $(sitecopyrc);\ done;\ chmod 600 $(sitecopyrc);\ sitecopy --rcfile=$(sitecopyrc) --storepath=$(storepath) --init $(url_ftp);\ fi sitecopy --rcfile=$(sitecopyrc) --storepath=$(storepath) --update $(url_ftp); clean: rm -rf $(dir_prefix); purge: clean rm $(sitecopyrc)||exit 0; rm -rf $(storepath)||exit 0;