Update gitignore file #10
|
@ -0,0 +1,47 @@
|
||||||
|
# In all environments, the following files are loaded if they exist,
|
||||||
|
# the latter taking precedence over the former:
|
||||||
|
#
|
||||||
|
# * .env contains default values for the environment variables needed by the app
|
||||||
|
# * .env.local uncommitted file with local overrides
|
||||||
|
# * .env.$APP_ENV committed environment-specific defaults
|
||||||
|
# * .env.$APP_ENV.local uncommitted environment-specific overrides
|
||||||
|
#
|
||||||
|
# Real environment variables win over .env files.
|
||||||
|
#
|
||||||
|
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
|
||||||
|
# https://symfony.com/doc/current/configuration/secrets.html
|
||||||
|
#
|
||||||
|
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
|
||||||
|
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
||||||
|
|
||||||
|
###> symfony/framework-bundle ###
|
||||||
|
APP_ENV=prod
|
||||||
|
APP_SECRET=d423d1302b974417d415b10bcde25767
|
||||||
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
|
###> doctrine/doctrine-bundle ###
|
||||||
|
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
||||||
|
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
||||||
|
#
|
||||||
|
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||||
|
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"
|
||||||
|
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
|
||||||
|
###< doctrine/doctrine-bundle ###
|
||||||
|
|
||||||
|
###> symfony/messenger ###
|
||||||
|
# Choose one of the transports below
|
||||||
|
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
|
||||||
|
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
|
||||||
|
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
||||||
|
###< symfony/messenger ###
|
||||||
|
|
||||||
|
###> symfony/mailer ###
|
||||||
|
# MAILER_DSN=null://null
|
||||||
|
###< symfony/mailer ###
|
||||||
|
|
||||||
|
### Opengnsys Variables
|
||||||
|
#
|
||||||
|
OGCORE_API_URL="https://127.0.0.1:8443"
|
||||||
|
OGBOOT_IP="127.0.0.1"
|
||||||
|
OGBOOT_PORT="8082"
|
||||||
|
|
|
@ -19,3 +19,10 @@
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
/phpunit.xml
|
/phpunit.xml
|
||||||
###< symfony/phpunit-bridge ###
|
###< symfony/phpunit-bridge ###
|
||||||
|
### Debian packaging
|
||||||
|
debian/ogboot
|
||||||
|
debian/*.substvars
|
||||||
|
debian/*.log
|
||||||
|
debian/.debhelper/
|
||||||
|
debian/files
|
||||||
|
debian/*.debhelper
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
The Debian Package ogboot
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
<Comments regarding the Package.>
|
||||||
|
|
||||||
|
-- vagrant <vagrant@build> Tue, 04 Mar 2025 15:42:24 +0000
|
|
@ -0,0 +1,6 @@
|
||||||
|
ogboot for Debian
|
||||||
|
----------------
|
||||||
|
|
||||||
|
<Possible notes regarding this package - if none, delete this file.>
|
||||||
|
|
||||||
|
-- vagrant <vagrant@build> Tue, 04 Mar 2025 15:42:24 +0000
|
|
@ -0,0 +1,10 @@
|
||||||
|
ogboot for Debian
|
||||||
|
----------------
|
||||||
|
|
||||||
|
<This file describes information about the source package, see Debian policy
|
||||||
|
manual section 4.14. You WILL either need to modify or delete this file.>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- vagrant <vagrant@build> Tue, 04 Mar 2025 15:42:24 +0000
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
ogboot (1.0.1+deb-pkg20250310-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* First debian installation
|
||||||
|
* refs #1615 merge deb-package
|
||||||
|
* refs #1615 remove client stuff
|
||||||
|
* refs #1610 adds systctl in loadenviron.sh
|
||||||
|
* refs #1593 add UEFILib and python scripts
|
||||||
|
* refs #1609 set PATH and PYTHONPATH up
|
||||||
|
* fix bug ogisefiactive
|
||||||
|
* refs #1593 add python libs and executables
|
||||||
|
* updates CHANGELOG 0.6.0
|
||||||
|
* refs #1592 move client/shared files
|
||||||
|
|
||||||
|
-- Tu Nombre <tuemail@example.com> Mon, 10 Mar 2025 19:33:51 +0000
|
|
@ -0,0 +1,80 @@
|
||||||
|
Source: ogboot
|
||||||
|
Section: unknown
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: vagrant <vagrant@build>
|
||||||
|
Rules-Requires-Root: no
|
||||||
|
Build-Depends:
|
||||||
|
debhelper-compat (= 13),
|
||||||
|
Standards-Version: 4.6.2
|
||||||
|
Homepage: <insert the upstream URL, if relevant>
|
||||||
|
#Vcs-Browser: https://salsa.debian.org/debian/ogboot
|
||||||
|
#Vcs-Git: https://salsa.debian.org/debian/ogboot.git
|
||||||
|
|
||||||
|
Package: ogboot
|
||||||
|
Architecture: any
|
||||||
|
Multi-Arch: foreign
|
||||||
|
Depends:
|
||||||
|
${shlibs:Depends},
|
||||||
|
${misc:Depends},
|
||||||
|
debconf (>= 1.5.0),
|
||||||
|
nfs-common,
|
||||||
|
xorriso,
|
||||||
|
genisoimage,
|
||||||
|
syslinux,
|
||||||
|
liblzma-dev,
|
||||||
|
nginx,
|
||||||
|
arp-scan,
|
||||||
|
automake,
|
||||||
|
build-essential,
|
||||||
|
btrfs-progs,
|
||||||
|
composer,
|
||||||
|
curl,
|
||||||
|
ctorrent,
|
||||||
|
debootstrap,
|
||||||
|
g++-multilib,
|
||||||
|
gawk,
|
||||||
|
gettext,
|
||||||
|
graphviz,
|
||||||
|
grub-efi-amd64-signed,
|
||||||
|
jq,
|
||||||
|
libdbi-dev,
|
||||||
|
libdbi1t64,
|
||||||
|
libev-dev,
|
||||||
|
libjansson-dev,
|
||||||
|
liblz4-tool,
|
||||||
|
libssl-dev,
|
||||||
|
moreutils,
|
||||||
|
netpipes,
|
||||||
|
php8.3,
|
||||||
|
php8.3-bcmath,
|
||||||
|
php8.3-cli,
|
||||||
|
php8.3-curl,
|
||||||
|
php8.3-fpm,
|
||||||
|
php8.3-gd,
|
||||||
|
php8.3-ldap,
|
||||||
|
php8.3-mbstring,
|
||||||
|
php8.3-mysql,
|
||||||
|
php8.3-common,
|
||||||
|
php-pear,
|
||||||
|
php8.3-xml,
|
||||||
|
php8.3-zip,
|
||||||
|
procps,
|
||||||
|
coreutils,
|
||||||
|
rsync,
|
||||||
|
samba,
|
||||||
|
samba-common-bin,
|
||||||
|
schroot,
|
||||||
|
shim-signed,
|
||||||
|
squashfs-tools,
|
||||||
|
subversion,
|
||||||
|
tftpd-hpa,
|
||||||
|
udpcast,
|
||||||
|
unzip,
|
||||||
|
wakeonlan,
|
||||||
|
wget,
|
||||||
|
xinetd,
|
||||||
|
isolinux,
|
||||||
|
file
|
||||||
|
Conflicts: apache2
|
||||||
|
Description: Opengnsys Ogboot package
|
||||||
|
Files for the ogboot API and rest of configuration.
|
|
@ -0,0 +1,43 @@
|
||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Source: <url://example.com>
|
||||||
|
Upstream-Name: ogboot
|
||||||
|
Upstream-Contact: <preferred name and address to reach the upstream project>
|
||||||
|
|
||||||
|
Files:
|
||||||
|
*
|
||||||
|
Copyright:
|
||||||
|
<years> <put author's name and email here>
|
||||||
|
<years> <likewise for another author>
|
||||||
|
License: GPL-3.0+
|
||||||
|
|
||||||
|
Files:
|
||||||
|
debian/*
|
||||||
|
Copyright:
|
||||||
|
2025 vagrant <vagrant@build>
|
||||||
|
License: GPL-3.0+
|
||||||
|
|
||||||
|
License: GPL-3.0+
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
.
|
||||||
|
This package is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
Comment:
|
||||||
|
On Debian systems, the complete text of the GNU General
|
||||||
|
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||||
|
|
||||||
|
# Please also look if there are files or directories which have a
|
||||||
|
# different copyright/license attached and list them here.
|
||||||
|
# Please avoid picking licenses with terms that are more restrictive than the
|
||||||
|
# packaged work, as it may make Debian's contributions unacceptable upstream.
|
||||||
|
#
|
||||||
|
# If you need, there are some extra license texts available in two places:
|
||||||
|
# /usr/share/debhelper/dh_make/licenses/
|
||||||
|
# /usr/share/common-licenses/
|
|
@ -0,0 +1 @@
|
||||||
|
ogboot
|
|
@ -0,0 +1,3 @@
|
||||||
|
README.source
|
||||||
|
README.Debian
|
||||||
|
README
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
|
db_input high opengnsys/ogboot_ip || true
|
||||||
|
db_input high opengnsys/ogboot_port || true
|
||||||
|
db_input high opengnsys/ogboot_ogcoreUrl || true
|
||||||
|
db_input high opengnsys/ogboot_ogliveUrl || true
|
||||||
|
# db_input high opengnsys/ogboot_sambaUser || true
|
||||||
|
# db_input high opengnsys/ogboot_sambaUserPass || true
|
||||||
|
|
||||||
|
db_go
|
|
@ -0,0 +1,2 @@
|
||||||
|
/opt/opengnsys/ogboot/client_log
|
||||||
|
/opt/opengnsys/ogboot/mnt
|
|
@ -0,0 +1,16 @@
|
||||||
|
bin /opt/opengnsys/ogboot
|
||||||
|
config /opt/opengnsys/ogboot/
|
||||||
|
doc /opt/opengnsys/ogboot/
|
||||||
|
docs /opt/opengnsys/ogboot/
|
||||||
|
etc /opt/opengnsys/ogboot
|
||||||
|
lib /opt/opengnsys/ogboot
|
||||||
|
public /opt/opengnsys/ogboot/
|
||||||
|
src /opt/opengnsys/ogboot/
|
||||||
|
templates /opt/opengnsys/ogboot/
|
||||||
|
tftpboot /opt/opengnsys/ogboot/
|
||||||
|
var /opt/opengnsys/ogboot/
|
||||||
|
vendor /opt/opengnsys/ogboot/
|
||||||
|
composer.json /opt/opengnsys/ogboot/
|
||||||
|
composer.lock /opt/opengnsys/ogboot/
|
||||||
|
.env.local.php /opt/opengnsys/ogboot/
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
# Cargar el módulo de configuración de debconf
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
|
# Leer las variables de configuración
|
||||||
|
OGBOOT_DIR="/opt/opengnsys/ogboot"
|
||||||
|
db_get opengnsys/ogboot_ip
|
||||||
|
OGBOOT_IP="$RET"
|
||||||
|
db_get opengnsys/ogboot_port
|
||||||
|
OGBOOT_PORT="$RET"
|
||||||
|
db_get opengnsys/ogboot_ogcoreUrl
|
||||||
|
OGCORE_API_URL="$RET"
|
||||||
|
db_get opengnsys/ogboot_ogliveUrl
|
||||||
|
OGCORE_OGLIVE_URL="$RET"
|
||||||
|
# db_get opengnsys/ogboot_sambaUser
|
||||||
|
# SAMBA_USER="$RET"
|
||||||
|
# db_get opengnsys/ogboot_sambaUserPass
|
||||||
|
# SAMBA_PASS="$RET"
|
||||||
|
|
||||||
|
|
||||||
|
IPXE_REPO="https://github.com/ipxe/ipxe.git"
|
||||||
|
|
||||||
|
# Asegurarse de que el usuario exista
|
||||||
|
USER="opengnsys"
|
||||||
|
USER_INFO=$(getent passwd "$USER")
|
||||||
|
DEFAULT_OGLIVE=$OGCORE_OGLIVE_URL
|
||||||
|
ENV_FILE=/opt/opengnsys/ogboot/.env.local.php
|
||||||
|
if [ -z "$USER_INFO" ]; then
|
||||||
|
echo "Error: El usuario '$USER' no existe." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
USER_UID=$(echo "$USER_INFO" | cut -d: -f3)
|
||||||
|
USER_GID=$(echo "$USER_INFO" | cut -d: -f4)
|
||||||
|
|
||||||
|
|
||||||
|
INSTALL_OGBOOT_TARGET="/opt/opengnsys/ogboot"
|
||||||
|
fstab_entries=(
|
||||||
|
"$INSTALL_OGBOOT_TARGET/lib/oglive.iso $INSTALL_OGBOOT_TARGET/mnt iso9660 loop,ro,users,uid=$USER_UID,gid=$USER_GID,noauto 0 0"
|
||||||
|
"/opt/opengnsys/ogboot/tftpboot/ogLive/ogclient.sqfs /tmp/ogclient_mount squashfs loop,ro,user,noauto 0 0"
|
||||||
|
)
|
||||||
|
fstab_file="/etc/fstab"
|
||||||
|
|
||||||
|
|
||||||
|
configure_sudo() {
|
||||||
|
echo "Copiando configuración de 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
|
||||||
|
else
|
||||||
|
echo "El archivo /etc/sudoers.d/opengnsys ya existe."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
add_fstab_entries(){
|
||||||
|
echo "Añadiendo entradas a /etc/fstab"
|
||||||
|
for entry in "${fstab_entries[@]}"; do
|
||||||
|
if ! grep -Fxq "$entry" "$fstab_file"; then
|
||||||
|
echo "$entry" | sudo tee -a "$fstab_file" > /dev/null
|
||||||
|
echo "Entrada añadida a /etc/fstab: $entry"
|
||||||
|
else
|
||||||
|
echo "La entrada ya existe en /etc/fstab: $entry"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
update_opengnsys_user() {
|
||||||
|
echo "Actualizando grupos del usuario opengnsys"
|
||||||
|
usermod -aG disk "$USER"
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_tftp(){
|
||||||
|
|
||||||
|
echo "Modificando el archivo tftpboot"
|
||||||
|
|
||||||
|
# Comprobar si el archivo ya está desviado
|
||||||
|
if ! dpkg-divert --list /etc/default/tftpd-hpa | grep -q "/etc/default/tftpd-hpa"; then
|
||||||
|
echo "Creando divert para /etc/default/tftpd-hpa"
|
||||||
|
dpkg-divert --add --rename --divert /etc/default/tftpd-hpa.orig /etc/default/tftpd-hpa
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copiar archivo solo si no existe en la nueva ubicación
|
||||||
|
if [ ! -f /etc/default/tftpd-hpa ]; then
|
||||||
|
echo "Copiando configuración de tftpd-hpa"
|
||||||
|
cp /opt/opengnsys/ogboot/etc/default/tftpd-hpa /etc/default/tftpd-hpa
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
install_oglive(){
|
||||||
|
echo "Download ogLive"
|
||||||
|
/opt/opengnsys/ogboot/bin/oglivecli download "$DEFAULT_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
|
||||||
|
|
||||||
|
echo "Instalando ipxe"
|
||||||
|
git clone $IPXE_REPO /tmp/ipxe_repo
|
||||||
|
if [ ! -f $OGBOOT_DIR/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/
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_api(){
|
||||||
|
echo "Modify env.local.php"
|
||||||
|
if ! dpkg-divert --list /opt/opengnsys/ogboot/.env.local.php >/dev/null 2>&1; then
|
||||||
|
dpkg-divert --add --rename --divert /opt/opengnsys/ogboot/.env.local.php.orig /opt/opengnsys/ogboot/.env.local.php
|
||||||
|
fi
|
||||||
|
if [ ! -f "/opt/opengnsys/ogboot/.env.local.php" ] && [ -f "/opt/opengnsys/ogboot/.env.local.php.orig" ]; then
|
||||||
|
cp "/opt/opengnsys/ogboot/.env.local.php.orig" "/opt/opengnsys/ogboot/.env.local.php"
|
||||||
|
fi
|
||||||
|
sed -i "s|'OGBOOT_IP' => '.*'|'OGBOOT_IP' => '$OGBOOT_IP'|" "$ENV_FILE"
|
||||||
|
sed -i "s|'OGBOOT_PORT' => '.*'|'OGBOOT_PORT' => '$OGBOOT_PORT'|" "$ENV_FILE"
|
||||||
|
sed -i "s|'OGCORE_API_URL' => '.*'|'OGCORE_API_URL' => '$OGCORE_API_URL'|" "$ENV_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_nginx_and_fpm() {
|
||||||
|
echo "Configure nginx"
|
||||||
|
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|__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
|
||||||
|
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."
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Modificando el fpm"
|
||||||
|
if [ ! -f /etc/php/$PHP_VERSION/fpm/pool.d/ogboot.conf ]; then
|
||||||
|
cp /opt/opengnsys/ogboot/etc/ogboot-fpm.conf /etc/php/$PHP_VERSION/fpm/pool.d/ogboot.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_permissions(){
|
||||||
|
echo "Cambiando la propiedad de los archivos al usuario $USER"
|
||||||
|
chown opengnsys:www-data /opt/opengnsys/
|
||||||
|
chown -R opengnsys:www-data /opt/opengnsys/ogboot
|
||||||
|
}
|
||||||
|
|
||||||
|
restart_services(){
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl restart nginx
|
||||||
|
systemctl restart tftpd-hpa
|
||||||
|
systemctl restart php8.3-fpm
|
||||||
|
systemctl restart samba
|
||||||
|
}
|
||||||
|
|
||||||
|
# Detectar si es una instalación nueva o una actualización
|
||||||
|
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
||||||
|
# Copy sudo configuration
|
||||||
|
echo "Primera instalación"
|
||||||
|
configure_sudo
|
||||||
|
add_fstab_entries
|
||||||
|
update_opengnsys_user
|
||||||
|
configure_tftp
|
||||||
|
install_oglive
|
||||||
|
configure_ipxe
|
||||||
|
configure_api
|
||||||
|
configure_nginx_and_fpm
|
||||||
|
configure_samba
|
||||||
|
|
||||||
|
|
||||||
|
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
|
||||||
|
echo "Actualización desde la versión $2"
|
||||||
|
configure_sudo
|
||||||
|
configure_tftp
|
||||||
|
configure_api
|
||||||
|
configure_nginx_and_fpm
|
||||||
|
configure_samba
|
||||||
|
fi
|
||||||
|
|
||||||
|
configure_permissions
|
||||||
|
restart_services
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CONFIG_FILE="/etc/default/tftpd-hpa"
|
||||||
|
DIVERTED_FILE="/etc/default/tftpd-hpa.orig"
|
||||||
|
|
||||||
|
if [ "$1" = "remove" ]; then
|
||||||
|
echo "Restaurando archivo de configuración original..."
|
||||||
|
|
||||||
|
# Restaurar el archivo original si existe
|
||||||
|
if [ -f "$DIVERTED_FILE" ]; then
|
||||||
|
mv "$DIVERTED_FILE" "$CONFIG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Automatically added by dh_installdebconf/13.14.1ubuntu5
|
||||||
|
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
db_purge
|
||||||
|
fi
|
||||||
|
# End automatically added section
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Asegurarse de que el usuario exista
|
||||||
|
USER="opengnsys"
|
||||||
|
HOME_DIR="/opt/opengnsys"
|
||||||
|
if id "$USER" &>/dev/null; then
|
||||||
|
echo "El usuario $USER ya existe."
|
||||||
|
else
|
||||||
|
echo "Creando el usuario $USER con home en $HOME_DIR."
|
||||||
|
useradd -m -d "$HOME_DIR" -s /bin/bash "$USER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
remove|upgrade|deconfigure)
|
||||||
|
echo "Deteniendo servicios antes de la eliminación o actualización..."
|
||||||
|
systemctl stop nginx || true
|
||||||
|
systemctl stop tftpd-hpa || true
|
||||||
|
systemctl stop php8.3-fpm || true
|
||||||
|
systemctl stop samba || true
|
||||||
|
|
||||||
|
echo "Eliminando configuraciones específicas..."
|
||||||
|
if [ "$1" = "remove" ]; then
|
||||||
|
rm -f /etc/nginx/sites-enabled/ogboot.conf
|
||||||
|
rm -f /etc/nginx/sites-available/ogboot.conf
|
||||||
|
rm -f /etc/sudoers.d/opengnsys
|
||||||
|
rm -f /etc/php/8.3/fpm/pool.d/ogboot.conf
|
||||||
|
dpkg-divert --remove --rename --divert /etc/default/tftpd-hpa.orig /etc/default/tftpd-hpa || true
|
||||||
|
dpkg-divert --remove --rename --divert /opt/opengnsys/ogboot/.env.local.php.orig /opt/opengnsys/ogboot/.env.local.php || true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,35 @@
|
||||||
|
Template: opengnsys/ogboot_ip
|
||||||
|
Type: string
|
||||||
|
Default: 192.168.1.100
|
||||||
|
Description: Introduce la IP donde se ejecutará OGBOOT
|
||||||
|
Esta IP será utilizada para la configuración del servicio.
|
||||||
|
|
||||||
|
Template: opengnsys/ogboot_port
|
||||||
|
Type: string
|
||||||
|
Default: 8082
|
||||||
|
Description: Puerto para OGBOOT
|
||||||
|
Por favor introduce el puerto donde escuchará ogBoot
|
||||||
|
|
||||||
|
Template: opengnsys/ogboot_ogcoreUrl
|
||||||
|
Type: string
|
||||||
|
Default: https://127.0.0.1:8443
|
||||||
|
Description: URL del API de ogCore
|
||||||
|
Por favor introduzca la URL donde se ejecuta ogCore
|
||||||
|
|
||||||
|
Template: opengnsys/ogboot_ogliveUrl
|
||||||
|
Type: string
|
||||||
|
Default: https://ognproject.evlt.uma.es/oglive/ogLive-noble-6.8.0-31-generic-amd64-r20250116.538e3fa_20250120.iso
|
||||||
|
Description: URL del OgLive a instalar
|
||||||
|
Por favor introduzca la URL desde donde descargar el ogLive para su uso.
|
||||||
|
|
||||||
|
Template: opengnsys/ogboot_sambaUser
|
||||||
|
Type: string
|
||||||
|
Default: opengnsys
|
||||||
|
Description: Usuario de samba para compartir tftpboot y client_log
|
||||||
|
No cambiar a no ser que se sepa lo que se esta haciendo
|
||||||
|
|
||||||
|
Template: opengnsys/ogboot_sambaUserPass
|
||||||
|
Type: password
|
||||||
|
Default: og
|
||||||
|
Description: Password del Usuario de samba para compartir tftpboot y client_log
|
||||||
|
No cambiar a no ser que se sepa lo que se esta haciendo
|
|
@ -0,0 +1,39 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
# See debhelper(7) (uncomment to enable).
|
||||||
|
# Output every command that modifies files on the build system.
|
||||||
|
#export DH_VERBOSE = 1
|
||||||
|
|
||||||
|
|
||||||
|
# See FEATURE AREAS in dpkg-buildflags(1).
|
||||||
|
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||||
|
|
||||||
|
# See ENVIRONMENT in dpkg-buildflags(1).
|
||||||
|
# Package maintainers to append CFLAGS.
|
||||||
|
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
||||||
|
# Package maintainers to append LDFLAGS.
|
||||||
|
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||||
|
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
# Ejecutar composer install durante la fase de construcción
|
||||||
|
override_dh_auto_build:
|
||||||
|
export COMPOSER_ALLOW_SUPERUSER=1
|
||||||
|
export APP_ENV=prod
|
||||||
|
dh_auto_build
|
||||||
|
rm -rf var/cache/*
|
||||||
|
composer install --no-dev --no-interaction --no-progress --optimize-autoloader
|
||||||
|
composer dump-env prod
|
||||||
|
composer update doctrine/dbal
|
||||||
|
|
||||||
|
# dh_make generated override targets.
|
||||||
|
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
|
||||||
|
#override_dh_auto_configure:
|
||||||
|
# dh_auto_configure -- \
|
||||||
|
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
|
|
@ -0,0 +1 @@
|
||||||
|
3.0 (native)
|
|
@ -0,0 +1,6 @@
|
||||||
|
# /etc/default/tftpd-hpa
|
||||||
|
|
||||||
|
TFTP_USERNAME="opengnsys"
|
||||||
|
TFTP_DIRECTORY="/opt/opengnsys/ogboot/tftpboot"
|
||||||
|
TFTP_ADDRESS="0.0.0.0:69"
|
||||||
|
TFTP_OPTIONS="--secure -v"
|
|
@ -1,44 +0,0 @@
|
||||||
{
|
|
||||||
"Dhcp4": {
|
|
||||||
"interfaces-config": {
|
|
||||||
"interfaces": "INTERFACES"
|
|
||||||
},
|
|
||||||
"subnet4": [
|
|
||||||
{
|
|
||||||
"subnet": "192.168.2.0/24",
|
|
||||||
"option-data": [
|
|
||||||
{
|
|
||||||
"name": "routers",
|
|
||||||
"code": 3,
|
|
||||||
"data": "192.168.2.1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"pools": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"option-data": [
|
|
||||||
{
|
|
||||||
"name": "domain-name-servers",
|
|
||||||
"data": "1.1.1.1,8.8.8.8"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "routers",
|
|
||||||
"data": "192.168.8.1,192.168.9.1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"client-classes": [
|
|
||||||
{
|
|
||||||
"name": "UEFI-64",
|
|
||||||
"test": "not substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'",
|
|
||||||
"boot-file-name": "ipxe.efi",
|
|
||||||
"next-server": "__SERVERIP__"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Legacy",
|
|
||||||
"test": "substring(option[60].hex,0,20) == 'PXEClient:Arch:00000'",
|
|
||||||
"boot-file-name": "undionly.kpxe",
|
|
||||||
"next-server": "__SERVERIP__"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[ogboot]
|
||||||
|
user = opengnsys
|
||||||
|
group = www-data
|
||||||
|
listen = /var/run/php/php8.3-fpm-ogboot.sock
|
||||||
|
listen.owner = opengnsys
|
||||||
|
listen.group = www-data
|
||||||
|
pm = dynamic
|
||||||
|
pm.max_children = 5
|
||||||
|
pm.start_servers = 2
|
||||||
|
pm.min_spare_servers = 1
|
||||||
|
pm.max_spare_servers = 3
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
opengnsys ALL=(ALL) NOPASSWD: /opt/bin/oglivecli
|
||||||
|
opengnsys ALL=(root) NOPASSWD: /usr/bin/chmod, /usr/bin/chown, /usr/bin/md5sum, /usr/bin/smbpasswd, /usr/bin/cat, /usr/bin/tee, /usr/bin/sed, /usr/bin/gzip, /usr/bin/lz4, /usr/bin/cpio, /usr/bin/find, /bin/tee, /usr/bin/dd, /usr/bin/mkfs.ext4, /usr/bin/rsync
|
||||||
|
opengnsys ALL=(root) NOPASSWD: __OGBOOT_TARGET__/lib/*.iso /mnt
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=oglive Daemon Service
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/python3 /opt/ogboot/bin/oglive_daemon.py
|
|
||||||
Restart=always
|
|
||||||
User=root
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
[tftpboot]
|
||||||
|
comment = OpenGnsys init files
|
||||||
|
browseable = no
|
||||||
|
writeable = no
|
||||||
|
path = __OGBOOTDIR__/tftpboot
|
||||||
|
guest ok = no
|
||||||
|
|
||||||
|
|
||||||
|
[oglog]
|
||||||
|
comment = OpenGnsys Log
|
||||||
|
browseable = no
|
||||||
|
writeable = yes
|
||||||
|
locking = no
|
||||||
|
path = __OGBOOTDIR__/client_log
|
||||||
|
guest ok = no
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
[ogclient]
|
||||||
|
comment = OpenGnsys Client
|
||||||
|
browseable = no
|
||||||
|
writeable = no
|
||||||
|
locking = no
|
||||||
|
path = __OGBOOTDIR__/client
|
||||||
|
guest ok = no
|
Loading…
Reference in New Issue