instalación en OpenBSD

This commit is contained in:
sergio 2022-10-25 10:24:41 +02:00
parent b0b095b763
commit 36321fd104
2 changed files with 49 additions and 0 deletions

32
INSTALL.md Normal file
View File

@ -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
```

17
sh4rin-openbsd-rc.d Normal file
View File

@ -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