refs #988 create buildlib.sh and refactor chroot_setup
refs #989 Creates a new chroot to be deployed in disk refs #990 Minimal script to start working with yad and calamares togetheruser-story-905
parent
8cdf4a93dd
commit
07671f9834
|
@ -2,3 +2,4 @@ chroot
|
|||
image
|
||||
*.log
|
||||
*.tmp
|
||||
ubuntu_chroot
|
||||
|
|
73
builder.sh
73
builder.sh
|
@ -11,61 +11,71 @@ CLEAN=${CLEAN:-1}
|
|||
CLEAN_CHROOT=${CLEAN_CHROOT:-1}
|
||||
OUTPUT_DIR=/media/sf_Downloads/
|
||||
UBUNTU_CHROOT_DIR=$DIR/ubuntu_chroot
|
||||
DEBOOT_STRAP_URL=http://mirror.raiolanetworks.com/ubuntu/
|
||||
|
||||
|
||||
export PASSWD_FILE
|
||||
|
||||
## FUNCIONES
|
||||
function exec_as_sudo () {
|
||||
cat $PASSWD_FILE | sudo -S $@
|
||||
}
|
||||
|
||||
function exec_as_sudo_in_chroot () {
|
||||
exec_as_sudo chroot $CHROOT_DIR $@
|
||||
local CHROOT=$1
|
||||
shift
|
||||
exec_as_sudo chroot $CHROOT $@
|
||||
}
|
||||
|
||||
function umount_in_chroot() {
|
||||
if grep $CHROOT_DIR$1 /etc/mtab;
|
||||
local CHROOT=$2
|
||||
local PART=$1
|
||||
if grep $CHROOT$PART /etc/mtab;
|
||||
then
|
||||
echo "Unmounting $1"
|
||||
exec_as_sudo_in_chroot umount $1
|
||||
echo "Unmounting $PART in chroot $CHROOT"
|
||||
exec_as_sudo_in_chroot $CHROOT umount $PART
|
||||
return $?
|
||||
fi
|
||||
echo "Mount point $1 not found"
|
||||
echo "Mount point $PART not found"
|
||||
return 0
|
||||
}
|
||||
|
||||
function umount_in_host() {
|
||||
if findmnt -M $1
|
||||
local PART=$1
|
||||
if findmnt -M $PART
|
||||
then
|
||||
echo "Unmounting $1"
|
||||
exec_as_sudo umount $1
|
||||
echo "Unmounting $PART"
|
||||
exec_as_sudo umount $PART
|
||||
return $?
|
||||
fi
|
||||
echo "Mount point $1 not found"
|
||||
echo "Mount point $PART not found"
|
||||
return 0
|
||||
}
|
||||
|
||||
function deploy_installer() {
|
||||
exec_as_sudo mkdir -p $CHROOT_DIR/root/scripts
|
||||
exec_as_sudo cp openGnsys-installer.sh $CHROOT_DIR/root/scripts/
|
||||
exec_as_sudo chmod +x $CHROOT_DIR/root/scripts/openGnsys-installer.sh
|
||||
}
|
||||
|
||||
if [ -d $CHROOT_DIR ] && [ $CLEAN -eq 1 ];
|
||||
then
|
||||
SYS_MOUNT_POINT_CHROOT="/proc /sys /dev/pts /dev"
|
||||
SYS_MOUNT_POINT="$CHROOT_DIR/dev $CHROOT_DIR/run"
|
||||
SYS_MOUNT_POINT="/dev /run"
|
||||
for i in $SYS_MOUNT_POINT_CHROOT;
|
||||
do
|
||||
umount_in_chroot $i
|
||||
umount_in_chroot $i $CHROOT_DIR
|
||||
umount_in_chroot $i $UBUNTU_CHROOT_DIR
|
||||
done
|
||||
|
||||
for i in $SYS_MOUNT_POINT;
|
||||
do
|
||||
umount_in_host $i
|
||||
umount_in_host $CHROOT_DIR$i
|
||||
umount_in_host $UBUNTU_CHROOT_DIR$i
|
||||
done
|
||||
# exec_as_sudo_in_chroot umount /proc
|
||||
# exec_as_sudo_in_chroot umount /sys
|
||||
# exec_as_sudo_in_chroot umount /dev/pts
|
||||
# exec_as_sudo umount $CHROOT_DIR/dev
|
||||
# exec_as_sudo umount $CHROOT_DIR/run
|
||||
if [ $CLEAN_CHROOT -eq 1 ];
|
||||
then
|
||||
exec_as_sudo rm -rf $CHROOT_DIR
|
||||
exec_as_sudo rm -rf $UBUNTU_CHROOT_DIR
|
||||
fi
|
||||
exec_as_sudo rm -rf image
|
||||
exec_as_sudo rm -f $OUTPUT_DIR/ubuntu-from-scratch.iso
|
||||
|
@ -74,12 +84,13 @@ fi
|
|||
mkdir -p $CHROOT_DIR
|
||||
# # Copio el script chroot_setup.sh al directorio chroot
|
||||
cp chroot_setup.sh $CHROOT_DIR
|
||||
cp buildlib.sh $CHROOT_DIR
|
||||
chmod +x $CHROOT_DIR/chroot_setup.sh
|
||||
|
||||
# # Deploy boot strap
|
||||
if [ $CLEAN_CHROOT -eq 1 ];
|
||||
then
|
||||
exec_as_sudo debootstrap --arch=amd64 --variant=$VARIANT $DIST $CHROOT_DIR http://us.archive.ubuntu.com/ubuntu/
|
||||
exec_as_sudo debootstrap --arch=amd64 --variant=$VARIANT $DIST $CHROOT_DIR $DEBOOT_STRAP_URL
|
||||
fi
|
||||
exec_as_sudo mkdir -p $CHROOT_DIR/etc/calamares/
|
||||
exec_as_sudo cp -r calamares/* $CHROOT_DIR/etc/calamares/
|
||||
|
@ -90,8 +101,8 @@ exec_as_sudo mount --bind /run/ $CHROOT_DIR/run
|
|||
|
||||
|
||||
# Execute chroot_setup.sh
|
||||
exec_as_sudo_in_chroot /chroot_setup.sh
|
||||
|
||||
exec_as_sudo_in_chroot $CHROOT_DIR /chroot_setup.sh
|
||||
deploy_installer
|
||||
|
||||
# Clean up the environment
|
||||
umount_in_host $CHROOT_DIR/dev
|
||||
|
@ -111,9 +122,25 @@ exec_as_sudo mksquashfs $CHROOT_DIR image/casper/filesystem.squashfs \
|
|||
printf $(exec_as_sudo du -sx --block-size=1 chroot | cut -f1) | sudo tee image/casper/filesystem.size
|
||||
|
||||
# Deboot strap real Ubuntu image
|
||||
exec_as_sudo debootstrap --arch=amd64 --variant=minbase noble $UBUNTU_CHROOT_DIR http://us.archive.ubuntu.com/ubuntu/
|
||||
exec_as_sudo debootstrap --arch=amd64 --variant=minbase noble $UBUNTU_CHROOT_DIR $DEBOOT_STRAP_URL
|
||||
exec_as_sudo cp setup_chroot_ubuntu.sh $UBUNTU_CHROOT_DIR
|
||||
exec_as_sudo_in_chroot $UBUNTU_CHROOT_DIR chmod +x /setup_chroot_ubuntu.sh
|
||||
exec_as_sudo cp buildlib.sh $UBUNTU_CHROOT_DIR
|
||||
|
||||
# Setup the chroot for ubuntu
|
||||
exec_as_sudo mount --bind /dev/ $UBUNTU_CHROOT_DIR/dev
|
||||
exec_as_sudo mount --bind /run/ $UBUNTU_CHROOT_DIR/run
|
||||
|
||||
exec_as_sudo_in_chroot $UBUNTU_CHROOT_DIR /setup_chroot_ubuntu.sh
|
||||
|
||||
|
||||
# Clean up the environment
|
||||
umount_in_host $UBUNTU_CHROOT_DIR/dev
|
||||
umount_in_host $UBUNTU_CHROOT_DIR/run
|
||||
|
||||
|
||||
# Compress the ububtu chroot
|
||||
exec_as_sudo mksquashfs $UBUNTU_CHROOT_DIR image/casper/filesystem.ubuntu.squashfs \
|
||||
exec_as_sudo mksquashfs $UBUNTU_CHROOT_DIR image/casper/filesystem.ubuntu.sqfs \
|
||||
-noappend -no-duplicates -no-recovery \
|
||||
-wildcards \
|
||||
-comp xz -b 1M -Xdict-size 100% \
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
function set_root_passwd(){
|
||||
echo "root:root" | chpasswd
|
||||
}
|
||||
|
||||
function setup_sources_list () {
|
||||
echo "Setting up sources.list"
|
||||
cat <<EOF > $CHROOT_DIR/etc/apt/sources.list
|
||||
deb $DEBOOT_STRAP_URL noble main restricted universe multiverse
|
||||
deb-src $DEBOOT_STRAP_URL noble main restricted universe multiverse
|
||||
|
||||
deb $DEBOOT_STRAP_URL noble-security main restricted universe multiverse
|
||||
deb-src $DEBOOT_STRAP_URL noble-security main restricted universe multiverse
|
||||
|
||||
deb $DEBOOT_STRAP_URL noble-updates main restricted universe multiverse
|
||||
deb-src $DEBOOT_STRAP_URL noble-updates main restricted universe multiverse
|
||||
EOF
|
||||
apt update -y
|
||||
apt-get -y upgrade
|
||||
}
|
||||
|
||||
function configure_divert() {
|
||||
echo "Configuring divert"
|
||||
dbus-uuidgen > /etc/machine-id
|
||||
mkdir -p /var/lib/dbus/
|
||||
ln -fs /etc/machine-id /var/lib/dbus/machine-id
|
||||
dpkg-divert --local --rename --add /sbin/initctl
|
||||
ln -s /bin/true /sbin/initctl
|
||||
}
|
||||
|
||||
function mount_proc_sys_dev() {
|
||||
echo "Mounting proc, sys and dev"
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sys /sys
|
||||
mount -t devpts devpts /dev/pts
|
||||
}
|
||||
|
||||
function install_packages() {
|
||||
echo "Installing packages"
|
||||
apt install -y $@
|
||||
}
|
||||
|
||||
|
||||
function install_non_interactive() {
|
||||
echo "Installing packages non interactive"
|
||||
apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $@
|
||||
}
|
||||
|
||||
function install_no_recommends() {
|
||||
echo "Installing packages without recommends"
|
||||
apt install -y --no-install-recommends $@
|
||||
}
|
||||
|
||||
function setup_chroot() {
|
||||
echo "Setting up chroot"
|
||||
dbus-uuidgen > /etc/machine-id
|
||||
apt update -y
|
||||
ln -fs /etc/machine-id /var/lib/dbus/machine-id
|
||||
ln -s /bin/true /sbin/initctl
|
||||
}
|
||||
|
||||
function remove_unneeded_packages() {
|
||||
echo "Removing unneeded packages"
|
||||
apt remove -y --purge --auto-remove snapd
|
||||
}
|
||||
|
||||
function reconfigure_locales() {
|
||||
echo "Configuring locales"
|
||||
sed -i 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen
|
||||
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
|
||||
locale-gen
|
||||
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
|
||||
echo "Europe/Madrid" > /etc/timezone
|
||||
dpkg-reconfigure -f noninteractive tzdata
|
||||
}
|
||||
|
||||
|
||||
function reconfigure_network_manager() {
|
||||
echo "Configuring network manager"
|
||||
mkdir -p /etc/NetworkManager
|
||||
cat <<EOF > /etc/NetworkManager/NetworkManager.conf
|
||||
[main]
|
||||
plugins=keyfile
|
||||
|
||||
[keyfile]
|
||||
unmanaged-devices=none
|
||||
EOF
|
||||
|
||||
mkdir -p /etc/NetworkManager/system-connections/
|
||||
cat <<EOL > /etc/NetworkManager/system-connections/dhcp-all.nmconnection
|
||||
[connection]
|
||||
id=Cable
|
||||
type=ethernet
|
||||
autoconnect=true
|
||||
|
||||
[ipv4]
|
||||
method=auto
|
||||
EOL
|
||||
|
||||
systemctl enable NetworkManager
|
||||
}
|
||||
|
||||
function clean (){
|
||||
truncate -s 0 /etc/machine-id
|
||||
rm /sbin/initctl
|
||||
dpkg-divert --rename --remove /sbin/initctl
|
||||
apt-get clean
|
||||
rm -rf /tmp/* ~/.bash_history
|
||||
umount /proc
|
||||
umount /sys
|
||||
umount /dev/pts
|
||||
export HISTSIZE=0
|
||||
}
|
||||
|
||||
|
||||
function user_add() {
|
||||
useradd -m -s /bin/bash -G sudo og
|
||||
echo "og:og" | chpasswd
|
||||
}
|
|
@ -8,12 +8,12 @@ extraMounts:
|
|||
mountPoint: /sys
|
||||
- device: /dev
|
||||
mountPoint: /dev
|
||||
options: bind
|
||||
options: [ bind ]
|
||||
- device: tmpfs
|
||||
fs: tmpfs
|
||||
mountPoint: /run
|
||||
- device: /run/dev
|
||||
mountPoint: /run/dev
|
||||
options: bind
|
||||
options: [ bind ]
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
unpack:
|
||||
- source: "/cdrom/casper/filesystem.ubuntu.squashfs"
|
||||
- source: "/cdrom/casper/filesystem.ubuntu.sqfs"
|
||||
sourcefs: squashfs
|
||||
destination: "/"
|
||||
|
||||
|
|
|
@ -15,12 +15,14 @@ sequence:
|
|||
- exec:
|
||||
- partition
|
||||
- mount
|
||||
- unpackfs
|
||||
- machineid
|
||||
- locale
|
||||
- keyboard
|
||||
- users
|
||||
- umount
|
||||
- initramfs
|
||||
- bootloader
|
||||
- umount
|
||||
- show:
|
||||
- finished
|
||||
|
||||
|
|
187
chroot_setup.sh
187
chroot_setup.sh
|
@ -4,112 +4,76 @@ set -x
|
|||
set -e
|
||||
export HOME=/root
|
||||
export LC_ALL=C
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DEBOOT_STRAP_URL=http://mirror.raiolanetworks.com/ubuntu/
|
||||
|
||||
function set_root_passwd(){
|
||||
echo "root:root" | chpasswd
|
||||
}
|
||||
source buildlib.sh
|
||||
|
||||
function setup_sources_list () {
|
||||
echo "Setting up sources.list"
|
||||
cat <<EOF > $CHROOT_DIR/etc/apt/sources.list
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse
|
||||
deb-src http://us.archive.ubuntu.com/ubuntu/ noble main restricted universe multiverse
|
||||
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
|
||||
deb-src http://us.archive.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse
|
||||
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse
|
||||
deb-src http://us.archive.ubuntu.com/ubuntu/ noble-updates main restricted universe multiverse
|
||||
function configure_sddm() {
|
||||
# Allow root login
|
||||
sed -ie 's/^\(.*root quiet_success\)$/#\1/' /etc/pam.d/sddm
|
||||
|
||||
# Start pcman for the Desktop
|
||||
mkdir -p /root/.config/autostart/
|
||||
cat <<EOF > /root/.config/autostart/pcmanfm.desktop
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=pcmanfm --desktop
|
||||
Hidden=false
|
||||
NoDisplay=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
Name=PCManFM
|
||||
Comment=Lanzr PcManFm en el inicio de sesion
|
||||
EOF
|
||||
apt update -y
|
||||
apt-get -y upgrade
|
||||
|
||||
# Configure root autologin
|
||||
cat <<EOF > /etc/sddm.conf
|
||||
[Autologin]
|
||||
User=root
|
||||
Session=openbox
|
||||
|
||||
[Users]
|
||||
MinimumUid=0
|
||||
EOF
|
||||
# Create desktop launcher for calamares
|
||||
mkdir -p /root/Desktop
|
||||
cat <<EOF > /root/Desktop/opengnsys-installer.desktop
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=Install OpenGnsys
|
||||
Comment=Este es un acceso directo para ejecutar un script como root
|
||||
Exec=/root/scripts/openGnsys-installer.sh
|
||||
Icon=system-installer
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Utility;
|
||||
|
||||
EOF
|
||||
chmod +x /root/Desktop/opengnsys-installer.desktop
|
||||
}
|
||||
|
||||
function configure_divert() {
|
||||
echo "Configuring divert"
|
||||
dbus-uuidgen > /etc/machine-id
|
||||
ln -fs /etc/machine-id /var/lib/dbus/machine-id
|
||||
dpkg-divert --local --rename --add /sbin/initctl
|
||||
ln -s /bin/true /sbin/initctl
|
||||
}
|
||||
function create_desktop_installer() {
|
||||
mkdir -p /etc/skel/Desktop/
|
||||
cat <<EOF > /etc/skel/Desktop/install.desktop
|
||||
[Desktop Entry]
|
||||
Name=Install Opengnsys
|
||||
Commnet=Start the OpenGnsys installer
|
||||
Exec=calamares
|
||||
Type=Application
|
||||
Icon=system-installer
|
||||
Categories=System;Installer;
|
||||
Terminal=false
|
||||
|
||||
function mount_proc_sys_dev() {
|
||||
echo "Mounting proc, sys and dev"
|
||||
mount -t proc proc /proc
|
||||
mount -t sysfs sys /sys
|
||||
mount -t devpts devpts /dev/pts
|
||||
}
|
||||
EOF
|
||||
|
||||
function install_packages() {
|
||||
echo "Installing packages"
|
||||
apt install -y $@
|
||||
}
|
||||
|
||||
|
||||
function set_pkg_configuration() {
|
||||
echo "keyboard-configuration keyboard-configuration/layout select Spanish" | debconf-set-selections
|
||||
echo "keyboard-configuration keyboard-configuration/variant select Spanish" | debconf-set-selections
|
||||
echo "keyboard-configuration keyboard-configuration/xkb-keymap select es" | debconf-set-selections
|
||||
}
|
||||
|
||||
function install_non_interactive() {
|
||||
echo "Installing packages non interactive"
|
||||
apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" $@
|
||||
}
|
||||
|
||||
function install_no_recommends() {
|
||||
echo "Installing packages without recommends"
|
||||
apt install -y --no-install-recommends $@
|
||||
}
|
||||
|
||||
function setup_chroot() {
|
||||
echo "Setting up chroot"
|
||||
dbus-uuidgen > /etc/machine-id
|
||||
apt update -y
|
||||
ln -fs /etc/machine-id /var/lib/dbus/machine-id
|
||||
ln -s /bin/true /sbin/initctl
|
||||
}
|
||||
|
||||
function remove_unneeded_packages() {
|
||||
echo "Removing unneeded packages"
|
||||
apt remove -y --purge --auto-remove snapd
|
||||
}
|
||||
|
||||
function reconfigure_locales() {
|
||||
echo "Configuring locales"
|
||||
sed -i 's/# es_ES.UTF-8 UTF-8/es_ES.UTF-8 UTF-8/' /etc/locale.gen
|
||||
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
|
||||
locale-gen
|
||||
ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
|
||||
echo "Europe/Madrid" > /etc/timezone
|
||||
dpkg-reconfigure -f noninteractive tzdata
|
||||
}
|
||||
|
||||
function reconfigure_network_manager() {
|
||||
echo "Configuring network manager"
|
||||
mkdir -p /etc/NetworkManager
|
||||
cat <<EOF > /etc/NetworkManager/NetworkManager.conf
|
||||
[main]
|
||||
plugins=keyfile
|
||||
|
||||
[keyfile]
|
||||
unmanaged-devices=none
|
||||
EOF
|
||||
|
||||
mkdir -p /etc/NetworkManager/system-connections/
|
||||
cat <<EOL > /etc/NetworkManager/system-connections/dhcp-all.nmconnection
|
||||
[connection]
|
||||
id=Cable
|
||||
type=ethernet
|
||||
autoconnect=true
|
||||
|
||||
[ipv4]
|
||||
method=auto
|
||||
EOL
|
||||
|
||||
systemctl enable NetworkManager
|
||||
}
|
||||
|
||||
function reconfigure_packages() {
|
||||
reconfigure_locales
|
||||
reconfigure_network_manager
|
||||
|
@ -214,19 +178,6 @@ function create_image2(){
|
|||
|
||||
}
|
||||
|
||||
function clean (){
|
||||
truncate -s 0 /etc/machine-id
|
||||
rm /sbin/initctl
|
||||
dpkg-divert --rename --remove /sbin/initctl
|
||||
apt-get clean
|
||||
rm -rf /tmp/* ~/.bash_history
|
||||
umount /proc
|
||||
umount /sys
|
||||
umount /dev/pts
|
||||
export HISTSIZE=0
|
||||
}
|
||||
|
||||
|
||||
function autostart_calamares() {
|
||||
mkdir -p /etc/xdg/openbox
|
||||
echo <<EOF > /etc/xdg/openbox/autostart
|
||||
|
@ -234,25 +185,18 @@ calamares &
|
|||
EOF
|
||||
}
|
||||
|
||||
|
||||
function configure_lightdm() {
|
||||
mkdir -p /etc/lightdm
|
||||
cat <<EOF > /etc/lightdm/lightdm.conf
|
||||
[Seat:*]
|
||||
autologin-user=root
|
||||
autologin-user-timeout=0
|
||||
user-session=openbox
|
||||
greeter-session=lightdm-gtk-greeter
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function install_mesa_repo() {
|
||||
add-apt-repository ppa:kisak/kisak-mesa
|
||||
apt -y update
|
||||
}
|
||||
|
||||
|
||||
function user_add() {
|
||||
useradd -m -s /bin/bash -G sudo og
|
||||
echo "og:og" | chpasswd
|
||||
}
|
||||
|
||||
|
||||
## Main
|
||||
echo "ubuntu-fs-live" > /etc/hostname
|
||||
mount_proc_sys_dev
|
||||
|
@ -261,15 +205,16 @@ install_packages libterm-readline-gnu-perl systemd-sysv software-properties-comm
|
|||
setup_chroot
|
||||
set_pkg_configuration
|
||||
install_mesa_repo
|
||||
install_non_interactive
|
||||
install_packages sudo ubuntu-standard sudo casper dbus-bin mesa-utils mesa-vulkan-drivers discover isc-dhcp-client laptop-detect unzip os-prober network-manager net-tools wireless-tools wpagui locales grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common grub-efi-amd64-signed shim-signed mtools binutils virtualbox-guest-utils virtualbox-guest-x11
|
||||
install_non_interactive xorg xinit openbox lightdm plymouth calamares
|
||||
install_non_interactive sddm openbox plymouth calamares terminator pcmanfm yad
|
||||
install_no_recommends linux-image-generic
|
||||
set_root_passwd
|
||||
user_add
|
||||
configure_divert
|
||||
configure_lightdm
|
||||
autostart_calamares
|
||||
create_desktop_installer
|
||||
remove_unneeded_packages
|
||||
reconfigure_packages
|
||||
configure_sddm
|
||||
create_image
|
||||
configure_grub_menu
|
||||
create_image2
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Paso 1: Seleccionar los componentes
|
||||
components=$(yad --list --title="Seleccionar componentes" \
|
||||
--text="Selecciona los componentes que deseas configurar:" \
|
||||
--checklist --multiple \
|
||||
--column="Seleccionar" --column="Componente" \
|
||||
FALSE "ogCore" \
|
||||
FALSE "ogGui" \
|
||||
FALSE "ogDhcp" \
|
||||
FALSE "ogBoot" \
|
||||
--width=400 --height=300 --center)
|
||||
|
||||
# Verificar si el usuario seleccionó algún componente
|
||||
if [[ -z "$components" ]]; then
|
||||
yad --info --text="No seleccionaste ningún componente. Saliendo..." --center
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Procesar los componentes seleccionados, eliminando la primera columna (TRUE)
|
||||
echo $components
|
||||
IFS="|" read -r -a selected_components <<< "$components"
|
||||
|
||||
for component in "${selected_components[@]}"; do
|
||||
# Extraer solo el nombre del componente (segundo campo)
|
||||
component_name=$(echo "$component" | cut -d '|' -f 2)
|
||||
|
||||
# Pedir la configuración específica para cada componente seleccionado
|
||||
config=$(yad --form --title="Configuración para $component_name" \
|
||||
--field="IP del servidor" \
|
||||
--field="Ruta del fichero de configuración" \
|
||||
--width=400 --height=200 --center)
|
||||
|
||||
# Dividir la configuración en IP y ruta del fichero
|
||||
server_ip=$(echo "$config" | cut -d '|' -f 1)
|
||||
config_path=$(echo "$config" | cut -d '|' -f 2)
|
||||
|
||||
# Verificar si los campos no están vacíos
|
||||
if [[ -z "$server_ip" || -z "$config_path" ]]; then
|
||||
yad --error --text="Debes proporcionar la IP del servidor y la ruta del fichero para $component_name." --center
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Guardar la configuración en un archivo (cada componente tiene su archivo JSON)
|
||||
config_file="./${component_name}_config.json"
|
||||
echo "{\"server_ip\": \"$server_ip\", \"config_path\": \"$config_path\"}" > "$config_file"
|
||||
|
||||
# Mostrar un mensaje de éxito
|
||||
yad --info --text="Configuración guardada en $config_file para $component_name." --center
|
||||
|
||||
done
|
||||
|
||||
|
||||
# Una vez se ha configurado todo, se puede proceder a la instalación de los componentes
|
||||
# Ejecutar la instalación con calamares y enviar el log a un archivo
|
||||
|
||||
#calamares > installer.log 2>&1 & disown
|
||||
calamares > installer.log 2>&1
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
set -e
|
||||
export HOME=/root
|
||||
export LC_ALL=C
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export DEBOOT_STRAP_URL=http://mirror.raiolanetworks.com/ubuntu/
|
||||
|
||||
source buildlib.sh
|
||||
|
||||
## MAIN
|
||||
|
||||
set_root_passwd
|
||||
mount_proc_sys_dev
|
||||
setup_sources_list
|
||||
install_no_recommends ubuntu-minimal dbus-bin grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common grub-efi-amd64-signed shim-signed inittamfs-tools
|
||||
configure_divert
|
||||
install_no_recommends linux-image-generic
|
||||
clean
|
Loading…
Reference in New Issue