first commit

This commit is contained in:
2026-07-16 12:26:50 +02:00
commit cb625fc0f9
2 changed files with 338 additions and 0 deletions
Vendored
+112
View File
@@ -0,0 +1,112 @@
pipeline {
agent any
environment {
ROOTFS_ARTIFACT = "espos-openrc-rootfs.tar.xz"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Install dependencies') {
steps {
sh '''
sudo apt update
sudo apt install -y \
debootstrap \
xz-utils \
tar \
ca-certificates
'''
}
}
stage('Build rootfs') {
steps {
sh '''
chmod +x build-rootfs.sh
sudo ./build-rootfs.sh
'''
}
}
stage('Verify artifact') {
steps {
sh '''
test -f ${ROOTFS_ARTIFACT}
ls -lh ${ROOTFS_ARTIFACT}
'''
}
}
stage('Archive artifact') {
steps {
archiveArtifacts \
artifacts: "${ROOTFS_ARTIFACT}",
fingerprint: true
}
}
}
post {
success {
echo "RootFS EspOS generado y guardado como artifact"
}
failure {
echo "Error generando rootfs"
}
}
}
+226
View File
@@ -0,0 +1,226 @@
#!/usr/bin/env bash
set -euo pipefail
# ==========================================
# EspOS OpenRC RootFS Builder
# Debian 13 Trixie + EspOS unstable
#
# Genera:
# espos-openrc-rootfs.tar.xz
#
# No incluye:
# - live user
# - escritorio
# - instalador
# - configuración ISO
# ==========================================
ARCH="amd64"
DEBIAN_SUITE="trixie"
DEBIAN_MIRROR="http://deb.debian.org/debian"
ESPOS_REPO="https://repo.espos.dev"
ESPOS_SUITE="espos-unstable"
ROOTFS="$(pwd)/rootfs"
OUTPUT="espos-openrc-rootfs.tar.xz"
# Paquete keyring generado previamente
KEYRING_PACKAGE="espos-archive-keyring"
# Nombre del keyring instalado por el paquete
KEYRING_PATH="/usr/share/keyrings/espos-archive-keyring.gpg"
BASE_PACKAGES="
bash
coreutils
sudo
ca-certificates
locales
tzdata
curl
wget
openssh-server
openrc
dbus
elogind
"
ESPOS_PACKAGES="
base-files
"
cleanup()
{
echo "[+] Desmontando sistemas virtuales"
umount -lf "$ROOTFS/dev/pts" 2>/dev/null || true
umount -lf "$ROOTFS/dev" 2>/dev/null || true
umount -lf "$ROOTFS/proc" 2>/dev/null || true
umount -lf "$ROOTFS/sys" 2>/dev/null || true
}
trap cleanup EXIT
echo "[+] Eliminando rootfs anterior"
rm -rf "$ROOTFS"
echo "[+] Creando Debian ${DEBIAN_SUITE}"
debootstrap \
--arch="$ARCH" \
"$DEBIAN_SUITE" \
"$ROOTFS" \
"$DEBIAN_MIRROR"
echo "[+] Copiando resolv.conf"
cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf"
echo "[+] Montando pseudo filesystems"
mount --bind /dev "$ROOTFS/dev"
mount --bind /dev/pts "$ROOTFS/dev/pts"
mount -t proc proc "$ROOTFS/proc"
mount -t sysfs sys "$ROOTFS/sys"
echo "[+] Preparando repo EspOS temporal"
cat > "$ROOTFS/etc/apt/sources.list.d/espos.list" <<EOF
deb [trusted=yes] ${ESPOS_REPO} ${ESPOS_SUITE} main
EOF
echo "[+] Cargando repo..."
chroot "$ROOTFS" apt update
echo "[+] Instalando keyring"
chroot "$ROOTFS" apt install -y espos-archive-keyring
echo "[+] Cambiando repo a signed-by"
cat > "$ROOTFS/etc/apt/sources.list.d/espos.list" <<EOF
deb [signed-by=${KEYRING_PATH}] ${ESPOS_REPO} ${ESPOS_SUITE} main
EOF
echo "[+] Actualizando repositorios firmados"
chroot "$ROOTFS" apt update
echo "[+] Instalando sistema base"
chroot "$ROOTFS" apt install -y \
$BASE_PACKAGES
echo "[+] Instalando paquetes EspOS"
chroot "$ROOTFS" apt install -y \
$ESPOS_PACKAGES
echo "[+] Configurando OpenRC como init"
ln -sf /sbin/openrc-init "$ROOTFS/sbin/init"
echo "[+] Eliminando systemd"
chroot "$ROOTFS" apt purge -y \
systemd \
systemd-sysv \
2>/dev/null || true
echo "[+] Configurando hostname"
echo "espos" > "$ROOTFS/etc/hostname"
echo "[+] Configurando locales"
chroot "$ROOTFS" bash -c "
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
locale-gen
"
echo "[+] Habilitando servicios base OpenRC"
chroot "$ROOTFS" rc-update add devfs sysinit || true
chroot "$ROOTFS" rc-update add procfs boot || true
chroot "$ROOTFS" rc-update add sysfs boot || true
echo "[+] Limpiando APT"
chroot "$ROOTFS" apt clean
rm -rf "$ROOTFS/var/lib/apt/lists/*"
rm -rf "$ROOTFS/tmp/*"
echo "[+] Creando rootfs comprimido"
tar \
--numeric-owner \
-C "$ROOTFS" \
-cJf "$OUTPUT" .
echo
echo "======================================"
echo " EspOS OpenRC rootfs creado"
echo
echo " $OUTPUT"
echo "======================================"