Explorar el Código

Option to mirror a single app

Bob Mottram hace 8 años
padre
commit
bd597a933a
Se han modificado 2 ficheros con 26 adiciones y 2 borrados
  1. BIN
      man/freedombone-mirrors.1.gz
  2. 26
    2
      src/freedombone-mirrors

BIN
man/freedombone-mirrors.1.gz Ver fichero


+ 26
- 2
src/freedombone-mirrors Ver fichero

38
 
38
 
39
 CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg"
39
 CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg"
40
 
40
 
41
+# used to mirror a single application
42
+SYNC_SINGLE_APP=
43
+
41
 # if this is blank then just use the default repos
44
 # if this is blank then just use the default repos
42
 FRIENDS_MIRRORS_SERVER=
45
 FRIENDS_MIRRORS_SERVER=
43
 UTILS_REPOS=
46
 UTILS_REPOS=
120
 
123
 
121
 function update_installed_apps_repos {
124
 function update_installed_apps_repos {
122
     INSTALLED_APPS_REPOS=()
125
     INSTALLED_APPS_REPOS=()
123
-    FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
124
 
126
 
125
     function_check app_is_installed
127
     function_check app_is_installed
126
 
128
 
129
+    # only deal with a single app
130
+    if [ $SYNC_SINGLE_APP ]; then
131
+        if [[ "$(app_is_installed ${SYNC_SINGLE_APP})" == "1" ]]; then
132
+            filename=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${SYNC_SINGLE_APP}
133
+            APP_REPOS=($(cat ${MAIN_COMMAND} $filename | grep "_REPO=\"" | grep -v "(cat " | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g'))
134
+            for line in "${APP_REPOS[@]}"
135
+            do
136
+                INSTALLED_APPS_REPOS+=("${line}")
137
+            done
138
+        fi
139
+        return
140
+    fi
141
+
142
+    # all apps currently installed
143
+    FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-*
144
+
127
     # for all the app scripts
145
     # for all the app scripts
128
     for filename in $FILES
146
     for filename in $FILES
129
     do
147
     do
203
 }
221
 }
204
 
222
 
205
 function sync_mirrors_repos {
223
 function sync_mirrors_repos {
206
-    sync_mirrors_base "${UTILS_REPOS[@]}"
224
+    if [ ! $SYNC_SINGLE_APP ]; then
225
+        sync_mirrors_base "${UTILS_REPOS[@]}"
226
+    fi
207
     sync_mirrors_base "${INSTALLED_APPS_REPOS[@]}"
227
     sync_mirrors_base "${INSTALLED_APPS_REPOS[@]}"
208
 }
228
 }
209
 
229
 
238
     shift
258
     shift
239
     FRIENDS_MIRRORS_SSH_PORT=${1}
259
     FRIENDS_MIRRORS_SSH_PORT=${1}
240
     ;;
260
     ;;
261
+    -a|--app)
262
+    shift
263
+    SYNC_SINGLE_APP="${1}"
264
+    ;;
241
     *)
265
     *)
242
     # unknown option
266
     # unknown option
243
     ;;
267
     ;;