Compare commits

...

9 Commits

Author SHA1 Message Date
Nicolas Arenas 5406e67b95 Add sudo file
ogrepository/pipeline/tag This commit looks good Details
2025-04-01 15:03:11 +02:00
Nicolas Arenas 15769dde0f Fix version in ogrepository
ogrepository/pipeline/tag There was a failure building this commit Details
2025-04-01 15:00:24 +02:00
Nicolas Arenas f8cb868a2a Fix version in ogrepository
ogrepository/pipeline/tag This commit looks good Details
2025-04-01 14:56:30 +02:00
Nicolas Arenas 4316217faa Updated post and pre scripts
ogrepository/pipeline/tag This commit looks good Details
2025-04-01 14:36:47 +02:00
Nicolas Arenas b77aa1fc4d Fixing sudo
ogrepository/pipeline/tag This commit looks good Details
2025-04-01 14:30:33 +02:00
Nicolas Arenas d7869c35b7 Updated jenkinsfile
ogrepository/pipeline/tag This commit looks good Details
2025-03-27 08:51:02 +01:00
Nicolas Arenas 8af857c9ef Updated jenkinsfile
ogrepository/pipeline/tag There was a failure building this commit Details
2025-03-27 08:47:39 +01:00
Nicolas Arenas 48d10b7cd9 Fix samba config problem
ogrepository/pipeline/tag This commit looks good Details
2025-03-26 19:53:43 +01:00
Gerardo GIl Elizeire 90fd5b274f Merge pull request 'refs #1733 - Add 'Rename Image' functionality' (#36) from add_python_scripts into main
ogrepository/pipeline/tag This commit looks good Details
ogrepository/pipeline/head This commit looks good Details
Reviewed-on: #36
2025-03-25 14:14:23 +01:00
6 changed files with 63 additions and 22 deletions

View File

@ -51,13 +51,8 @@ pipeline {
stage('Build') {
steps {
dir("${env.BUILD_DIR}") {
sh '''
dpkg-buildpackage -us -uc
mkdir -p ../artifacts && mv ../*.deb ../*.changes ../*.buildinfo ../artifacts/
ssh aptly@172.17.8.68 "rm -rf /var/tmp/opengnsys/debian-repo/ogrepository && mkdir -p /var/tmp/opengnsys/debian-repo/ogrepository"
scp -r ../artifacts/* aptly@172.17.8.68:/var/tmp/opengnsys/debian-repo/ogrepository
'''
script {
construirPaquete(env.BUILD_DIR, "../artifacts", "172.17.8.68", "/var/tmp/opengnsys/debian-repo/ogrepository")
}
}
}
@ -69,7 +64,11 @@ pipeline {
}
agent { label 'debian-repo' }
steps {
sh "aptly repo add opengnsys-devel /var/tmp/opengnsys/debian-repo/ogrepository/*.deb"
script {
// Construir el patrón de versión esperado en el nombre del paquete
def versionPattern = "${env.TAG_NAME}-${env.BUILD_NUMBER}"
publicarEnAptly('/var/tmp/opengnsys/debian-repo/ogrepository', 'opengnsys-devel', versionPattern)
}
}
}
}

2
debian/control vendored
View File

@ -8,6 +8,6 @@ Build-Depends: debhelper-compat (= 12)
Package: ogrepository
Architecture: all
Pre-Depends: debian-archive-keyring , debconf (>= 1.5.0),
Depends: ${misc:Depends}, git, python3, python3-pip, python3-flask, python3-paramiko, python3-psutil, python3-flasgger, samba, gunicorn, wakeonlan , lzop , partclone , qemu-utils , udpcast
Depends: ${misc:Depends}, git, python3, python3-pip, python3-flask, python3-paramiko, python3-psutil, python3-flasgger, samba, gunicorn, wakeonlan , lzop , partclone , qemu-utils , udpcast, uftp
Description: Ogrepsoitory Package
This package provides Ogrepsoitory service.

View File

@ -56,13 +56,12 @@ done
if [ -f /etc/samba/smb.conf ]; then
dpkg-divert --package ogrepository --add --rename --divert /etc/samba/smb.conf.orig /etc/samba/smb.conf
cp /etc/samba/smb.conf.orig /etc/samba/smb.conf
if ! grep -q "include = /etc/samba/ogrepo-smb.conf" /etc/samba/smb.conf; then
echo "include = /etc/samba/ogrepo-smb.conf" >> /etc/samba/smb.conf
fi
(echo "$SAMBA_PASS"; echo "$SAMBA_PASS") | smbpasswd -a $SAMBA_USER
fi
# Incluir el archivo de configuración de samba si no está incluido ya
if ! grep -q "include = /etc/samba/ogrepo-smb.conf" /etc/samba/smb.conf; then
echo "include = /etc/samba/ogrepo-smb.conf" >> /etc/samba/smb.conf
fi
(echo "$SAMBA_PASS"; echo "$SAMBA_PASS") | smbpasswd -a $SAMBA_USER
# Configure Repo
@ -70,13 +69,26 @@ done
sed -i "s/SERVERIP/$OGREPO_IP/g" /opt/opengnsys/ogrepository/etc/ogAdmRepo.cfg
sed -i "s/OGCOREIP/$OGCORE_IP/g" /opt/opengnsys/ogrepository/etc/ogAdmRepo.cfg
# Copiar sudoers file ogrepository/etc/opengnsys-repository
cp /opt/opengnsys/ogrepository/etc/opengnsys-repository /etc/sudoers.d/opengnsys
elif [ "$1" = "configure" ] && [ -n "$2" ]; then
echo "Actualización desde la versión $2"
# Recopy static files without configuration
cp /opt/opengnsys/ogrepository/etc/opengnsys-repository /etc/sudoers.d/opengnsys-repository
OPENGNSYS_HOME=$(getent passwd opengnsys | cut -d: -f6)
# Create .ssh directory
mkdir -p $OPENGNSYS_HOME/.ssh
# Copy ssh keys
cp /opt/opengnsys/ogrepository/etc/opengnsys $OPENGNSYS_HOME/.ssh/id_ed25519
cp /opt/opengnsys/ogrepository/etc/opengnsys.pub $OPENGNSYS_HOME/.ssh/id_ed25519.pub
cat $OPENGNSYS_HOME/.ssh/id_ed25519.pub >> $OPENGNSYS_HOME/.ssh/authorized_keys
fi
# Cambiar la propiedad de los archivos al usuario especificado
chown opengnsys:www-data /opt/opengnsys/
chown -R opengnsys:www-data /opt/opengnsys/ogrepository
chmod 755 /opt/opengnsys/ogrepository/bin/
# Install http server stuff
# Reiniciar servicios si es necesario

View File

@ -2,19 +2,13 @@
set -e
NGINX_FILE="/etc/nginx/sites-enabled/oggui.conf"
UNIT_FILE="/etc/systemd/system/oggui.service"
UNIT_FILE="/etc/systemd/system/ogrepo-api.service"
case "$1" in
remove)
echo "El paquete se está desinstalando..."
# Aquí puedes hacer limpieza de archivos o servicios
if [ -L "$NGINX_FILE" ]; then
rm -f "$NGINX_FILE"
systemctl restart nginx
fi
if [ -L "$UNIT_FILE" ]; then
rm -f "$UNIT_FILE"
systemctl daemon-reload

