#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/apache2-config-modules-trac-repository-resync # # Creation: 2023-09-13 hb # Last Update: $Id$ # # Copyright (c) 2007-@@YEAR@@ Holger Bruenjes /tmp/resync-trace$$.log #set -x # set echo line, for allways equal echo_line=" ----------------------------" # --------------------------------------------------------------------------- # resync repository # --------------------------------------------------------------------------- resync_repository() { local repo="${1}" local web_name package_default_folder=/srv package_folder=${TRAC_SPEC_FOLDER:-${package_default_folder}}/trac case ${repo} in a) idx=1 # remove from config while [ ${idx} -le ${TRAC_PROJ_N:-0} ] do eval web_name='${TRAC_PROJ_'${idx}'_NAME}' eval active='${TRAC_PROJ_'${idx}'_ACTIVE}' if [ "${active}" != "yes" ] then idx=$((${idx} + 1)) continue fi # resync repository project mecho --info -n "resync project" mecho --std " '${web_name}'" /usr/bin/trac-admin ${package_folder}/${web_name} repository resync '(default)' idx=$((${idx} + 1)) done ;; *) eval web_name='${TRAC_PROJ_'${repo}'_NAME}' # resync repository project mecho --info -n "resync project" mecho --std " '${web_name}'" /usr/bin/trac-admin ${package_folder}/${web_name} repository resync '(default)' ;; esac } # --------------------------------------------------------------------------- # perform deletion # --------------------------------------------------------------------------- while true do clrhome if [ ${TRAC_PROJ_N} -eq 0 ] then echo mecho --error "Error: There are no projects defined on this server!" anykey exit 1 fi echo mecho --info "Please select the project to resync the repository" mecho --info "PLEASE NOTE: This action takes longer for large repositories" echo techo --begin '3 3r 2 32' techo --row '' --info No '' --info Project mecho "${echo_line}" idx=1 while [ ${idx} -le ${TRAC_PROJ_N:-0} ] do eval project_name='${TRAC_PROJ_'${idx}'_NAME}' eval active='${TRAC_PROJ_'${idx}'_ACTIVE}' if [ "${active}" != "yes" ] then idx=$((${idx} + 1)) continue fi techo --row '' "${idx}" '' "${project_name}" idx=$((${idx} + 1)) done mecho "${echo_line}" techo --end echo _ask_tmpfile=$(${MKTEMP} -t XXXXXXXXXXXXX) ${ASK} "Select" "" "1-${TRAC_PROJ_N}" "a=all" "^$=Return" "0=Exit" >${_ask_tmpfile} rc=${?} read resync_project < ${_ask_tmpfile} ${RM} -f ${_ask_tmpfile} if [ ${rc} = 255 ] then resync_project=0 fi case ${resync_project} in '') exit 0 ;; 0) exit 127 ;; *) resync_repository ${resync_project} ;; esac done exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------