freedomboneeee/src/freedombone-upgrade

68 lines
1.9 KiB
Plaintext
Raw Normal View History

#!/bin/bash
2015-12-11 12:03:56 +01:00
#
# .---. . .
# | | |
# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
#
# Freedom in the Cloud
#
# Command to upgrade the system
# License
# =======
#
2016-01-02 22:58:27 +01:00
# Copyright (C) 2015-2016 Bob Mottram <bob@robotics.uk.to>
2015-12-11 12:03:56 +01:00
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2015-12-11 12:07:47 +01:00
PROJECT_NAME='freedombone'
PROJECT_DIR="/root/${PROJECT_NAME}"
# An optional configuration file which overrides some of these variables
CONFIGURATION_FILE="/root/${PROJECT_NAME}.cfg"
PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
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
fi
update-ca-certificates
if [ ! -d $PROJECT_DIR ]; then
git clone $PROJECT_REPO $PROJECT_DIR
fi
if [ -d $PROJECT_DIR ]; then
if [ -f $CONFIGURATION_FILE ]; then
cd $PROJECT_DIR
2015-12-11 12:07:47 +01:00
git stash
git pull
make install
${PROJECT_NAME} -c $CONFIGURATION_FILE
2015-12-11 12:07:47 +01:00
fi
fi
echo '
' | reset-tripwire
# deliberately there is no 'exit 0' here