View File

@ -44,11 +44,18 @@ case "$1" in
rm -f /var/lib/dpkg/info/ogrepository.post-invoke
fi
# Remove sudoers file
if [ -f /etc/sudoers.d/opengnsys-repository ]; then
echo "Removing sudoers file..."
rm -f /etc/sudoers.d/opengnsys-repository
fi
echo "Limpieza completada."
;;
upgrade|deconfigure)
# No hacer nada en actualización o desconfiguración
;;
*)

View File

@ -0,0 +1,29 @@
# Variables para facilitar la lectura
Cmnd_Alias MOUNT_RECOVERY = \
/usr/bin/mkdir -p /mnt/recovery, \
/usr/bin/mount /dev/* /mnt/recovery, \
/usr/bin/mount --bind /dev /mnt/recovery/dev, \
/usr/bin/mount --bind /proc /mnt/recovery/proc, \
/usr/bin/mount --bind /sys /mnt/recovery/sys, \
/usr/bin/umount /mnt/recovery/dev, \
/usr/bin/umount /mnt/recovery/proc, \
/usr/bin/umount /mnt/recovery/sys, \
/usr/bin/umount -l /mnt/recovery
Cmnd_Alias CHROOT_GRUB = \
/usr/sbin/chroot /mnt/recovery /usr/sbin/grub-install --target=i386-pc *, \
/usr/sbin/chroot /mnt/recovery /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg
Cmnd_Alias LOOP_KPARTX = \
/usr/sbin/losetup -d *, \
/usr/sbin/kpartx -av /opt/opengnsys/ogrepository/images_virtual/*, \
/usr/sbin/kpartx -d /opt/opengnsys/ogrepository/images_virtual/*, \
/usr/sbin/blkid /dev/mapper/*
Cmnd_Alias KILL_BT = \
/usr/bin/pkill -9 btlaunchmany, \
/usr/bin/pkill -9 bttrack, \
/usr/bin/kill -9 *
# Permitir al usuario opengnsys ejecutar estos comandos sin contraseña
opengnsys ALL=(root) NOPASSWD: MOUNT_RECOVERY, CHROOT_GRUB, LOOP_KPARTX, KILL_BT