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