Fix problem with multiple includes in samba.conf

pull/9/head
Nicolas Arenas 2025-03-12 19:43:10 +01:00
parent 703c28e4ce
commit 65a38b38f2
2 changed files with 6 additions and 2 deletions

View File

@ -145,8 +145,6 @@ configure_nginx_and_fpm() {
configure_samba(){
echo "Configurando Samba"
dpkg-divert --package ogboot --add --rename --divert /etc/samba/smb.conf.orig /etc/samba/smb.conf
cp /etc/samba/smb.conf.orig /etc/samba/smb.conf
mkdir -p /etc/samba/opengsys/
cp /opt/opengnsys/ogboot/etc/samba/smb-ogboot.conf /etc/samba/opengsys/
sed -i "s|__OGBOOT_DIR__|$OGBOOT_DIR|g" /etc/samba/opengsys/smb-ogboot.conf

View File

@ -15,4 +15,10 @@ if [ "$1" = "remove" ]; then
# Eliminar la desviación
dpkg-divert --remove --rename "$CONFIG_FILE"
# Eliminar la linea de inclusión de samba en smb.conf si existe
INCLUDE_LINE="include = /etc/samba/opengnsys/smb_ogboot.conf"
if grep -q "$INCLUDE_LINE" /etc/samba/smb.conf; then
sed -i "/$INCLUDE_LINE/d" /etc/samba/smb.conf
fi
fi