From 1390568de3cb3d7228659f20dacf2ead7bfe40f5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 11 Oct 2020 22:45:51 +0200 Subject: [PATCH] fix --- README.md | 22 +++++++++++--------- scripts/_common.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0a8ab12..4f3af24 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,20 @@ # Gogs for YunoHost -Gogs is a self-hosted Git service written in Go. Alternative to Github. -- [Gogs website](http://gogs.io) - -[![Integration level](https://dash.yunohost.org/integration/gogs.svg)](https://ci-apps.yunohost.org/jenkins/job/gogs%20%28Community%29/lastBuild/consoleFull) - +[![Integration level](https://dash.yunohost.org/integration/gogs.svg)](https://dash.yunohost.org/appci/app/gogs) ![](https://ci-apps.yunohost.org/ci/badges/gogs.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/gogs.maintain.svg) [![Install Gogs with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=gogs) -# IMPORTANT INFORMATION +*[Lire ce readme en français.](./README_fr.md)* -**Note that this package will not be longer be maintened by the actual maintener. -The idea is to migrate to [gitea](https://github.com/YunoHost-Apps/gitea_ynh) which is more featured.** +> *This package allows you to install Gogs quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* + +## Overview +Gogs is a self-hosted Git service written in Go. Alternative to Github. + +## Info +**Shipped version:** 0.12.3 + +# IMPORTANT INFORMATION For the old install you can migrate to gitea easly by juste upgrading your actuall gogs instance with the gitea source by this command: ``` @@ -67,8 +71,6 @@ Also, in some cases, Gogs will not restart properly during the update. If so, yo Sources and issues of the old package can be found [here](https://github.com/YunoHost-Apps/gogs_ynh_old/) -## Info -Gogs v0.11.66 - [YunoHost forum thread](https://forum.yunohost.org/t/gogs-package-an-awesome-github-alternative/1127) diff --git a/scripts/_common.sh b/scripts/_common.sh index 38d9424..ae6de87 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -106,3 +106,55 @@ set_access_settings() { ynh_app_setting_set $app skipped_regex "$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-receive%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-upload%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/info/refs" fi } + + +# Start or restart a service and follow its booting +# +# usage: ynh_check_starting "Line to match" [Log file] [Timeout] [Service name] +# +# | arg: Line to match - The line to find in the log to attest the service have finished to boot. +# | arg: Log file - The log file to watch +# | arg: Service name +# /var/log/$app/$app.log will be used if no other log is defined. +# | arg: Timeout - The maximum time to wait before ending the watching. Defaut 300 seconds. +ynh_check_starting () { + local line_to_match="$1" + local service_name="${4:-$app}" + local app_log="${2:-/var/log/$service_name/$service_name.log}" + local timeout=${3:-300} + + ynh_clean_check_starting () { + # Stop the execution of tail. + kill -s 15 $pid_tail 2>&1 + ynh_secure_remove "$templog" 2>&1 + } + + echo "Starting of $service_name" >&2 + systemctl stop $service_name + local templog="$(mktemp)" + # Following the starting of the app in its log + tail -F -n0 "$app_log" > "$templog" & + # Get the PID of the tail command + local pid_tail=$! + systemctl start $service_name + + local i=0 + for i in `seq 1 $timeout` + do + # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout + if grep --quiet "$line_to_match" "$templog" + then + echo "The service $service_name has correctly started." >&2 + break + fi + echo -n "." >&2 + sleep 1 + done + if [ $i -eq $timeout ] + then + echo "The service $service_name didn't fully started before the timeout." >&2 + fi + + echo "" + ynh_clean_check_starting +}