Option to mirror a single app

This commit is contained in:
Bob Mottram 2016-11-03 11:44:11 +00:00
parent 2b1f8a88bc
commit bd597a933a
2 changed files with 26 additions and 2 deletions

Binary file not shown.

View File

@ -38,6 +38,9 @@ MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-u
CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg" CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg"
# used to mirror a single application
SYNC_SINGLE_APP=
# if this is blank then just use the default repos # if this is blank then just use the default repos
FRIENDS_MIRRORS_SERVER= FRIENDS_MIRRORS_SERVER=
UTILS_REPOS= UTILS_REPOS=
@ -120,10 +123,25 @@ function enable_mirrors_via_onion {
function update_installed_apps_repos { function update_installed_apps_repos {
INSTALLED_APPS_REPOS=() INSTALLED_APPS_REPOS=()
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
function_check app_is_installed function_check app_is_installed
# only deal with a single app
if [ $SYNC_SINGLE_APP ]; then
if [[ "$(app_is_installed ${SYNC_SINGLE_APP})" == "1" ]]; then
filename=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${SYNC_SINGLE_APP}
APP_REPOS=($(cat ${MAIN_COMMAND} $filename | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
for line in "${APP_REPOS[@]}"
do
INSTALLED_APPS_REPOS+=("${line}")
done
fi
return
fi
# all apps currently installed
FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
# for all the app scripts # for all the app scripts
for filename in $FILES for filename in $FILES
do do
@ -203,7 +221,9 @@ function sync_mirrors_base {
} }
function sync_mirrors_repos { function sync_mirrors_repos {
sync_mirrors_base "${UTILS_REPOS[@]}" if [ ! $SYNC_SINGLE_APP ]; then
sync_mirrors_base "${UTILS_REPOS[@]}"
fi
sync_mirrors_base "${INSTALLED_APPS_REPOS[@]}" sync_mirrors_base "${INSTALLED_APPS_REPOS[@]}"
} }
@ -238,6 +258,10 @@ case $key in
shift shift
FRIENDS_MIRRORS_SSH_PORT=${1} FRIENDS_MIRRORS_SSH_PORT=${1}
;; ;;
-a|--app)
shift
SYNC_SINGLE_APP="${1}"
;;
*) *)
# unknown option # unknown option
;; ;;