From ce87cc9332343abd2381d90d3aa686ea51365b83 Mon Sep 17 00:00:00 2001 From: Micha Glave Date: Thu, 7 Feb 2019 15:46:44 +0100 Subject: [PATCH] adding gogs-0.11.86.ebuild --- www-apps/gogs/Manifest | 4 ++ www-apps/gogs/files/confd | 41 +++++++++++ www-apps/gogs/files/initd | 72 +++++++++++++++++++ www-apps/gogs/gogs-0.11.86.ebuild | 111 ++++++++++++++++++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 www-apps/gogs/Manifest create mode 100644 www-apps/gogs/files/confd create mode 100644 www-apps/gogs/files/initd create mode 100644 www-apps/gogs/gogs-0.11.86.ebuild diff --git a/www-apps/gogs/Manifest b/www-apps/gogs/Manifest new file mode 100644 index 0000000..663fdb8 --- /dev/null +++ b/www-apps/gogs/Manifest @@ -0,0 +1,4 @@ +AUX confd 1074 BLAKE2B 2da6110a1d9e98718736f7adfb4e861784ca1ff1562b12c3dff823908bf1415cd5751c3a2c356779412136f63ce7bedd01be6fd1fc24d5237b27b1deed5a0d31 SHA512 2591f51067ae194c28fec80cd1211b0ba4be6c0bb53fd6a0f26cff5c8beb448fb32430f9ae804e348184f5c9dcf75603086160972b093a6f375c27b7a49ff284 +AUX initd 1521 BLAKE2B 7f2fd30e82dc84394d6526862d0c3adc9a5950c22cbf7eecc38dea94f1a9f730cd015978162ed8ba002ce70819751ec94c198c615ee906308ab3a14e8623bdf6 SHA512 693dbc61cd5fab497eefd331e9829eb6a6b5621f8b28d181531873a93f29f6e3992c5a3bb66e742432b0a74662b2ce2b28916a9ae3e1d844b1a016de2cb5273a +DIST gogs-0.11.86.tar.gz 19382029 BLAKE2B 0dd46bbd563553bb280ea171f8acf377532c8d9f855eff1a553db62d0810956630af3ed702373022bee958dadd57d7721a7a0851a2284c17ac15c16d9cf62bbe SHA512 d9eae7b29f683ac0a289d3790b94e700c013232a74e1a91f01977899c26eb5b652ee39f5423d0e2217c0c7a12428902b20eeef68005b4a6713455553302e57e7 +EBUILD gogs-0.11.86.ebuild 3059 BLAKE2B c6ea15d3f8fcefda874bd6cc400ced700fd9e3b1745b1ff973bf74230ec31e8b128a90ece1d066f5aa39531c77ffcfc2fd34f301996e476d99bd49d6e46dff1f SHA512 2ce1305852dcef5240082c6f8067a3a94962d5b83de7f6e4c0b7c944c4e94bf43490b8c6e6e186dbdec2c5b31a8e140a4b7984b21ab35fea68feac02a805f862 diff --git a/www-apps/gogs/files/confd b/www-apps/gogs/files/confd new file mode 100644 index 0000000..75d5d6a --- /dev/null +++ b/www-apps/gogs/files/confd @@ -0,0 +1,41 @@ +# Apache License 2015 + +# Path of your config dir +# It will be created upon finishing installation +# custom_config_dir="/etc/gogs/custom" + +# Path of gogs data (avatars etc.) +# This will change the location in which repos are stored +workdir="/var/lib/gogs" + +# What user and group should Gogs run as? +user="gogs" +group="gogs" + +# What arguments should be passed to Gogs? +# Only "web" is supported (to start the server) +# daemon_opts="web" + +# Where does Gogs keep configuration files? +# Only for user information messages at the moment +defaultconf="/etc/gogs/conf/app.ini" +#customconf="${custom_config_dir}/app.ini" + +# Where should logs be stored? +logfile="/var/log/gogs/gogs.log" + +# Where should the PID file be saved while Gogs is running? +# Default is "/run/${SVCNAME}.pid" +# eg "/run/gogs.pid" +#pidfile="/run/gogs.pid" + +# How long should we wait for Gogs itself to start? +# Expects a number (in milliseconds) +# Default 500 +startwait=500 + +# What is the maximum wait for start-stop-daemon to create a PID file? +# Expects a number (in milliseconds) +# Default 1000 +timeout=1000 + diff --git a/www-apps/gogs/files/initd b/www-apps/gogs/files/initd new file mode 100644 index 0000000..4c27167 --- /dev/null +++ b/www-apps/gogs/files/initd @@ -0,0 +1,72 @@ +#!/sbin/openrc-run +# Apache License 2015 + +user="${user:-gogs}" +group="${group:-gogs}" +pidfile="${pidfile:-/run/${SVCNAME}.pid}" +daemon_opts="${daemon_opts:-web}" +logfile="${logfile:-/var/log/gogs/gogs.log}" +defaultconf="${defaultconf:-/etc/gogs/conf/app.ini}" +startwait=${startwait:-500} +timeout=${timeout:-1000} +GOGS_CUSTOM="${custom_config_dir:-/etc/gogs/custom}" +GOGS_WORK_DIR="${workdir:-/var/lib/gogs}" + +depend() { + need gogs net localmount + use logger mysql pam cert nginx memcache + after bootmisc +} + +start_pre() { + if [ ! -r "${customconf}" ] ; then + einfo "Cannot read custom configuration file '${customconf}'" + if [ ! -r "${defaultconf}" ] ; then + eerror "Cannot read default configuration file '${defaultconf}'" + return 1 + else + einfo "Falling back to '${defaultconf}'" + customconf="${defaultconf}" + fi + fi +} + +start() { + ebegin "Starting ${SVCNAME}" + + export GOGS_CUSTOM + export GOGS_WORK_DIR + sh -c "start-stop-daemon \ + --start \ + --user ${user} \ + --group ${group} \ + --background \ + --make-pidfile \ + --pidfile=${pidfile} \ + --wait=${startwait} \ + --stderr=${logfile} \ + --stdout=${logfile} \ + --exec /usr/bin/gogs \ + -- ${daemon_opts} --config ${customconf} " + local i=0 + while [ ! -f ${pidfile} ] && [ $i -le ${timeout} ]; do + sleep 1 + i=$(($i + 1000)) + done + + [ $timeout -gt $i ] + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + + start-stop-daemon \ + ${DEBUG:+"--verbose"} \ + --stop \ + --exec /usr/bin/gogs \ + --pidfile "${pidfile}" + eend $? + rm -f $PIDFILE + return 0; +} diff --git a/www-apps/gogs/gogs-0.11.86.ebuild b/www-apps/gogs/gogs-0.11.86.ebuild new file mode 100644 index 0000000..d22d1d0 --- /dev/null +++ b/www-apps/gogs/gogs-0.11.86.ebuild @@ -0,0 +1,111 @@ +# Copyright 2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit golang-vcs-snapshot golang-build user + +EGO_SRC=github.com/gogs/gogs +EGO_PN=${EGO_SRC}/... +DESCRIPTION="Gogs is a painless self-hosted Git service." +HOMEPAGE="https://gogs.io" +EGIT_COMMIT="06b6eaba060f8b874a4c2a8c84515b2ea45321d6" +SRC_URI="https://${EGO_SRC}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz" + + +LICENSE="MIT License" +SLOT="0/${PVR}" +KEYWORDS="~amd64 ~x86" +IUSE="mysql postgres +sqlite +pam +ssl" + +DEPEND="sqlite? ( dev-db/sqlite:3 )" +RDEPEND="${DEPEND} + mysql? ( virtual/mysql ) + postgres? ( dev-db/postgresql[pam?,ssl?] ) +" + +USER_NAME="gogs" +USER_DIR="/var/lib/${USER_NAME}" +APP_DIR="/usr/share/${PN}" + +pkg_setup() { + enewgroup ${USER_NAME} + enewuser ${USER_NAME} -1 /bin/bash "${USER_DIR}" ${USER_NAME} + GOLANG_PKG_LDFLAGS+=" -X github.com/gogits/gogs/modules/setting.BuildTime=$(date -u '+%Y-%m-%d')" +} + +src_prepare() { + default + + cd ${S}/src/${EGO_SRC} + cp conf/app.ini "${T}"/app.user.ini || die + + sed -i "1,4d" "${T}"/app.user.ini || die + sed -i \ + -e "s:^PATH = data/gogs.db:PATH = database/${PN}.db:" \ + -e "s:^STATIC_ROOT_PATH =.*:STATIC_ROOT_PATH = ${EPREFIX}/usr/share/themes/${PN}:" \ + -e "s:^MODE =.*:MODE = console:" \ + -e "s:^OFFLINE_MODE =.*:OFFLINE_MODE = true:" \ + -e "s:^DISABLE_ROUTER_LOG =.*:DISABLE_ROUTER_LOG = true:" \ + -e "s:^DISABLE_GRAVATAR =.*:DISABLE_GRAVATAR = true:" \ + -e "s:^PROVIDER =.*:PROVIDER = memory:" \ + -e "s:^RUN_MODE =.*:RUN_MODE = prod:" \ + -e "s:^# NEVER EVER.*::" \ + -e "s:^# PLEASE MAKE.*::" \ + conf/app.ini "${T}"/app.user.ini || die + + # Fallback for sqlite as main backend + if use sqlite; then + sed -i \ + -e "s:^DB_TYPE = mysql.*:DB_TYPE = sqlite3:" \ + conf/app.ini "${T}"/app.user.ini || die + fi + + # These are settings specific only to the main app.ini. + sed -i \ + -e "s:^ROOT_PATH =.*:ROOT_PATH = ${EPREFIX}/var/log/${PN}:" \ + -e "s:^ROOT =.*:ROOT = ${EPREFIX}${USER_DIR}/repositories:" \ + -e "s:^RUN_USER =.*:RUN_USER = ${USER_NAME}:" \ + conf/app.ini || die + + # These are settings specific only to the app.ini used by users. + sed -i \ + -e "s:^ROOT_PATH =.*:ROOT_PATH = /${PN}/log:" \ + -e "s:^ROOT =.*:ROOT = /${PN}/repositories:" \ + -e "s:^RUN_USER =.*:RUN_USER = :" \ + "${T}"/app.user.ini || die +} + +src_install() { + golang-build_src_install + cd src/github.com/gogs/gogs + + dobin ${S}/bin/${PN} + + # Install init files + newconfd "${FILESDIR}/confd" ${PN} + newinitd "${FILESDIR}/initd" ${PN} + + # Install configuration files + insinto /etc/${PN}/conf + insopts -m640 + doins "${T}"/app.user.ini + doins conf/app.ini + + # Fix permissions of config files + keepdir /etc/${PN}/ + fperms 775 /etc/${PN}/conf + fowners -R :${USER_NAME} /etc/${PN} + + # Install theme files + insinto /usr/share/themes/${PN}/ + insopts -m440 + doins -r public/ + doins -r templates/ + fowners -R ${USER_NAME}:${USER_NAME} /usr/share/themes/${PN}/ + + # Create log directory + keepdir /var/log/${PN} + # fperms 775 /var/log/${PN} + fowners -R ${USER_NAME}:${USER_NAME} /var/log/${PN} +}