0

Initial commit

This commit is contained in:
eleksir
2023-11-19 18:01:40 +03:00
commit 80ec8a7529
586 changed files with 29486 additions and 0 deletions

25
gitea/README Normal file
View File

@@ -0,0 +1,25 @@
Gitea - Git with a cup of tea
Gitea is a painless self-hosted Git service. It is similar to GitHub,
Bitbucket, and GitLab. Gitea is a fork of Gogs.
The goal of this project is to provide the easiest, fastest, and most painless
way of setting up a self-hosted Git service. With Go, this can be done with an
independent binary distribution across all platforms and architectures that Go
supports. This support includes Linux, macOS, and Windows, on architectures
like amd64, i386, ARM, PowerPC, and others.
In order to run gitea you should create user named git (for example) and
adjust configs according selected username.
groupadd -g 5001 git
useradd -u 5001 -d /var/lib/git -s /bin/bash -g git git
Git requires valid shell to operate properly, so in sshd config you should
disable password-less login. Ideally allow only certificate authrized logins
via ssh.
Don't forget to set long enough random complex password for this user and
forget it immediately.
Also never give this user full sudo privileges.

28
gitea/doinst.sh Normal file
View File

@@ -0,0 +1,28 @@
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
mv $NEW $OLD
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
# toss the redundant copy
rm $NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
preserve_perms() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
if [ -e $OLD ]; then
cp -a $OLD ${NEW}.incoming
cat $NEW > ${NEW}.incoming
mv ${NEW}.incoming $NEW
fi
config $NEW
}
config etc/gitea/gitea.ini.new
config etc/default/gitea.new
config etc/rc.d/rc.gitea.new
config etc/logrotate.d/gitea.new

127
gitea/gitea.SlackBuild Normal file
View File

@@ -0,0 +1,127 @@
#!/bin/sh
# Slackware build script for gitea
# Copyright 2020 Sergei Fedosoff <eleksir@gmail.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM="gitea"
VERSION="${VERSION:-1.20.4}"
BUILD="${BUILD:-1}"
TAG="${TAG:-_EXs}"
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH="i586" ;;
arm*) ARCH="arm" ;;
*) ARCH="$( uname -m )" ;;
esac
fi
CWD="$(pwd)"
TMP="${TMP:-/tmp/EXs}"
PKG="$TMP/package-$PRGNAM"
OUTPUT="${OUTPUT:-/tmp}"
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
USERNAME=${USERNAME:-git}
GROUPNAME=${GROUPNAME:-git}
USERID=${USERID:-5001}
GROUPID=${GROUPID:-5001}
HOMEDIR=${HOMEDIR:-/var/lib/git}
SHELLNAME=${SHELLNAME:-/bin/bash}
GETUSER=$(getent passwd $USERNAME)
GETGROUP=$(getent group $GROUPNAME)
set -e
if [ -z "$GETUSER" -o -z "$GETGROUP" ]; then
printf "\n You must have a \"$PRGNAM\" user and a group to run this script\n\n"
[ -z "$GETGROUP" ] && printf " # groupadd -g $GROUPID $GROUPNAME\n"
[ -z "$GETUSER" ] && printf " # useradd -u $USERID -d $HOMEDIR -s $SHELLNAME -g $GROUPNAME $USERNAME\n"
printf "\n"
exit 1
fi
rm -rf "$PKG"
mkdir -p "$TMP" "$PKG" "$OUTPUT"
cd "$TMP"
rm -rf "$PRGNAM-$VERSION"
tar xvf "$CWD/$PRGNAM-src-$VERSION.tar.gz"
cd "$PRGNAM-src-$VERSION"
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \+ -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
export TAGS="bindata sqlite sqlite_unlock_notify pgsql mysql mysql8 redis"
export LDFLAGS="-X 'code.gitea.io/gitea/modules/setting.CustomPath=/var/lib/gitea/custom'\
-X 'code.gitea.io/gitea/modules/setting.CustomConf=/etc/gitea/gitea.ini'\
-X 'code.gitea.io/gitea/modules/setting.AppWorkPath=/var/lib/gitea'"
make generate
make
install -Dpm 0755 gitea "$PKG/usr/sbin/gitea"
install -Dpm 0644 "$CWD/gitea.ini" "$PKG/etc/gitea/gitea.ini.new"
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
install -Dpm 0644 "$CWD/gitea.init" "$PKG/etc/rc.d/rc.gitea.new"
install -Dpm 0644 "$CWD/gitea.sysconfig" "$PKG/etc/default/gitea.new"
install -Dpm 0644 "$CWD/gitea.logrotate" "$PKG/etc/logrotate.d/gitea.new"
for file in CHANGELOG.md CONTRIBUTING.md LICENSE README.md; do
install -Dpm 0644 "$file" "${PKG}/usr/doc/${PRGNAM}-${VERSION}/${file}"
done
install -dm 0755 -o "${USERNAME}" -g "${GROUPNAME}" "$PKG/var/lib/gitea"
install -dm 0755 -o "${USERNAME}" -g "${GROUPNAME}" "$PKG/var/lib/gitea/custom"
install -dm 0755 -o "${USERNAME}" -g "${GROUPNAME}" "$PKG/var/log/gitea"
install -dm 0755 -o "${USERNAME}" -g "${GROUPNAME}" "$PKG/var/run/gitea"
install -Dpm 0644 "$CWD/$PRGNAM.SlackBuild" "$PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild"
pushd "$CWD"
for file in slack-desc slack-required doinst.sh; do
install -Dpm 0644 "$file" "$PKG/install/$file"
done
popd
cd "$PKG"
/sbin/makepkg -l y -c n "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}"
# vim: ft=sh noet ai ts=4 sw=4 sts=4:

10
gitea/gitea.info Normal file
View File

@@ -0,0 +1,10 @@
PRGNAM="gitea"
VERSION="1.20.4"
HOMEPAGE="https://github.com/go-gitea/gitea"
DOWNLOAD="https://dl.gitea.com/gitea/1.20.4/gitea-src-1.20.4.tar.gz"
MD5SUM="e4acf5caa7f787545a80d225204a5242"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
BUILD_REQUIRES="google-go-lang nodejs"
MAINTAINER="Sergei Fedosoff"
EMAIL="eleksir@gmail.com"

177
gitea/gitea.ini Normal file
View File

@@ -0,0 +1,177 @@
APP_NAME = Gitea
RUN_USER = git
RUN_MODE = prod
[repository]
ROOT = /var/lib/git
DEFAULT_BRANCH = master
[repository.pull-request]
[repository.issue]
[repository.signing]
[cors]
[ui]
[ui.admin]
[ui.notification]
[markdown]
[server]
PROTOCOL = http
DOMAIN = localhost
ROOT_URL = http://localhost/
HTTP_ADDR = 127.0.0.1
HTTP_PORT = 3000
SSH_DOMAIN = localhost
LOCAL_ROOT_URL = http://localhost/
DISABLE_SSH = false
SSH_PORT = 22
STATIC_ROOT_PATH = ./git
LANDING_PAGE = explore
SSH_ROOT_PATH = /var/lib/git/.ssh
[database]
DB_TYPE = sqlite3
HOST =
NAME = gitea
USER = gitea
PASSWD =
SSL_MODE = disable
PATH = /var/lib/gitea/data/gitea.db
LOG_SQL = false
[indexer]
[queue]
[admin]
[security]
INSTALL_LOCK = true
SECRET_KEY = PPNRXQ6Mosal0niF6bR2b3Et7fG6RqPDgFHMMJlMYWXNfCz0odgNj7KNby89KLsO
LOGIN_REMEMBER_DAYS = 30
ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET = true
INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NDk1NTQ5NjV9.liHgDqe12-bRR5kEw1YNrCMtI4mghBeAm9PNDWkc7Kw
[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false
[service]
REGISTER_EMAIL_CONFIRM = false
DISABLE_REGISTRATION = true
REQUIRE_SIGNIN_VIEW = false
ENABLE_NOTIFY_MAIL = false
ENABLE_BASIC_AUTHENTICATION = true
ENABLE_REVERSE_PROXY_AUTHENTICATION = false
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
ENABLE_REVERSE_PROXY_EMAIL = false
ENABLE_CAPTCHA = false
REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA = false
CAPTCHA_TYPE = image
DEFAULT_ENABLE_DEPENDENCIES = true
ALLOW_CROSS_REPOSITORY_DEPENDENCIES = true
ENABLE_USER_HEATMAP = true
SHOW_REGISTRATION_BUTTON = false
SHOW_MILESTONES_DASHBOARD_PAGE = true
AUTO_WATCH_NEW_REPOS = false
AUTO_WATCH_ON_CHANGES = false
DEFAULT_ORG_VISIBILITY = public
DEFAULT_ORG_MEMBER_VISIBLE = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = false
DEFAULT_ENABLE_TIMETRACKING = false
NO_REPLY_ADDRESS = noreply.localhost
[webhook]
SKIP_TLS_VERIFY = true
[mailer]
ENABLED = true
DISABLE_HELO = false
HELO_HOSTNAME = localhost
HOST = localhost
IS_TLS_ENABLED = false
FROM = gitea@localhost
USER = root
PASSWD =
SKIP_VERIFY = true
MAILER_TYPE = smtp
[cache]
ENABLED = true
ADAPTER = memory
[cache.last_commit]
ENABLED = true
[session]
PROVIDER = memory
COOKIE_SECURE = false
ENABLE_SET_COOKIE = true
[picture]
DISABLE_GRAVATAR = true
ENABLE_FEDERATED_AVATAR = false
[attachment]
ENABLED = false
[log]
MODE = file
LEVEL = Warn
STACKTRACE_LEVEL = None
ROUTER_LOG_LEVEL = Warn
ROOT_PATH = /var/log/gitea
ENABLE_ACCESS_LOG = false
ACCESS = file
ENABLE_XORM_LOG = false
DISABLE_ROUTER_LOG = true
[cron]
[cron.archive_cleanup]
[cron.update_mirrors]
[cron.repo_health_check]
[cron.check_repo_stats]
[cron.update_migration_poster_id]
[git]
[git.timeout]
[metrics]
ENABLED = false
[api]
ENABLE_SWAGGER = false
[oauth2]
ENABLE = false
[i18n]
[U2F]
[time]
FORMAT = RFC1123
[task]
[migrations]
[other]
SHOW_FOOTER_VERSION = false
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
SHOW_FOOTER_BRANDING = false

92
gitea/gitea.init Normal file
View File

@@ -0,0 +1,92 @@
#!/bin/sh
# Start/stop/restart Gitea daemon.
. /etc/default/gitea
__start() {
echo "Starting Gitea daemon: /usr/sbin/gitea"
if [ -z $GITEAUSER ]; then
echo "Please set user to run gitea as, usually, git"
exit 1
fi
getent passwd $GITEAUSER 1>/dev/null 2>/dev/null
if [ $? != 0 ]; then
echo "No user $GITEAUSER mentioned in /etc/default/gitea"
exit 1
fi
if [ -z "$PIDFILE" ]; then
echo "Please set PIDFILE in /etc/default/gitea"
exit 1
fi
if [ ! -d $(dirname $PIDFILE) ]; then
mkdir -p $(dirname $PIDFILE)
chown -R $GITEAUSER:root $(dirname $PIDFILE)
fi
if [ -z "$CONFIG" ]; then
echo "Please set full path to gitea config in /etc/default/gitea"
exit 1
fi
if [ -f "$PIDFILE" ]; then
echo "Gitea daemon is already running as PID $(< ${PIDFILE}) " >&2
exit 3
fi
if [ ! -d $(dirname $PIDFILE) ]; then
install -d -m 0755 -o $GITEAUSER "$(basename $PIDFILE)"
fi
if [ ! -d $(dirname $LOG) ]; then
mkdir -p $(dirname $LOG)
fi
chown -R $GITEAUSER "$(dirname $LOG)"
exec sudo -b -u $GITEAUSER -- /usr/sbin/gitea web \
--config "$CONFIG" \
--pid "$PIDFILE" \
--custom-path "$CUSTOMDIR" \
--work-path "$WORKDIR" >> /dev/null 2>&1
}
__stop() {
# do you know not so racy way here?
if [ -f "$PIDFILE" ]; then
kill $(cat ${PIDFILE})
rm -f "${PIDFILE}"
else
echo "Gitea daemon is not running"
fi
}
__restart() {
__stop
# pidfile being deleted immediately after sending SIGTERM to gitea process
# so we have to wait 'till it leave network socket alone
sleep 3
__start
}
case "$1" in
'start')
__start
;;
'stop')
__stop
;;
'restart')
__restart
;;
*)
echo "usage $0 start|stop|restart"
exit 2
esac
# vim: ft=sh noet ai ts=4 sw=4 sts=4:

6
gitea/gitea.logrotate Normal file
View File

@@ -0,0 +1,6 @@
/var/log/gitea/*.log {
daily
rotate 7
compress
missingok
}

17
gitea/gitea.sysconfig Normal file
View File

@@ -0,0 +1,17 @@
# run as user
GITEAUSER=git
# path to config
CONFIG=/etc/gitea/gitea.ini
# Custom dir path
CUSTOMDIR=/var/lib/gitea/custom
# Working dir, where data is stored
WORKDIR=/var/lib/gitea
# Pid file of gitea
PIDFILE=/var/run/gitea/gitea.pid
# Log to
LOG=/var/log/gitea/gitea.log

19
gitea/slack-desc Normal file
View File

@@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
gitea: gitea (A painless self-hosted Git service.)
gitea:
gitea: Gitea is a painless self-hosted Git service. It is similar to GitHub,
gitea: Bitbucket, and GitLab. Gitea is a fork of Gogs.
gitea: The goal of this project is to provide the easiest, fastest, and most
gitea: painless way of setting up a self-hosted Git service. With Go, this
gitea: can be done with an independent binary distribution across all
gitea: platforms and architectures that Go supports. This support includes
gitea: Linux, macOS, and Windows, on architectures like amd64, i386, ARM,
gitea: PowerPC, and others.
gitea: Home: https://gitea.io/

1
gitea/slack-required Normal file
View File

@@ -0,0 +1 @@
daemonize