From 36321fd1048ee48ee47515492772e025bf392faa Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 25 Oct 2022 10:24:41 +0200 Subject: [PATCH] =?UTF-8?q?instalaci=C3=B3n=20en=20OpenBSD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- INSTALL.md | 32 ++++++++++++++++++++++++++++++++ sh4rin-openbsd-rc.d | 17 +++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 INSTALL.md create mode 100644 sh4rin-openbsd-rc.d diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..b0b6b1f --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,32 @@ +# INSTALACIÓN + +## OpenBSD +### Crear usuario e grupo +```sh +groupadd _sh4rin +mkdir -p /home/_sh4rin/uploads +useradd -d /home/_sh4rin/uploads/ -c "sh4rin service" -g _sh4rin -L daemon -s /sbin/nologin _sh4rin +chown -R _sh4rin:_sh4rin /home/_sh4rin/ +chmod -R 700 /home/_sh4rin/ +``` + +### Compilar e instalar executable +```sh +git clone https://git.tr4ck.net/serxoz/share.git +cd share +cargo build --release +doas cp target/release/share /usr/local/bin/share +``` + +### Configurar rc.d +- Copia o script de arranque: +```sh +doas cp sh4rin-openbsd-rc.d /etc/rc.d/sh4rin +``` + +- Configura no script as variables de entorno en env. +- Agrega en /etc/rc.conf.local o script a pkg_scripts +- Inicia o servicio: +```sh +/etc/rc.d/sh4rin start +``` diff --git a/sh4rin-openbsd-rc.d b/sh4rin-openbsd-rc.d new file mode 100644 index 0000000..606d895 --- /dev/null +++ b/sh4rin-openbsd-rc.d @@ -0,0 +1,17 @@ +#!/bin/ksh +# +# $OpenBSD: sh4rin.rc,v 0.0.1 2022/10/25 + +daemon="/usr/local/bin/share" +daemon_user="_sh4rin" +env="UPLOADS=/home/_sh4rin/uploads/ PORT=3000 BASE_URL=https://sh4r.in RPROXY=true" + +. /etc/rc.d/rc.subr + +rc_usercheck=NO + +rc_start() { + ${rcexec} "${env} ${daemon} 2>&1 | logger -t sh4rin &" +} + +rc_cmd $1