Hex Artifact Content
Not logged in

Artifact eca87c8b9631aeaf158b2d17ef7635be5861d5a1:


0000: 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 62  #!/usr/bin/env b
0010: 61 73 68 0a 23 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ash.#===========
0020: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0050: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a  ===============.
0060: 23 20 49 6e 69 74 69 61 6c 20 61 75 74 68 6f 72  # Initial author
0070: 3a 20 4d 61 72 74 69 6e 2e 56 61 68 69 40 73 6f  : Martin.Vahi@so
0080: 66 74 66 31 2e 63 6f 6d 0a 23 20 54 68 69 73 20  ftf1.com.# This 
0090: 66 69 6c 65 20 69 73 20 69 6e 20 70 75 62 6c 69  file is in publi
00a0: 63 20 64 6f 6d 61 69 6e 2e 0a 23 3d 3d 3d 3d 3d  c domain..#=====
00b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
00c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
00d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
00e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
00f0: 3d 3d 3d 3d 3d 0a 53 5f 46 50 5f 44 49 52 3d 22  =====.S_FP_DIR="
0100: 24 28 20 63 64 20 22 24 28 20 64 69 72 6e 61 6d  $( cd "$( dirnam
0110: 65 20 22 24 7b 42 41 53 48 5f 53 4f 55 52 43 45  e "${BASH_SOURCE
0120: 5b 30 5d 7d 22 20 29 22 20 26 26 20 70 77 64 20  [0]}" )" && pwd 
0130: 29 22 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  )".#------------
0140: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0150: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 23  --------------.#
0180: 20 46 6f 72 20 63 6f 70 79 2d 70 61 73 74 69 6e   For copy-pastin
0190: 67 20 74 6f 20 74 68 65 20 7e 2f 2e 62 61 73 68  g to the ~/.bash
01a0: 72 63 0a 23 0a 23 20 20 20 20 20 61 6c 69 61 73  rc.#.#     alias
01b0: 20 6d 6d 6d 76 5f 63 72 65 5f 67 69 74 5f 63 6c   mmmv_cre_git_cl
01c0: 6f 6e 65 3d 22 63 70 20 24 50 41 54 48 5f 54 4f  one="cp $PATH_TO
01d0: 5f 54 48 45 3c 24 53 5f 46 50 5f 44 49 52 3e 2f  _THE<$S_FP_DIR>/
01e0: 70 75 6c 6c 5f 6e 65 77 5f 76 65 72 73 69 6f 6e  pull_new_version
01f0: 5f 66 72 6f 6d 5f 67 69 74 5f 72 65 70 6f 73 69  _from_git_reposi
0200: 74 6f 72 79 20 2e 2f 3b 20 6d 6b 64 69 72 20 2d  tory ./; mkdir -
0210: 70 20 2e 2f 74 68 65 5f 72 65 70 6f 73 69 74 6f  p ./the_reposito
0220: 72 79 5f 63 6c 6f 6e 65 73 3b 22 0a 23 0a 23 2d  ry_clones;".#.#-
0230: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0240: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0250: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0260: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0270: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 0a 66 75 6e 5f  ---------...fun_
0280: 61 73 73 65 72 74 5f 65 78 69 73 74 73 5f 6f 6e  assert_exists_on
0290: 5f 70 61 74 68 5f 74 31 20 28 29 20 7b 0a 20 20  _path_t1 () {.  
02a0: 20 20 6c 6f 63 61 6c 20 53 5f 4e 41 4d 45 5f 4f    local S_NAME_O
02b0: 46 5f 54 48 45 5f 45 58 45 43 55 54 41 42 4c 45  F_THE_EXECUTABLE
02c0: 3d 24 31 20 23 20 66 69 72 73 74 20 66 75 6e 63  =$1 # first func
02d0: 74 69 6f 6e 20 61 72 67 75 6d 65 6e 74 0a 20 20  tion argument.  
02e0: 20 20 6c 6f 63 61 6c 20 53 5f 54 4d 50 5f 30 3d    local S_TMP_0=
02f0: 22 5c 60 77 68 69 63 68 20 24 53 5f 4e 41 4d 45  "\`which $S_NAME
0300: 5f 4f 46 5f 54 48 45 5f 45 58 45 43 55 54 41 42  _OF_THE_EXECUTAB
0310: 4c 45 20 32 3e 2f 64 65 76 2f 6e 75 6c 6c 5c 60  LE 2>/dev/null\`
0320: 22 0a 20 20 20 20 6c 6f 63 61 6c 20 53 5f 54 4d  ".    local S_TM
0330: 50 5f 31 3d 22 22 0a 20 20 20 20 6c 6f 63 61 6c  P_1="".    local
0340: 20 53 5f 54 4d 50 5f 32 3d 22 53 5f 54 4d 50 5f   S_TMP_2="S_TMP_
0350: 31 3d 24 53 5f 54 4d 50 5f 30 22 0a 20 20 20 20  1=$S_TMP_0".    
0360: 65 76 61 6c 20 24 7b 53 5f 54 4d 50 5f 32 7d 0a  eval ${S_TMP_2}.
0370: 20 20 20 20 69 66 20 5b 20 22 24 53 5f 54 4d 50      if [ "$S_TMP
0380: 5f 31 22 20 3d 3d 20 22 22 20 5d 20 3b 20 74 68  _1" == "" ] ; th
0390: 65 6e 0a 20 20 20 20 20 20 20 20 65 63 68 6f 20  en.        echo 
03a0: 22 22 0a 20 20 20 20 20 20 20 20 65 63 68 6f 20  "".        echo 
03b0: 22 54 68 69 73 20 62 61 73 68 20 73 63 72 69 70  "This bash scrip
03c0: 74 20 72 65 71 75 69 72 65 73 20 74 68 65 20 5c  t requires the \
03d0: 22 24 53 5f 4e 41 4d 45 5f 4f 46 5f 54 48 45 5f  "$S_NAME_OF_THE_
03e0: 45 58 45 43 55 54 41 42 4c 45 5c 22 20 74 6f 20  EXECUTABLE\" to 
03f0: 62 65 20 6f 6e 20 74 68 65 20 50 41 54 48 2e 22  be on the PATH."
0400: 0a 20 20 20 20 20 20 20 20 65 63 68 6f 20 22 22  .        echo ""
0410: 0a 20 20 20 20 20 20 20 20 65 78 69 74 20 31 20  .        exit 1 
0420: 23 20 65 78 69 74 20 77 69 74 68 20 65 72 72 6f  # exit with erro
0430: 72 0a 20 20 20 20 66 69 0a 7d 20 23 20 66 75 6e  r.    fi.} # fun
0440: 5f 61 73 73 65 72 74 5f 65 78 69 73 74 73 5f 6f  _assert_exists_o
0450: 6e 5f 70 61 74 68 5f 74 31 0a 0a 66 75 6e 5f 61  n_path_t1..fun_a
0460: 73 73 65 72 74 5f 65 78 69 73 74 73 5f 6f 6e 5f  ssert_exists_on_
0470: 70 61 74 68 5f 74 31 20 22 72 75 62 79 22 0a 66  path_t1 "ruby".f
0480: 75 6e 5f 61 73 73 65 72 74 5f 65 78 69 73 74 73  un_assert_exists
0490: 5f 6f 6e 5f 70 61 74 68 5f 74 31 20 22 67 72 65  _on_path_t1 "gre
04a0: 70 22 0a 66 75 6e 5f 61 73 73 65 72 74 5f 65 78  p".fun_assert_ex
04b0: 69 73 74 73 5f 6f 6e 5f 70 61 74 68 5f 74 31 20  ists_on_path_t1 
04c0: 22 64 61 74 65 22 0a 66 75 6e 5f 61 73 73 65 72  "date".fun_asser
04d0: 74 5f 65 78 69 73 74 73 5f 6f 6e 5f 70 61 74 68  t_exists_on_path
04e0: 5f 74 31 20 22 67 69 74 22 0a 0a 0a 23 2d 2d 2d  _t1 "git"...#---
04f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0500: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0530: 2d 2d 2d 2d 2d 2d 2d 0a 53 5f 54 4d 50 5f 30 3d  -------.S_TMP_0=
0540: 22 60 75 6e 61 6d 65 20 2d 61 20 7c 20 67 72 65  "`uname -a | gre
0550: 70 20 2d 45 20 5b 4c 6c 5d 69 6e 75 78 60 22 0a  p -E [Ll]inux`".
0560: 69 66 20 5b 20 22 24 53 5f 54 4d 50 5f 30 22 20  if [ "$S_TMP_0" 
0570: 3d 3d 20 22 22 20 5d 3b 20 74 68 65 6e 0a 20 20  == "" ]; then.  
0580: 20 20 53 5f 54 4d 50 5f 30 3d 22 60 75 6e 61 6d    S_TMP_0="`unam
0590: 65 20 2d 61 20 7c 20 67 72 65 70 20 2d 45 20 5b  e -a | grep -E [
05a0: 42 62 5d 5b 53 73 5d 5b 44 64 5d 60 22 0a 20 20  Bb][Ss][Dd]`".  
05b0: 20 20 69 66 20 5b 20 22 24 53 5f 54 4d 50 5f 30    if [ "$S_TMP_0
05c0: 22 20 3d 3d 20 22 22 20 5d 3b 20 74 68 65 6e 0a  " == "" ]; then.
05d0: 20 20 20 20 20 20 20 20 65 63 68 6f 20 22 22 0a          echo "".
05e0: 20 20 20 20 20 20 20 20 65 63 68 6f 20 22 20 20          echo "  
05f0: 54 68 65 20 63 6c 61 73 73 69 63 61 6c 20 63 6f  The classical co
0600: 6d 6d 61 6e 64 20 6c 69 6e 65 20 75 74 69 6c 69  mmand line utili
0610: 74 69 65 73 20 61 74 20 22 0a 20 20 20 20 20 20  ties at ".      
0620: 20 20 65 63 68 6f 20 22 20 20 64 69 66 66 65 72    echo "  differ
0630: 65 6e 74 20 6f 70 65 72 61 74 69 6e 67 20 73 79  ent operating sy
0640: 73 74 65 6d 73 2c 20 66 6f 72 20 65 78 61 6d 70  stems, for examp
0650: 6c 65 2c 20 4c 69 6e 75 78 20 61 6e 64 20 42 53  le, Linux and BS
0660: 44 2c 22 0a 20 20 20 20 20 20 20 20 65 63 68 6f  D,".        echo
0670: 20 22 20 20 64 69 66 66 65 72 2e 20 54 68 69 73   "  differ. This
0680: 20 73 63 72 69 70 74 20 69 73 20 64 65 73 69 67   script is desig
0690: 6e 65 64 20 74 6f 20 72 75 6e 20 6f 6e 6c 79 20  ned to run only 
06a0: 6f 6e 20 4c 69 6e 75 78 20 61 6e 64 20 42 53 44  on Linux and BSD
06b0: 2e 22 0a 20 20 20 20 20 20 20 20 65 63 68 6f 20  .".        echo 
06c0: 22 20 20 49 66 20 59 6f 75 20 61 72 65 20 77 69  "  If You are wi
06d0: 6c 6c 69 6e 67 20 74 6f 20 72 69 73 6b 20 74 68  lling to risk th
06e0: 61 74 20 73 6f 6d 65 20 6f 66 20 59 6f 75 72 20  at some of Your 
06f0: 64 61 74 61 20 22 0a 20 20 20 20 20 20 20 20 65  data ".        e
0700: 63 68 6f 20 22 20 20 69 73 20 64 65 6c 65 74 65  cho "  is delete
0710: 64 20 61 6e 64 2f 6f 72 20 59 6f 75 72 20 6f 70  d and/or Your op
0720: 65 72 61 74 69 6e 67 20 73 79 73 74 65 6d 20 69  erating system i
0730: 6e 73 74 61 6e 63 65 22 0a 20 20 20 20 20 20 20  nstance".       
0740: 20 65 63 68 6f 20 22 20 20 62 65 63 6f 6d 65 73   echo "  becomes
0750: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 66 6c 61   permanently fla
0760: 77 65 64 2c 20 74 6f 20 74 68 65 20 70 6f 69 6e  wed, to the poin
0770: 74 20 74 68 61 74 20 22 0a 20 20 20 20 20 20 20  t that ".       
0780: 20 65 63 68 6f 20 22 20 20 69 74 20 77 69 6c 6c   echo "  it will
0790: 20 6e 6f 74 20 65 76 65 6e 20 62 6f 6f 74 2c 20   not even boot, 
07a0: 74 68 65 6e 20 59 6f 75 20 6d 61 79 20 65 64 69  then You may edi
07b0: 74 20 74 68 65 20 42 61 73 68 20 73 63 72 69 70  t the Bash scrip
07c0: 74 20 74 68 61 74 20 22 0a 20 20 20 20 20 20 20  t that ".       
07d0: 20 65 63 68 6f 20 22 20 20 64 69 73 70 6c 61 79   echo "  display
07e0: 73 20 74 68 69 73 20 65 72 72 6f 72 20 6d 65 73  s this error mes
07f0: 73 61 67 65 20 62 79 20 6d 6f 64 69 66 79 69 6e  sage by modifyin
0800: 67 20 74 68 65 20 74 65 73 74 20 74 68 61 74 20  g the test that 
0810: 22 0a 20 20 20 20 20 20 20 20 65 63 68 6f 20 22  ".        echo "
0820: 20 20 63 68 65 63 6b 73 20 66 6f 72 20 74 68 65    checks for the
0830: 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74 65   operating syste
0840: 6d 20 74 79 70 65 2e 22 0a 20 20 20 20 20 20 20  m type.".       
0850: 20 65 63 68 6f 20 22 22 0a 20 20 20 20 20 20 20   echo "".       
0860: 20 65 63 68 6f 20 22 20 20 49 66 20 59 6f 75 20   echo "  If You 
0870: 64 6f 20 64 65 63 69 64 65 20 74 6f 20 65 64 69  do decide to edi
0880: 74 20 74 68 69 73 20 42 61 73 68 20 73 63 72 69  t this Bash scri
0890: 70 74 2c 20 74 68 65 6e 20 22 0a 20 20 20 20 20  pt, then ".     
08a0: 20 20 20 65 63 68 6f 20 22 20 20 61 20 72 65 63     echo "  a rec
08b0: 6f 6d 6d 65 6e 64 61 74 69 6f 6e 20 69 73 20 74  ommendation is t
08c0: 6f 20 74 65 73 74 20 59 6f 75 72 20 6d 6f 64 69  o test Your modi
08d0: 66 69 63 61 74 69 6f 6e 73 20 22 0a 20 20 20 20  fications ".    
08e0: 20 20 20 20 65 63 68 6f 20 22 20 20 77 69 74 68      echo "  with
08f0: 69 6e 20 61 20 76 69 72 74 75 61 6c 20 6d 61 63  in a virtual mac
0900: 68 69 6e 65 20 6f 72 2c 20 69 66 20 76 69 72 74  hine or, if virt
0910: 75 61 6c 20 6d 61 63 68 69 6e 65 73 20 61 72 65  ual machines are
0920: 20 6e 6f 74 22 0a 20 20 20 20 20 20 20 20 65 63   not".        ec
0930: 68 6f 20 22 20 20 61 6e 20 6f 70 74 69 6f 6e 2c  ho "  an option,
0940: 20 61 73 20 73 6f 6d 65 20 6e 65 77 20 6f 70 65   as some new ope
0950: 72 61 74 69 6e 67 20 73 79 73 74 65 6d 20 75 73  rating system us
0960: 65 72 20 74 68 61 74 20 64 6f 65 73 20 6e 6f 74  er that does not
0970: 20 68 61 76 65 20 22 0a 20 20 20 20 20 20 20 20   have ".        
0980: 65 63 68 6f 20 22 20 20 61 6e 79 20 61 63 63 65  echo "  any acce
0990: 73 73 20 74 6f 20 74 68 65 20 76 69 74 61 6c 20  ss to the vital 
09a0: 64 61 74 61 2f 66 69 6c 65 73 2e 22 0a 20 20 20  data/files.".   
09b0: 20 20 20 20 20 65 63 68 6f 20 22 20 20 47 55 49       echo "  GUI
09c0: 44 3d 3d 27 37 39 37 66 66 38 34 36 2d 64 31 63  D=='797ff846-d1c
09d0: 31 2d 34 36 34 64 2d 61 31 33 62 2d 65 32 31 31  1-464d-a13b-e211
09e0: 33 30 36 31 33 31 65 37 27 22 0a 20 20 20 20 20  306131e7'".     
09f0: 20 20 20 65 63 68 6f 20 22 22 0a 20 20 20 20 20     echo "".     
0a00: 20 20 20 65 63 68 6f 20 22 20 20 41 62 6f 72 74     echo "  Abort
0a10: 69 6e 67 20 73 63 72 69 70 74 20 77 69 74 68 6f  ing script witho
0a20: 75 74 20 64 6f 69 6e 67 20 61 6e 79 74 68 69 6e  ut doing anythin
0a30: 67 2e 22 0a 20 20 20 20 20 20 20 20 65 63 68 6f  g.".        echo
0a40: 20 22 22 0a 20 20 20 20 20 20 20 20 65 78 69 74   "".        exit
0a50: 20 31 20 23 20 65 78 69 74 20 77 69 74 68 20 65   1 # exit with e
0a60: 72 72 6f 72 0a 20 20 20 20 66 69 0a 66 69 0a 0a  rror.    fi.fi..
0a70: 0a 23 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  .#--------------
0a80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0a90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0aa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 53 5f  ------------..S_
0ac0: 54 49 4d 45 53 54 41 4d 50 3d 22 60 64 61 74 65  TIMESTAMP="`date
0ad0: 20 2b 25 59 60 5f 60 64 61 74 65 20 2b 25 6d 60   +%Y`_`date +%m`
0ae0: 5f 60 64 61 74 65 20 2b 25 64 60 5f 54 5f 60 64  _`date +%d`_T_`d
0af0: 61 74 65 20 2b 25 48 60 68 5f 60 64 61 74 65 20  ate +%H`h_`date 
0b00: 2b 25 4d 60 6d 69 6e 5f 60 64 61 74 65 20 2b 25  +%M`min_`date +%
0b10: 53 60 73 22 0a 53 5f 46 50 5f 41 52 43 48 49 56  S`s".S_FP_ARCHIV
0b20: 45 3d 22 24 53 5f 46 50 5f 44 49 52 2f 61 72 63  E="$S_FP_DIR/arc
0b30: 68 69 76 65 73 2f 24 53 5f 54 49 4d 45 53 54 41  hives/$S_TIMESTA
0b40: 4d 50 22 0a 53 5f 46 50 5f 54 48 45 5f 52 45 50  MP".S_FP_THE_REP
0b50: 4f 53 49 54 4f 52 59 5f 43 4c 4f 4e 45 53 3d 22  OSITORY_CLONES="
0b60: 24 53 5f 46 50 5f 44 49 52 2f 74 68 65 5f 72 65  $S_FP_DIR/the_re
0b70: 70 6f 73 69 74 6f 72 79 5f 63 6c 6f 6e 65 73 22  pository_clones"
0b80: 0a 6d 6b 64 69 72 20 2d 70 20 24 53 5f 46 50 5f  .mkdir -p $S_FP_
0b90: 54 48 45 5f 52 45 50 4f 53 49 54 4f 52 59 5f 43  THE_REPOSITORY_C
0ba0: 4c 4f 4e 45 53 0a 0a 23 2d 2d 2d 2d 2d 2d 2d 2d  LONES..#--------
0bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0bc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0bd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0be0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0bf0: 2d 2d 0a 53 5f 41 52 47 56 5f 30 3d 22 24 31 22  --.S_ARGV_0="$1"
0c00: 0a 53 42 5f 53 4b 49 50 5f 41 52 43 48 49 56 49  .SB_SKIP_ARCHIVI
0c10: 4e 47 3d 22 66 22 0a 0a 66 75 6e 5f 69 6e 69 74  NG="f"..fun_init
0c20: 5f 73 62 5f 61 72 63 68 69 76 65 5f 61 6e 64 5f  _sb_archive_and_
0c30: 61 72 63 68 69 76 65 73 5f 66 6f 6c 64 65 72 28  archives_folder(
0c40: 29 7b 0a 20 20 20 20 23 2d 2d 2d 2d 2d 2d 2d 2d  ){.    #--------
0c50: 0a 20 20 20 20 69 66 20 5b 20 22 24 53 5f 41 52  .    if [ "$S_AR
0c60: 47 56 5f 30 22 20 3d 3d 20 22 73 6b 69 70 5f 61  GV_0" == "skip_a
0c70: 72 63 68 69 76 69 6e 67 22 20 5d 3b 20 74 68 65  rchiving" ]; the
0c80: 6e 20 0a 20 20 20 20 20 20 20 20 53 42 5f 53 4b  n .        SB_SK
0c90: 49 50 5f 41 52 43 48 49 56 49 4e 47 3d 22 74 22  IP_ARCHIVING="t"
0ca0: 0a 20 20 20 20 66 69 0a 20 20 20 20 69 66 20 5b  .    fi.    if [
0cb0: 20 22 24 53 5f 41 52 47 56 5f 30 22 20 3d 3d 20   "$S_ARGV_0" == 
0cc0: 22 73 6b 61 22 20 5d 3b 20 74 68 65 6e 20 23 20  "ska" ]; then # 
0cd0: 61 62 62 72 65 76 69 61 74 69 6f 6e 20 6f 66 20  abbreviation of 
0ce0: 22 73 6b 69 70 20 61 72 63 68 69 76 69 6e 67 22  "skip archiving"
0cf0: 0a 20 20 20 20 20 20 20 20 53 42 5f 53 4b 49 50  .        SB_SKIP
0d00: 5f 41 52 43 48 49 56 49 4e 47 3d 22 74 22 0a 20  _ARCHIVING="t". 
0d10: 20 20 20 66 69 0a 20 20 20 20 23 2d 2d 2d 2d 2d     fi.    #-----
0d20: 2d 2d 2d 0a 20 20 20 20 69 66 20 5b 20 22 24 53  ---.    if [ "$S
0d30: 42 5f 53 4b 49 50 5f 41 52 43 48 49 56 49 4e 47  B_SKIP_ARCHIVING
0d40: 22 20 21 3d 20 22 74 22 20 5d 3b 20 74 68 65 6e  " != "t" ]; then
0d50: 20 0a 20 20 20 20 20 20 20 20 6d 6b 64 69 72 20   .        mkdir 
0d60: 2d 70 20 24 53 5f 46 50 5f 41 52 43 48 49 56 45  -p $S_FP_ARCHIVE
0d70: 0a 20 20 20 20 66 69 0a 20 20 20 20 23 2d 2d 2d  .    fi.    #---
0d80: 2d 2d 2d 2d 2d 0a 7d 20 23 20 66 75 6e 5f 69 6e  -----.} # fun_in
0d90: 69 74 5f 73 62 5f 61 72 63 68 69 76 65 5f 61 6e  it_sb_archive_an
0da0: 64 5f 61 72 63 68 69 76 65 73 5f 66 6f 6c 64 65  d_archives_folde
0db0: 72 0a 0a 66 75 6e 5f 69 6e 69 74 5f 73 62 5f 61  r..fun_init_sb_a
0dc0: 72 63 68 69 76 65 5f 61 6e 64 5f 61 72 63 68 69  rchive_and_archi
0dd0: 76 65 73 5f 66 6f 6c 64 65 72 0a 0a 23 2d 2d 2d  ves_folder..#---
0de0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0e20: 2d 2d 2d 2d 2d 2d 2d 0a 0a 41 52 5f 52 45 50 4f  -------..AR_REPO
0e30: 5f 46 4f 4c 44 45 52 5f 4e 41 4d 45 53 3d 28 29  _FOLDER_NAMES=()
0e40: 0a 0a 66 75 6e 5f 61 73 73 65 6d 62 6c 65 5f 61  ..fun_assemble_a
0e50: 72 72 61 79 5f 6f 66 5f 72 65 70 6f 73 69 74 6f  rray_of_reposito
0e60: 72 79 5f 63 6c 6f 6e 65 5f 66 6f 6c 64 65 72 5f  ry_clone_folder_
0e70: 6e 61 6d 65 73 20 28 29 20 7b 0a 20 20 20 20 63  names () {.    c
0e80: 64 20 24 53 5f 46 50 5f 54 48 45 5f 52 45 50 4f  d $S_FP_THE_REPO
0e90: 53 49 54 4f 52 59 5f 43 4c 4f 4e 45 53 0a 20 20  SITORY_CLONES.  
0ea0: 20 20 6c 6f 63 61 6c 20 53 5f 54 4d 50 5f 30 3d    local S_TMP_0=
0eb0: 22 60 72 75 62 79 20 2d 65 20 5c 22 61 72 3d 41  "`ruby -e \"ar=A
0ec0: 72 72 61 79 2e 6e 65 77 3b 20 44 69 72 2e 67 6c  rray.new; Dir.gl
0ed0: 6f 62 28 27 2a 27 29 2e 65 61 63 68 7b 7c 78 7c  ob('*').each{|x|
0ee0: 20 69 66 20 46 69 6c 65 2e 64 69 72 65 63 74 6f   if File.directo
0ef0: 72 79 3f 20 78 20 74 68 65 6e 20 61 72 3c 3c 78  ry? x then ar<<x
0f00: 20 65 6e 64 7d 3b 20 70 75 74 73 28 61 72 2e 74   end}; puts(ar.t
0f10: 6f 5f 73 2e 67 73 75 62 28 27 5b 27 2c 27 28 27  o_s.gsub('[','('
0f20: 29 2e 67 73 75 62 28 27 5d 27 2c 27 29 27 29 2e  ).gsub(']',')').
0f30: 67 73 75 62 28 27 2c 27 2c 27 20 27 29 29 5c 22  gsub(',',' '))\"
0f40: 60 22 0a 20 20 20 20 63 64 20 24 53 5f 46 50 5f  `".    cd $S_FP_
0f50: 44 49 52 0a 20 20 20 20 6c 6f 63 61 6c 20 53 5f  DIR.    local S_
0f60: 54 4d 50 5f 31 3d 22 41 52 5f 52 45 50 4f 5f 46  TMP_1="AR_REPO_F
0f70: 4f 4c 44 45 52 5f 4e 41 4d 45 53 3d 24 53 5f 54  OLDER_NAMES=$S_T
0f80: 4d 50 5f 30 22 0a 20 20 20 20 65 76 61 6c 20 24  MP_0".    eval $
0f90: 7b 53 5f 54 4d 50 5f 31 7d 0a 7d 20 23 20 66 75  {S_TMP_1}.} # fu
0fa0: 6e 5f 61 73 73 65 6d 62 6c 65 5f 61 72 72 61 79  n_assemble_array
0fb0: 5f 6f 66 5f 72 65 70 6f 73 69 74 6f 72 79 5f 63  _of_repository_c
0fc0: 6c 6f 6e 65 5f 66 6f 6c 64 65 72 5f 6e 61 6d 65  lone_folder_name
0fd0: 73 20 0a 0a 66 75 6e 5f 61 73 73 65 6d 62 6c 65  s ..fun_assemble
0fe0: 5f 61 72 72 61 79 5f 6f 66 5f 72 65 70 6f 73 69  _array_of_reposi
0ff0: 74 6f 72 79 5f 63 6c 6f 6e 65 5f 66 6f 6c 64 65  tory_clone_folde
1000: 72 5f 6e 61 6d 65 73 20 0a 0a 0a 66 75 6e 5f 75  r_names ...fun_u
1010: 70 64 61 74 65 20 28 29 20 7b 0a 20 20 20 20 23  pdate () {.    #
1020: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20 6c 6f 63  --------.    loc
1030: 61 6c 20 53 5f 46 50 5f 46 55 4e 43 5f 55 50 44  al S_FP_FUNC_UPD
1040: 41 54 45 5f 4f 52 49 47 3d 22 60 70 77 64 60 22  ATE_ORIG="`pwd`"
1050: 0a 20 20 20 20 23 2d 2d 2d 2d 2d 2d 2d 2d 0a 20  .    #--------. 
1060: 20 20 20 66 6f 72 20 73 5f 69 74 65 72 20 69 6e     for s_iter in
1070: 20 24 7b 41 52 5f 52 45 50 4f 5f 46 4f 4c 44 45   ${AR_REPO_FOLDE
1080: 52 5f 4e 41 4d 45 53 5b 40 5d 7d 3b 20 64 6f 0a  R_NAMES[@]}; do.
1090: 20 20 20 20 20 20 20 20 20 53 5f 46 4f 4c 44 45           S_FOLDE
10a0: 52 5f 4e 41 4d 45 5f 4f 46 5f 54 48 45 5f 4c 4f  R_NAME_OF_THE_LO
10b0: 43 41 4c 5f 43 4f 50 59 3d 22 24 73 5f 69 74 65  CAL_COPY="$s_ite
10c0: 72 22 0a 20 20 20 20 20 20 20 20 20 65 63 68 6f  r".         echo
10d0: 20 22 22 0a 20 20 20 20 20 20 20 20 20 23 2d 2d   "".         #--
10e0: 2d 2d 0a 20 20 20 20 20 20 20 20 20 69 66 20 5b  --.         if [
10f0: 20 22 24 53 42 5f 53 4b 49 50 5f 41 52 43 48 49   "$SB_SKIP_ARCHI
1100: 56 49 4e 47 22 20 21 3d 20 22 74 22 20 5d 3b 20  VING" != "t" ]; 
1110: 74 68 65 6e 20 0a 20 20 20 20 20 20 20 20 20 20  then .          
1120: 20 20 20 65 63 68 6f 20 22 20 20 20 20 20 20 20     echo "       
1130: 20 20 20 20 20 41 72 63 68 69 76 69 6e 67 20 61       Archiving a
1140: 20 63 6f 70 79 20 6f 66 20 24 53 5f 46 4f 4c 44   copy of $S_FOLD
1150: 45 52 5f 4e 41 4d 45 5f 4f 46 5f 54 48 45 5f 4c  ER_NAME_OF_THE_L
1160: 4f 43 41 4c 5f 43 4f 50 59 22 0a 20 20 20 20 20  OCAL_COPY".     
1170: 20 20 20 20 20 20 20 20 63 70 20 2d 66 20 2d 52          cp -f -R
1180: 20 24 53 5f 46 50 5f 54 48 45 5f 52 45 50 4f 53   $S_FP_THE_REPOS
1190: 49 54 4f 52 59 5f 43 4c 4f 4e 45 53 2f 24 53 5f  ITORY_CLONES/$S_
11a0: 46 4f 4c 44 45 52 5f 4e 41 4d 45 5f 4f 46 5f 54  FOLDER_NAME_OF_T
11b0: 48 45 5f 4c 4f 43 41 4c 5f 43 4f 50 59 20 24 53  HE_LOCAL_COPY $S
11c0: 5f 46 50 5f 41 52 43 48 49 56 45 2f 0a 20 20 20  _FP_ARCHIVE/.   
11d0: 20 20 20 20 20 20 65 6c 73 65 0a 20 20 20 20 20        else.     
11e0: 20 20 20 20 20 20 20 20 65 63 68 6f 20 22 20 20          echo "  
11f0: 20 20 20 20 20 20 20 20 20 20 53 6b 69 70 70 69            Skippi
1200: 6e 67 20 74 68 65 20 61 72 63 68 69 76 69 6e 67  ng the archiving
1210: 20 61 20 63 6f 70 79 20 6f 66 20 24 53 5f 46 4f   a copy of $S_FO
1220: 4c 44 45 52 5f 4e 41 4d 45 5f 4f 46 5f 54 48 45  LDER_NAME_OF_THE
1230: 5f 4c 4f 43 41 4c 5f 43 4f 50 59 22 0a 20 20 20  _LOCAL_COPY".   
1240: 20 20 20 20 20 20 66 69 0a 20 20 20 20 20 20 20        fi.       
1250: 20 20 23 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20    #----.        
1260: 20 63 64 20 24 53 5f 46 50 5f 54 48 45 5f 52 45   cd $S_FP_THE_RE
1270: 50 4f 53 49 54 4f 52 59 5f 43 4c 4f 4e 45 53 2f  POSITORY_CLONES/
1280: 24 53 5f 46 4f 4c 44 45 52 5f 4e 41 4d 45 5f 4f  $S_FOLDER_NAME_O
1290: 46 5f 54 48 45 5f 4c 4f 43 41 4c 5f 43 4f 50 59  F_THE_LOCAL_COPY
12a0: 0a 20 20 20 20 20 20 20 20 20 65 63 68 6f 20 22  .         echo "
12b0: 43 68 65 63 6b 69 6e 67 20 6f 75 74 20 61 20 6e  Checking out a n
12c0: 65 77 65 72 20 76 65 72 73 69 6f 6e 20 6f 66 20  ewer version of 
12d0: 24 53 5f 46 4f 4c 44 45 52 5f 4e 41 4d 45 5f 4f  $S_FOLDER_NAME_O
12e0: 46 5f 54 48 45 5f 4c 4f 43 41 4c 5f 43 4f 50 59  F_THE_LOCAL_COPY
12f0: 22 0a 20 20 20 20 20 20 20 20 20 23 2d 2d 2d 2d  ".         #----
1300: 2d 2d 2d 2d 0a 20 20 20 20 20 20 20 20 20 23 20  ----.         # 
1310: 44 6f 77 6e 6c 6f 61 64 73 20 74 68 65 20 6e 65  Downloads the ne
1320: 77 65 73 74 20 76 65 72 73 69 6f 6e 20 6f 66 20  west version of 
1330: 74 68 65 20 73 6f 66 74 77 61 72 65 20 74 6f 20  the software to 
1340: 74 68 61 74 20 66 6f 6c 64 65 72 2e 0a 20 20 20  that folder..   
1350: 20 20 20 20 20 20 67 69 74 20 63 68 65 63 6b 6f        git checko
1360: 75 74 20 2d 2d 66 6f 72 63 65 20 23 20 6f 76 65  ut --force # ove
1370: 72 77 72 69 74 65 73 20 6c 6f 63 61 6c 20 63 68  rwrites local ch
1380: 61 6e 67 65 73 2c 20 6c 69 6b 65 20 74 68 65 20  anges, like the 
1390: 22 73 76 6e 20 63 6f 22 0a 20 20 20 20 20 20 20  "svn co".       
13a0: 20 20 67 69 74 20 70 75 6c 6c 20 2d 2d 61 6c 6c    git pull --all
13b0: 20 2d 2d 72 65 63 75 72 73 65 2d 73 75 62 6d 6f   --recurse-submo
13c0: 64 75 6c 65 73 20 2d 2d 66 6f 72 63 65 20 23 20  dules --force # 
13d0: 67 65 74 73 20 74 68 65 20 73 75 62 6d 6f 64 75  gets the submodu
13e0: 6c 65 73 0a 20 20 20 20 20 20 20 20 20 23 2d 2d  les.         #--
13f0: 2d 2d 0a 20 20 20 20 20 20 20 20 20 23 20 68 74  --.         # ht
1400: 74 70 3a 2f 2f 73 74 61 63 6b 6f 76 65 72 66 6c  tp://stackoverfl
1410: 6f 77 2e 63 6f 6d 2f 71 75 65 73 74 69 6f 6e 73  ow.com/questions
1420: 2f 31 30 33 30 31 36 39 2f 65 61 73 79 2d 77 61  /1030169/easy-wa
1430: 79 2d 70 75 6c 6c 2d 6c 61 74 65 73 74 2d 6f 66  y-pull-latest-of
1440: 2d 61 6c 6c 2d 73 75 62 6d 6f 64 75 6c 65 73 0a  -all-submodules.
1450: 20 20 20 20 20 20 20 20 20 67 69 74 20 73 75 62           git sub
1460: 6d 6f 64 75 6c 65 20 75 70 64 61 74 65 20 2d 2d  module update --
1470: 69 6e 69 74 20 2d 2d 72 65 63 75 72 73 69 76 65  init --recursive
1480: 20 2d 2d 66 6f 72 63 65 0a 20 20 20 20 20 20 20   --force.       
1490: 20 20 23 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 20 20    #--------.    
14a0: 20 20 20 20 20 63 64 20 24 53 5f 46 50 5f 44 49       cd $S_FP_DI
14b0: 52 0a 20 20 20 20 64 6f 6e 65 0a 20 20 20 20 63  R.    done.    c
14c0: 64 20 24 53 5f 46 50 5f 46 55 4e 43 5f 55 50 44  d $S_FP_FUNC_UPD
14d0: 41 54 45 5f 4f 52 49 47 0a 7d 20 23 20 66 75 6e  ATE_ORIG.} # fun
14e0: 5f 75 70 64 61 74 65 20 0a 0a 66 75 6e 5f 75 70  _update ..fun_up
14f0: 64 61 74 65 20 23 20 69 73 20 61 20 63 61 6c 6c  date # is a call
1500: 20 74 6f 20 74 68 65 20 66 75 6e 63 74 69 6f 6e   to the function
1510: 0a 65 63 68 6f 20 22 22 0a 0a 23 3d 3d 3d 3d 3d  .echo ""..#=====
1520: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1530: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1540: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1550: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
1560: 3d 3d 3d 3d 3d 0a 0a                             =====..