Compare commits
9 Commits
311ecc7f3a
...
5406e67b95
Author | SHA1 | Date |
---|---|---|
|
5406e67b95 | |
|
15769dde0f | |
|
f8cb868a2a | |
|
4316217faa | |
|
b77aa1fc4d | |
|
d7869c35b7 | |
|
8af857c9ef | |
|
48d10b7cd9 | |
|
90fd5b274f |
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue