mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-12-01 04:26:13 +01:00
Fix gitea
This commit is contained in:
parent
b64813c4c5
commit
dc01844998
|
@ -92,3 +92,13 @@ echo_exit() {
|
||||||
echo $msg
|
echo $msg
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Args
|
||||||
|
# - ca-certificates.crt - nix path to ca-certificates.crt
|
||||||
|
create_ssl_certs() {
|
||||||
|
local ca_certificates="$1/etc/ssl/certs/ca-bundle.crt"
|
||||||
|
|
||||||
|
$_prog_busybox/bin/mkdir -p /etc/ssl/certs
|
||||||
|
$_prog_busybox/bin/ln $ca_certificates /etc/ssl/certs/ca-bundle.crt
|
||||||
|
$_prog_busybox/bin/ln $ca_certificates /etc/ssl/certs/ca-certificates.crt
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{ pkgs, system, nixpkgs, ... }:
|
{ system, nixpkgs, ... }:
|
||||||
let
|
let
|
||||||
# pkgs = (import nixpkgs { inherit system; }).pkgsMusl;
|
overlay = self: super:
|
||||||
gitea =
|
{
|
||||||
let
|
openssh = super.openssh.override {
|
||||||
openssh = pkgs.openssh.override {
|
withKerberos = false;
|
||||||
withKerberos = false; withFIDO = false;
|
withFIDO = false;
|
||||||
};
|
};
|
||||||
git = pkgs.git.override {
|
git = super.git.override {
|
||||||
inherit openssh;
|
|
||||||
perlSupport = false;
|
perlSupport = false;
|
||||||
nlsSupport = false;
|
nlsSupport = false;
|
||||||
withManual = false;
|
withManual = false;
|
||||||
|
@ -16,15 +15,19 @@ let
|
||||||
withpcre2 = false;
|
withpcre2 = false;
|
||||||
sendEmailSupport = false;
|
sendEmailSupport = false;
|
||||||
};
|
};
|
||||||
in
|
gitea = super.gitea.override {
|
||||||
pkgs.gitea.override {
|
|
||||||
inherit openssh git;
|
|
||||||
pamSupport = false;
|
pamSupport = false;
|
||||||
};
|
};
|
||||||
|
# glibc = super.glibc.override {
|
||||||
|
# withLinuxHeaders = false;
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
pkgs = (import nixpkgs { inherit system; overlays = [ overlay ]; });#.pkgsMusl;
|
||||||
bashLib = ../bash-lib;
|
bashLib = ../bash-lib;
|
||||||
init = pkgs.writeShellScriptBin "init" (builtins.readFile ./init);
|
init = pkgs.writeShellScriptBin "init" (builtins.readFile ./init);
|
||||||
conf = pkgs.writeText "conf" ''
|
conf = pkgs.writeText "conf" ''
|
||||||
_prog_busybox="${pkgs.busybox}"
|
_prog_busybox="${pkgs.busybox}"
|
||||||
|
_prog_sudo="${pkgs.sudo}"
|
||||||
_prog_bashlib="${bashLib}"
|
_prog_bashlib="${bashLib}"
|
||||||
_prog_bash="${pkgs.bash}"
|
_prog_bash="${pkgs.bash}"
|
||||||
_prog_gitea="${pkgs.gitea}"
|
_prog_gitea="${pkgs.gitea}"
|
||||||
|
@ -32,8 +35,10 @@ let
|
||||||
_conf_user_uid="5000"
|
_conf_user_uid="5000"
|
||||||
_conf_user_gid="5000"
|
_conf_user_gid="5000"
|
||||||
_conf_data="/data/gitea"
|
_conf_data="/data/gitea"
|
||||||
|
_conf_cacert="${pkgs.cacert}"
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
|
# conf
|
||||||
pkgs.dockerTools.buildLayeredImage {
|
pkgs.dockerTools.buildLayeredImage {
|
||||||
name = "gitea";
|
name = "gitea";
|
||||||
tag = "latest";
|
tag = "latest";
|
||||||
|
|
|
@ -10,9 +10,10 @@ else
|
||||||
source $conf
|
source $conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# shellcheck source=/../../bash-lib/main.bash
|
||||||
source $_prog_bashlib/main.bash
|
source $_prog_bashlib/main.bash
|
||||||
|
|
||||||
if [[ $($_prog_busybox/bin/id -u) = 0 ]] ; then
|
# if [[ $($_prog_busybox/bin/id -u) = 0 ]] ; then
|
||||||
$_prog_busybox/bin/cat << EOF
|
$_prog_busybox/bin/cat << EOF
|
||||||
### Gitea Nix Image Manual
|
### Gitea Nix Image Manual
|
||||||
##
|
##
|
||||||
|
@ -48,24 +49,8 @@ EOF
|
||||||
$_prog_busybox/bin/mkdir -p /usr/bin
|
$_prog_busybox/bin/mkdir -p /usr/bin
|
||||||
$_prog_busybox/bin/ln -s $_prog_busybox/bin/env /usr/bin/env
|
$_prog_busybox/bin/ln -s $_prog_busybox/bin/env /usr/bin/env
|
||||||
|
|
||||||
check_owner "$_conf_data" "$_user_uid" "$_user_gid"
|
create_ssl_certs $_conf_cacert
|
||||||
|
|
||||||
save_env "_user_uid \
|
|
||||||
_user_gid \
|
|
||||||
conf
|
|
||||||
" > /env # TODO: exited even though it must have succeded || \
|
|
||||||
# echo_exit "Failed to save environment!"
|
|
||||||
|
|
||||||
check_root "$_user_uid"
|
|
||||||
exec $_prog_busybox/bin/su gitea -c "$0 $@" || \
|
|
||||||
echo_exit "Failed to switch user!"
|
|
||||||
else
|
|
||||||
source /env || \
|
|
||||||
echo_exit "Failed to source env!"
|
|
||||||
|
|
||||||
export GITEA_WORK_DIR=$_conf_data
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Starting Gitea!"
|
echo "Starting Gitea!"
|
||||||
$_prog_gitea/bin/gitea -c /app.ini $@
|
exec $_prog_busybox/bin/su gitea -c "$_prog_gitea/bin/gitea -c /app.ini $@"
|
||||||
fi
|
# fi
|
||||||
|
|
Loading…
Reference in a new issue