Test logging

This commit is contained in:
Bob Mottram 2017-04-12 17:26:40 +01:00
parent fdc1a4f8bf
commit bf4563b1ae
1 changed files with 12 additions and 0 deletions

View File

@ -136,20 +136,24 @@ function reconfigure_gogs {
} }
function upgrade_gogs { function upgrade_gogs {
echo "1" > ~/build/testlog.txt
if ! grep 'gogs version:' $COMPLETION_FILE; then if ! grep 'gogs version:' $COMPLETION_FILE; then
return return
fi fi
echo "2" > ~/build/testlog.txt
CURR_GOGS_VERSION=$(get_completion_param "gogs version") CURR_GOGS_VERSION=$(get_completion_param "gogs version")
echo "gogs current version: ${CURR_GOGS_VERSION}" echo "gogs current version: ${CURR_GOGS_VERSION}"
echo "gogs app version: ${GOGS_VERSION}" echo "gogs app version: ${GOGS_VERSION}"
if [[ "${CURR_GOGS_VERSION}" == "${GOGS_VERSION}" ]]; then if [[ "${CURR_GOGS_VERSION}" == "${GOGS_VERSION}" ]]; then
return return
fi fi
echo "3" > ~/build/testlog.txt
gogs_parameters gogs_parameters
echo "gogs binary upgrade: ${GOGS_BIN}" echo "gogs binary upgrade: ${GOGS_BIN}"
echo "4" > ~/build/testlog.txt
if [ ! -d ${INSTALL_DIR} ]; then if [ ! -d ${INSTALL_DIR} ]; then
mkdir -p ${INSTALL_DIR} mkdir -p ${INSTALL_DIR}
fi fi
@ -158,10 +162,14 @@ function upgrade_gogs {
rm -rf ${INSTALL_DIR}/gogs rm -rf ${INSTALL_DIR}/gogs
fi fi
GOGS_FILE=linux_${CURR_ARCH}.tar.gz GOGS_FILE=linux_${CURR_ARCH}.tar.gz
echo "5" > ~/build/testlog.txt
if [ ! -f ${GOGS_FILE} ]; then if [ ! -f ${GOGS_FILE} ]; then
wget ${GOGS_BIN} wget ${GOGS_BIN}
echo "6" > ~/build/testlog.txt
fi fi
echo "7" > ~/build/testlog.txt
if [ ! -f ${GOGS_FILE} ]; then if [ ! -f ${GOGS_FILE} ]; then
echo "8" > ~/build/testlog.txt
GOGS_FILE=linux_${CURR_ARCH}.zip GOGS_FILE=linux_${CURR_ARCH}.zip
GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/${GOGS_FILE}" GOGS_BIN="https://github.com/gogits/gogs/releases/download/v${GOGS_VERSION}/${GOGS_FILE}"
if [ ! -f ${GOGS_FILE} ]; then if [ ! -f ${GOGS_FILE} ]; then
@ -174,16 +182,20 @@ function upgrade_gogs {
unzip -o ${GOGS_FILE} unzip -o ${GOGS_FILE}
fi fi
else else
echo "9" > ~/build/testlog.txt
tar -xzf ${INSTALL_DIR}/${GOGS_FILE} tar -xzf ${INSTALL_DIR}/${GOGS_FILE}
fi fi
echo "10" > ~/build/testlog.txt
if [ ! -d ${INSTALL_DIR}/gogs ]; then if [ ! -d ${INSTALL_DIR}/gogs ]; then
exit 37823 exit 37823
fi fi
echo "11" > ~/build/testlog.txt
rm -rf /home/${GOGS_USERNAME}/* rm -rf /home/${GOGS_USERNAME}/*
cp -r ${INSTALL_DIR}/gogs/* /home/${GOGS_USERNAME} cp -r ${INSTALL_DIR}/gogs/* /home/${GOGS_USERNAME}
if [ -f ${GOGS_FILE} ]; then if [ -f ${GOGS_FILE} ]; then
rm ${GOGS_FILE} rm ${GOGS_FILE}
fi fi
echo "12" > ~/build/testlog.txt
sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE} sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
systemctl restart gogs systemctl restart gogs