From 33ff1c2b7f008ecdf04411d274256457b49f4015 Mon Sep 17 00:00:00 2001 From: Nicolas Arenas Date: Mon, 11 Nov 2024 14:13:32 +0100 Subject: [PATCH] Configure Samba Configure REPO_IP --- installer/files/ogrepo-smb.conf | 8 ++++++++ installer/installer.sh | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 installer/files/ogrepo-smb.conf diff --git a/installer/files/ogrepo-smb.conf b/installer/files/ogrepo-smb.conf new file mode 100644 index 0000000..3b76b2b --- /dev/null +++ b/installer/files/ogrepo-smb.conf @@ -0,0 +1,8 @@ +[ogimages] +comment = OpenGnsys Repository +browseable = no +writeable = yes +locking = no +path = /opt/opengnsys/ogrepository/images +guest ok = no +valid users = %%OGREPOSITORY_USER%% diff --git a/installer/installer.sh b/installer/installer.sh index 55023b2..3d18c7e 100644 --- a/installer/installer.sh +++ b/installer/installer.sh @@ -5,6 +5,9 @@ set -e GIT_BRANCH=$1 GIT_REPO=https://ognproject.evlt.uma.es/gitea/opengnsys/ogrepository.git GIT_SSL_NO_VERIFY=true +REPO_IP=${REPO_IP:-"127.0.0.1"} +SMBUSER=${SMBUSER:-"ogrepository"} +SMBPASS=${SMBPASS:-"ogrepository"} INSTALL_DIR=/opt/opengnsys/ogrepository DOWNLOAD_DIR=/tmp/ogrepository DEBIAN_FRONTEND=noninteractive @@ -75,6 +78,17 @@ install_files() { cp -pr $DOWNLOAD_DIR/etc/* $INSTALL_DIR/etc/ cp -pr $DOWNLOAD_DIR/api/* $INSTALL_DIR/api/ chown -R ogrepository:ogrepository $INSTALL_DIR + echo IPlocal="$REPO_IP" > $INSTALL_DIR/etc/ogAdmRepo.cfg +} + +configure_samba() { + echo "include = /etc/samba/smb.conf.ogrepository" >> /etc/samba/smb.conf + cp $DOWNLOAD_DIR/installer/files/ogrepo-smb.conf /etc/samba/smb.conf.ogrepository + sed -i "s/%%OGREPOSITORY_USER%%/$SMBUSER/g" /etc/samba/smb.conf.ogrepository + systemctl restart smbd + # Create default user ogrepository + (echo $SMBPASS; echo $SMBPASS) | smbpasswd -s -a $SMBUSER + } ## Main program @@ -89,6 +103,6 @@ install_updcast create_directories install_files install_ogrepo-api_service - +configure_samba