tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

use_config_env.sh (2932B)


      1 #!/bin/bash
      2 
      3 function find_repo_type()
      4 {
      5  if [ -d ".git" ]; then
      6      MOZ_REPO="git"
      7  elif [ -d ".hg" ]; then
      8      MOZ_REPO="hg"
      9  else
     10    echo "Unable to detect repo (git or hg)"
     11    exit 1
     12  fi
     13 }
     14 export -f find_repo_type
     15 
     16 
     17 # Assume that if STATE_DIR is already defined, we do not need to
     18 # execute this file again.
     19 if [ "x$STATE_DIR" != "x" ]; then
     20  # no need to run script since we've already run
     21  return
     22 fi
     23 
     24 export SCRIPT_DIR="dom/media/webrtc/third_party_build"
     25 # first, make sure we're running from the top of moz-central repo
     26 if [ ! -d $SCRIPT_DIR ]; then
     27  echo "Error: unable to find directory $SCRIPT_DIR"
     28  exit 1
     29 fi
     30 
     31 # Should we tie the location of the STATE_DIR to the path
     32 # in MOZ_CONFIG_PATH?  Probably.
     33 export STATE_DIR=`pwd`/.moz-fast-forward
     34 export LOG_DIR=$STATE_DIR/logs
     35 export TMP_DIR=$STATE_DIR/tmp
     36 
     37 if [ ! -d $STATE_DIR ]; then
     38  echo "Creating missing $STATE_DIR"
     39  mkdir -p $STATE_DIR
     40  if [ ! -d $STATE_DIR ]; then
     41    echo "error: unable to find (or create) $STATE_DIR"
     42    exit 1
     43  fi
     44 fi
     45 echo "Using STATE_DIR=$STATE_DIR"
     46 
     47 if [ ! -d $LOG_DIR ]; then
     48  echo "Creating missing $LOG_DIR"
     49  mkdir -p $LOG_DIR
     50  if [ ! -d $LOG_DIR ]; then
     51    echo "error: unable to find (or create) $LOG_DIR"
     52    exit 1
     53  fi
     54 fi
     55 echo "Using LOG_DIR=$LOG_DIR"
     56 
     57 if [ ! -d $TMP_DIR ]; then
     58  echo "Creating missing $TMP_DIR"
     59  mkdir -p $TMP_DIR
     60  if [ ! -d $TMP_DIR ]; then
     61    echo "error: unable to find (or create) $TMP_DIR"
     62    exit 1
     63  fi
     64 fi
     65 echo "Using TMP_DIR=$TMP_DIR"
     66 
     67 # Allow user to override default path to config_env
     68 if [ "x$MOZ_CONFIG_PATH" = "x" ]; then
     69  MOZ_CONFIG_PATH=$STATE_DIR/config_env
     70  echo "Using default MOZ_CONFIG_PATH=$MOZ_CONFIG_PATH"
     71 fi
     72 
     73 if [ ! -f $MOZ_CONFIG_PATH ]; then
     74  echo "Creating default config file at $MOZ_CONFIG_PATH"
     75  cp $SCRIPT_DIR/default_config_env $MOZ_CONFIG_PATH
     76 fi
     77 source $MOZ_CONFIG_PATH
     78 
     79 
     80 function find_base_commit()
     81 {
     82  # read the last line of README.mozilla.last-vendor to retrieve our current base
     83  # commit in moz-libwebrtc
     84  MOZ_LIBWEBRTC_BASE=`tail -1 third_party/libwebrtc/README.mozilla.last-vendor`
     85  echo "prelim MOZ_LIBWEBRTC_BASE: $MOZ_LIBWEBRTC_BASE"
     86  # if we've advanced into a chrome release branch, we need to adjust the
     87  # MOZ_LIBWEBRTC_BASE to the last common commit so we can now advance up
     88  # the trunk commits.
     89  MOZ_LIBWEBRTC_BASE=`cd $MOZ_LIBWEBRTC_SRC ; git merge-base $MOZ_LIBWEBRTC_BASE $MOZ_TARGET_UPSTREAM_BRANCH_HEAD`
     90  # now make it a short hash
     91  MOZ_LIBWEBRTC_BASE=`cd $MOZ_LIBWEBRTC_SRC ; git rev-parse --short $MOZ_LIBWEBRTC_BASE`
     92  echo "adjusted MOZ_LIBWEBRTC_BASE: $MOZ_LIBWEBRTC_BASE"
     93 }
     94 export -f find_base_commit
     95 
     96 
     97 function find_next_commit()
     98 {
     99  # identify the next commit above our current base commit
    100  MOZ_LIBWEBRTC_NEXT_BASE=`cd $MOZ_LIBWEBRTC_SRC ; \
    101  git log --oneline --ancestry-path $MOZ_LIBWEBRTC_BASE^..$MOZ_TARGET_UPSTREAM_BRANCH_HEAD \
    102   | tail -2 | head -1 | awk '{print $1;}'`
    103 }
    104 export -f find_next_commit