-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-rpm-repo.sh
More file actions
executable file
·42 lines (34 loc) · 1.13 KB
/
Copy pathupdate-rpm-repo.sh
File metadata and controls
executable file
·42 lines (34 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -e
# Configuración
GPG_KEY_ID="repo@inled.es"
RPM_DIR="public/rpm"
echo "=== Configurando repositorio RPM (DNF/YUM) ==="
# Asegurar directorios
mkdir -p "$RPM_DIR"
# Añadir paquetes RPM desde la carpeta 'incoming'
if [ -d "incoming" ] && [ "$(ls -A incoming/*.rpm 2>/dev/null)" ]; then
echo "Añadiendo nuevos paquetes RPM..."
cp incoming/*.rpm "$RPM_DIR/"
rm -rf incoming/*.rpm
fi
# Verificar si hay paquetes para procesar
if [ ! "$(ls -A "$RPM_DIR"/*.rpm 2>/dev/null)" ]; then
echo "No hay paquetes RPM en $RPM_DIR. Saltando generación de metadatos."
exit 0
fi
# Generar metadatos del repositorio
echo "Generando metadatos con createrepo_c..."
createrepo_c --update "$RPM_DIR"
# Firmar los metadatos (repomd.xml)
echo "Firmando repomd.xml..."
REPOMD_FILE="$RPM_DIR/repodata/repomd.xml"
if [ -f "$REPOMD_FILE" ]; then
rm -f "$REPOMD_FILE.asc"
gpg --batch --yes --armor --detach-sign --default-key "$GPG_KEY_ID" "$REPOMD_FILE"
echo "Metadatos firmados correctamente."
else
echo "ERROR: No se encontró $REPOMD_FILE"
exit 1
fi
echo "Repositorio RPM actualizado con éxito en '$RPM_DIR/'"