From 86996bd5243ae7a5b31be42d91e21564761fa605 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 29 Sep 2016 10:28:13 +0100 Subject: [PATCH] Use the stockholm branch for upgrades --- src/freedombone-upgrade | 91 +++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/src/freedombone-upgrade b/src/freedombone-upgrade index a37069d2..f09ff767 100755 --- a/src/freedombone-upgrade +++ b/src/freedombone-upgrade @@ -45,49 +45,49 @@ MY_MIRRORS_PASSWORD= source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-git function read_repo_servers { - if [ -f $CONFIGURATION_FILE ]; then - if grep -q "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE; then - FRIENDS_MIRRORS_SERVER=$(grep "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi - if grep -q "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE; then - FRIENDS_MIRRORS_SSH_PORT=$(grep "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi - if grep -q "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then - MY_MIRRORS_PASSWORD=$(grep "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi - if grep -q "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then - FRIENDS_MIRRORS_PASSWORD=$(grep "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi - fi + if [ -f $CONFIGURATION_FILE ]; then + if grep -q "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE; then + FRIENDS_MIRRORS_SERVER=$(grep "FRIENDS_MIRRORS_SERVER" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi + if grep -q "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE; then + FRIENDS_MIRRORS_SSH_PORT=$(grep "FRIENDS_MIRRORS_SSH_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi + if grep -q "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then + MY_MIRRORS_PASSWORD=$(grep "MY_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi + if grep -q "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE; then + FRIENDS_MIRRORS_PASSWORD=$(grep "FRIENDS_MIRRORS_PASSWORD" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi + fi - if [ ! $FRIENDS_MIRRORS_SERVER ]; then - return - fi - if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then - return - fi + if [ ! $FRIENDS_MIRRORS_SERVER ]; then + return + fi + if [ ${#FRIENDS_MIRRORS_SERVER} -lt 2 ]; then + return + fi - MAIN_COMMAND=/usr/local/bin/${PROJECT_NAME} - if [ ! -f $MAIN_COMMAND ]; then - MAIN_COMMAND=/usr/bin/${PROJECT_NAME} - fi + MAIN_COMMAND=/usr/local/bin/${PROJECT_NAME} + if [ ! -f $MAIN_COMMAND ]; then + MAIN_COMMAND=/usr/bin/${PROJECT_NAME} + fi - REPOS=($(cat ${MAIN_COMMAND} | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g')) + REPOS=($(cat ${MAIN_COMMAND} | grep "_REPO=\"" | uniq -u | sed 's|${PROJECT_NAME}|'"${PROJECT_NAME}"'|g')) - for line in "${REPOS[@]}" - do - repo_name=$(echo "$line" | awk -F '=' '{print $1}') - mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}') - friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}" - ${repo_name}="${friends_repo_url}" - done + for line in "${REPOS[@]}" + do + repo_name=$(echo "$line" | awk -F '=' '{print $1}') + mirrors_name=$(echo "$repo_name" | sed "s|_REPO||g" | awk '{print tolower($0)}') + friends_repo_url="ssh://mirrors@${FRIENDS_MIRRORS_SERVER}:${FRIENDS_MIRRORS_SSH_PORT}/home/mirrors/${mirrors_name}" + ${repo_name}="${friends_repo_url}" + done } if [ -f $CONFIGURATION_FILE ]; then - # read the location of the main project repo - if grep -q "PROJECT_REPO" $CONFIGURATION_FILE; then - PROJECT_REPO=$(grep "PROJECT_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}') - fi + # read the location of the main project repo + if grep -q "PROJECT_REPO" $CONFIGURATION_FILE; then + PROJECT_REPO=$(grep "PROJECT_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}') + fi fi update-ca-certificates @@ -96,21 +96,22 @@ read_repo_servers ${PROJECT_NAME}-mirrors if [ ! -d $PROJECT_DIR ]; then - git_clone $PROJECT_REPO $PROJECT_DIR + git_clone $PROJECT_REPO $PROJECT_DIR fi if [ -d $PROJECT_DIR ]; then - if [ -f $CONFIGURATION_FILE ]; then - cd $PROJECT_DIR - rm -rf $PROJECT_DIR/locale/* - git_pull $PROJECT_REPO - make install - ${PROJECT_NAME} -c $CONFIGURATION_FILE - fi + if [ -f $CONFIGURATION_FILE ]; then + cd $PROJECT_DIR + rm -rf $PROJECT_DIR/locale/* + git checkout stockholm + git_pull $PROJECT_REPO + make install + ${PROJECT_NAME} -c $CONFIGURATION_FILE + fi fi if [ -f /usr/bin/reset-tripwire ]; then - echo ' + echo ' ' | reset-tripwire fi