36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Asegurarse de que el usuario exista
|
|
USER="opengnsys"
|
|
|
|
|
|
# Provisionar base de datos si es necesario en caso de instalación.
|
|
|
|
|
|
# Detectar si es una instalación nueva o una actualización
|
|
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
|
systemd-run --no-block /bin/bash -c "sleep 10; apt update -y && apt install -y bittorrent bittornado ctorrent"
|
|
sed -i "s/%%OGREPOSITORY_USER%%/$USER/g" /etc/systemd/system/ogrepo-api.service
|
|
sed -i "s/%%OGREPOSITORY_USER%%/$USER/g" /etc/samba/smb.conf.ogrepository
|
|
echo "include = /etc/samba/smb.conf.ogrepository" >> /etc/samba/smb.conf
|
|
systemctl enable ogrepo-api
|
|
systemctl restart smbd
|
|
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
|
|
echo "Actualización desde la versión $2"
|
|
fi
|
|
|
|
# Cambiar la propiedad de los archivos al usuario especificado
|
|
chown opengnsys:www-data /opt/opengnsys/
|
|
chown -R opengnsys:www-data /opt/opengnsys/ogrepository
|
|
|
|
# Install http server stuff
|
|
# Reiniciar servicios si es necesario
|
|
# systemctl restart nombre_del_servicio
|
|
|
|
systemctl daemon-reload
|
|
systemctl restart ogrepo-api
|
|
|
|
exit 0
|