adjust paths for post install
ogboot/pipeline/tag This commit looks good Details

main
Nicolas Arenas 2025-03-26 14:17:44 +01:00
parent 7025eebc52
commit 2af4b40d22
1 changed files with 15 additions and 13 deletions

View File

@ -7,6 +7,8 @@ set -e
. /usr/share/debconf/confmodule
# Leer las variables de configuración
OGBOOT_ROOT="/opt/opengnsys/ogboot"
OGBOOT_API_DIR="/opt/opengnsys/ogboot/api"
OGBOOT_DIR="/opt/opengnsys/ogboot/api"
db_get opengnsys/ogboot_ip
OGBOOT_IP="$RET"
@ -50,7 +52,7 @@ configure_sudo() {
if [ ! -f /etc/sudoers.d/opengnsys ]; then
cp /opt/opengnsys/ogboot/etc/ogboot.sudoers /etc/sudoers.d/opengnsys
chmod 440 /etc/sudoers.d/opengnsys
sed -i "s|__OGBOOT_TARGET__|$OGBOOT_DIR|g" /etc/sudoers.d/opengnsys
sed -i "s|__OGBOOT_TARGET__|$OGBOOT_ROOT|g" /etc/sudoers.d/opengnsys
else
echo "El archivo /etc/sudoers.d/opengnsys ya existe."
fi
@ -98,19 +100,19 @@ install_oglive(){
configure_ipxe(){
echo "Configure ipxe templates"
cp $OGBOOT_DIR/etc/dhcp_boot.ipxe.tmpl $OGBOOT_DIR/tftpboot/ipxe_scripts/dhcp_boot.ipxe
cp $OGBOOT_DIR/etc/default.ipxe.tmpl $OGBOOT_DIR/tftpboot/ipxe_scripts/default.ipxe
sed -i "s|__SERVERIP__|$OGBOOT_IP|g" $OGBOOT_DIR/tftpboot/ipxe_scripts/dhcp_boot.ipxe
sed -i "s|__SERVERIP__|$OGBOOT_IP|g" $OGBOOT_DIR/tftpboot/ipxe_scripts/default.ipxe
cp $OGBOOT_ROOT/etc/dhcp_boot.ipxe.tmpl $OGBOOT_ROOT/tftpboot/ipxe_scripts/dhcp_boot.ipxe
cp $OGBOOT_ROOT/etc/default.ipxe.tmpl $OGBOOT_ROOT/tftpboot/ipxe_scripts/default.ipxe
sed -i "s|__SERVERIP__|$OGBOOT_IP|g" $OGBOOT_ROOT/tftpboot/ipxe_scripts/dhcp_boot.ipxe
sed -i "s|__SERVERIP__|$OGBOOT_IP|g" $OGBOOT_ROOT/tftpboot/ipxe_scripts/default.ipxe
echo "Instalando ipxe"
git clone $IPXE_REPO /tmp/ipxe_repo
if [ ! -f $OGBOOT_DIR/tftpboot/undionly.kpxe ]; then
if [ ! -f $OGBOOT_ROOT/tftpboot/undionly.kpxe ]; then
cd /tmp/ipxe_repo/src
make -s bin/undionly.kpxe EMBED=$OGBOOT_DIR/tftpboot/ipxe_scripts/dhcp_boot.ipxe
make -s bin-x86_64-efi/ipxe.efi EMBED=$OGBOOT_DIR/tftpboot/ipxe_scripts/dhcp_boot.ipxe
cp bin/undionly.kpxe $OGBOOT_DIR/tftpboot/
cp bin-x86_64-efi/ipxe.efi $OGBOOT_DIR/tftpboot/
make -s bin/undionly.kpxe EMBED=$OGBOOT_ROOT/tftpboot/ipxe_scripts/dhcp_boot.ipxe
make -s bin-x86_64-efi/ipxe.efi EMBED=$OGBOOT_ROOT/tftpboot/ipxe_scripts/dhcp_boot.ipxe
cp bin/undionly.kpxe $OGBOOT_ROOT/tftpboot/
cp bin-x86_64-efi/ipxe.efi $OGBOOT_ROOT/tftpboot/
fi
}
@ -133,11 +135,11 @@ configure_nginx_and_fpm() {
PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')
if [ ! -f /etc/nginx/sites-available/ogboot.conf ]; then
cp /opt/opengnsys/ogboot/etc/nginxServer.conf.tmpl /etc/nginx/sites-available/ogboot.conf
sed -i "s|__ROOT__|$OGBOOT_DIR|g" /etc/nginx/sites-available/ogboot.conf
sed -i "s|__ROOT__|$OGBOOT_API_DIR|g" /etc/nginx/sites-available/ogboot.conf
sed -i "s|__PHPVERSION__|$PHP_VERSION|g" /etc/nginx/sites-available/ogboot.conf
sed -i "s|__SERVERIP__|$OGBOOT_IP|g" /etc/nginx/sites-available/ogboot.conf
sed -i "s|__PORT__|$OGBOOT_PORT|g" /etc/nginx/sites-available/ogboot.conf
sed -i "s|__TFTPPATH__|$OGBOOT_DIR/tftpboot|g" /etc/nginx/sites-available/ogboot.conf
sed -i "s|__TFTPPATH__|$OGBOOT_ROOT/tftpboot|g" /etc/nginx/sites-available/ogboot.conf
ln -s /etc/nginx/sites-available/ogboot.conf /etc/nginx/sites-enabled/ogboot.conf
else
echo "El archivo /etc/nginx/sites-available/opengnsys ya existe."
@ -153,7 +155,7 @@ configure_samba(){
echo "Configurando Samba"
mkdir -p /etc/samba/opengnsys/
cp /opt/opengnsys/ogboot/etc/samba/smb-ogboot.conf /etc/samba/opengnsys/
sed -i "s|__OGBOOT_DIR__|$OGBOOT_DIR|g" /etc/samba/opengnsys/smb-ogboot.conf
sed -i "s|__OGBOOT_DIR__|$OGBOOT_ROOT|g" /etc/samba/opengnsys/smb-ogboot.conf
INCLUDE_LINE="include = /etc/samba/opengnsys/smb-ogboot.conf"
if ! grep -q "$INCLUDE_LINE" /etc/samba/smb.conf; then
echo "$INCLUDE_LINE" | sudo tee -a /etc/samba/smb.conf > /dev/null