From bd597a933a4e59f07035127a34077793a0095f45 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 3 Nov 2016 11:44:11 +0000 Subject: [PATCH] Option to mirror a single app --- man/freedombone-mirrors.1.gz | Bin 811 -> 846 bytes src/freedombone-mirrors | 28 ++++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/man/freedombone-mirrors.1.gz b/man/freedombone-mirrors.1.gz index 0c929f9fe0f0f2b744e34dc701b320eb8e5918e9..45a8b8eaaf418a045047e69411e75decf0ace03a 100644 GIT binary patch literal 846 zcmV-U1F`%ciwFS6A{$r$1FclwkJ?5Me)nH7@=IO{G*>A~QPl>LE6|1mVaVxniK4MR zwl~;2*6#W^r2g?8uYH75X`X@*Kh`_neBaDBGu+N0Gejv@F>4xB${02lUP5^F3jRV3 zS3kde6+$TQKfm3Boh9?a!V-0ZWf%m*Xb$1cWO*G1m*74PV9wS-t{fPu*}|bvNdc}P zs11Lm#6e0m>C^)29xl4OS*@c*bQy9mut%N1y_}=cqsEkuvM2R5lZ zt>C^oUV1Rlbb$LK*?%;*f3X&z_CsSupL;s*uA{e`#d^C~-GsrmQ1(B}o0>Hs=%$Lv z0B1mtj*Q0gn{MS;_z8PR8e>SiQV2<9o=|m4=OD&-P>C>&kEgS?%~nd;_g<6=qEzUh zA?8PD6IHnHZ&rX0s7j1WFO=oTKqIgsUg`tV7sItt=m@Zpr`o9monk%gJGF}@Gcn>; zs$|Gt)52LfC7rP3+RpSkea*a&M1e^*h~uDjYw}*$RvR;-BU0rU!Dhr{$j$~87?J2Q|ZN>CC^0< zgv+}x%f)81+C*R0lPJ1fZQg}2GR$st#%`Eod2n9AQ%2u#gl^1a1)Oh%w)bSdtF;^2 zQ*;*r-4J&Je45K3SY+OM6{fz2^r$*Now^q{(l!(uic!QtEzfq8TP`tL83I3$smd}k zom-#hZQTQy`YH#*X}1Xiu3I<#C>i~Fk?qpkbGne7~<)@Fg!5mAF8V3PBSoaV52pC5TcC*A0Rr zxg@XR-4b_4%L4N8T^?!0Mx3__0wf%7cV}j281EKPSj3!kN(M(-SxeTzD~K*$!=KW? z#miT(BZ&C>$M<`%cW7TYSV_~$IuasI77$%cSC^4^uH8Q)SdjBjDi0PLa&W9vR)Mb& z8cY9T<{`%hP40lq&@Q>TT5pnN@_ftD$em0Ew|p*@8Mn6n0;2|Q3#&q#hkK25?npN0 zry6ec>A43ZgGabMq5Ed&%P{@pW%6OW-0YU?t4QoB<$eI#He^78X?2Pgr~th8XpOAD z(^Q@q4ugfPwHA%9c|HrlKU_OkzG~ALt}E$56|4q1d|G%!i{J^eN}3XX0kTjM$fG=k z|0zORQ+B`{lmSN?K}%y8POtA#I`hH-4ORdS@!H%_m&>|zvbvaa6Hx5qJ zcDK2?CLXU$&zRw}S4anX4Am=B0{h@jWsEdEozJ?hI;jUL9aHYe3LOokbPwGiEf2#@ z4f0N^TBda%N_=FY<+e^iu$zr%>7_;(< zH{sBCn;Ccp&4O*1LFnE=&9RVeJ#1_u1n}n>#|d%6x@6qEU`2ZC4i@SQfTEi|%qn>>M5~*xtL1jP-X>o+(OG5i|YUePWtNRM*!_^1toEIUMMevB0c@P`#RloSN%xTN|O7;tH zlvmy1>>}1-Nu^`AhUDa`DA4w{dOEjTGsrxsEaF+8P(e+%_Wz5<5PMGj;G@}o&hMHn zyTE#8P&$yl8(w+exXE~2_HpH`jG07bv&V}WE9csCtLc8XSZ^aSqZC%;y_Fi?rj)+7 zloI>b#qA;X^t*^tD>n1Zc)poW;Bxxgn~Td|--Oed@*16!B~D-pYy^l ps!#OyE_cm`!(XU&WcTQjPoe4>(@6l#c%RM^{{iUc3Zd%-003Z1kM#fm diff --git a/src/freedombone-mirrors b/src/freedombone-mirrors index 11511b33..ee422b54 100755 --- a/src/freedombone-mirrors +++ b/src/freedombone-mirrors @@ -38,6 +38,9 @@ MINIMUM_PASSWORD_LENGTH=$(cat /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-u 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 FRIENDS_MIRRORS_SERVER= UTILS_REPOS= @@ -120,10 +123,25 @@ function enable_mirrors_via_onion { function update_installed_apps_repos { INSTALLED_APPS_REPOS=() - FILES=/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-* 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 filename in $FILES do @@ -203,7 +221,9 @@ function sync_mirrors_base { } 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[@]}" } @@ -238,6 +258,10 @@ case $key in shift FRIENDS_MIRRORS_SSH_PORT=${1} ;; + -a|--app) + shift + SYNC_SINGLE_APP="${1}" + ;; *) # unknown option ;;