From 1c619cc5ea7212d2451bc85bdcfecaf38e29204f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 28 Sep 2016 17:25:02 +0100 Subject: [PATCH] Tidying --- src/freedombone-app-gogs | 54 +++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/freedombone-app-gogs b/src/freedombone-app-gogs index ca6a002f..3c31ed5f 100755 --- a/src/freedombone-app-gogs +++ b/src/freedombone-app-gogs @@ -120,31 +120,31 @@ function upgrade_gogs { mkdir -p ${INSTALL_DIR} fi cd ${INSTALL_DIR} - if [ -f linux-${CURR_ARCH}.tar.gz ]; then - rm linux-${CURR_ARCH}.tar.gz - fi - wget ${GOGS_BIN} - if [ ! -f linux_${CURR_ARCH}.tar.gz ]; then - GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/linux_${CURR_ARCH}.zip" + GOGS_FILE=linux_${CURR_ARCH}.tar.gz + if [ ! -f $GOGS_FILE ]; then wget ${GOGS_BIN} - if [ ! -f linux_${CURR_ARCH}.zip ]; then + fi + if [ ! -f $GOGS_FILE ]; then + GOGS_FILE=linux_${CURR_ARCH}.zip + GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/${GOGS_FILE}" + if [ ! -f ${GOGS_FILE} ]; then + wget ${GOGS_BIN} + fi + if [ ! -f ${GOGS_FILE} ]; then exit 37836 else apt-get -y install unzip - unzip -A linux_${CURR_ARCH}.zip + unzip -A ${GOGS_FILE} fi else - tar -xzf ${INSTALL_DIR}/linux_${CURR_ARCH}.tar.gz + tar -xzf ${INSTALL_DIR}/${GOGS_FILE} fi if [ ! -d $INSTALL_DIR/gogs ]; then exit 37823 fi cp -r $INSTALL_DIR/gogs /home/$GOGS_USERNAME - if [ -f linux_${CURR_ARCH}.tar.gz ]; then - rm linux_${CURR_ARCH}.tar.gz - fi - if [ -f linux_${CURR_ARCH}.zip ]; then - rm linux_${CURR_ARCH}.zip + if [ -f ${GOGS_FILE} ]; then + rm ${GOGS_FILE} fi sed -i "s|Gogs version.*|Gogs version:$GOGS_VERSION|g" $COMPLETION_FILE @@ -351,31 +351,29 @@ function install_gogs { mkdir -p ${INSTALL_DIR} fi cd ${INSTALL_DIR} - if [ -f linux-${CURR_ARCH}.tar.gz ]; then - rm linux-${CURR_ARCH}.tar.gz - fi - wget ${GOGS_BIN} - if [ ! -f linux_${CURR_ARCH}.tar.gz ]; then - GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/linux_${CURR_ARCH}.zip" + GOGS_FILE=linux_${CURR_ARCH}.tar.gz + if [ ! -f ${GOGS_FILE} ]; then wget ${GOGS_BIN} - if [ ! -f linux_${CURR_ARCH}.zip ]; then + fi + if [ ! -f ${GOGS_FILE} ]; then + GOGS_FILE=linux_${CURR_ARCH}.zip + GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/${GOGS_FILE}" + wget ${GOGS_BIN} + if [ ! -f ${GOGS_FILE} ]; then exit 37836 else apt-get -y install unzip - unzip -A linux_${CURR_ARCH}.zip + unzip -A ${GOGS_FILE} fi else - tar -xzf ${INSTALL_DIR}/linux_${CURR_ARCH}.tar.gz + tar -xzf ${INSTALL_DIR}/${GOGS_FILE} fi if [ ! -d $INSTALL_DIR/gogs ]; then exit 37823 fi cp -r $INSTALL_DIR/gogs /home/$GOGS_USERNAME - if [ -f linux_${CURR_ARCH}.tar.gz ]; then - rm linux_${CURR_ARCH}.tar.gz - fi - if [ -f linux_${CURR_ARCH}.zip ]; then - rm linux_${CURR_ARCH}.zip + if [ -f ${GOGS_FILE} ]; then + rm ${GOGS_FILE} fi if [ ! -f /home/$GOGS_USERNAME/gogs ]; then