* Creates Ubuntu chroot for deploy
* Set root passw in live cd
* Update Network manager in live-cd
* Mount and dismount partitions for Calamares
* Updates bootloader
* Configures mount for deploying with calamares
* Creates upackfs to use minimal fs
* Updates users.conf file
user-story-905
Nicolas Arenas 2024-10-16 11:54:06 +00:00
parent b22da510a8
commit 8cdf4a93dd
7 changed files with 102 additions and 6 deletions

View File

@ -10,6 +10,7 @@ VARIANT=minbase
CLEAN=${CLEAN:-1}
CLEAN_CHROOT=${CLEAN_CHROOT:-1}
OUTPUT_DIR=/media/sf_Downloads/
UBUNTU_CHROOT_DIR=$DIR/ubuntu_chroot
## FUNCIONES
@ -99,6 +100,7 @@ umount_in_host $CHROOT_DIR/run
# Compress the chroot
exec_as_sudo mv chroot/image .
# Create squashfs imagesudo
exec_as_sudo mksquashfs $CHROOT_DIR image/casper/filesystem.squashfs \
-noappend -no-duplicates -no-recovery \
@ -108,6 +110,17 @@ 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/
# Compress the ububtu chroot
exec_as_sudo mksquashfs $UBUNTU_CHROOT_DIR image/casper/filesystem.ubuntu.squashfs \
-noappend -no-duplicates -no-recovery \
-wildcards \
-comp xz -b 1M -Xdict-size 100% \
-e "var/cache/apt/archives/*" -e "root/*" -e "root/.*" -e "tmp/*" -e "tmp/.*" -e "swapfile"
# Create ISO image
cd image && \

View File

@ -0,0 +1,17 @@
---
efiBootLoader: "grub"
kernelSearchPath: "/boot/"
kernelInstallPath: "/boot/"
kernelPattern: "^vmlinuz.*"
loaderEntries:
- "timeout 5"
- "console-mode keep"
kernelParams: [ "quiet" ]
grubInstall: "grub-install"
grubMkconfig: "grub-mkconfig"
grubCfg: "/boot/grub/grub.cfg"
grubProbe: "grub-probe"
efiBootMgr: "efibootmgr"

View File

@ -0,0 +1,19 @@
---
extraMounts:
- device: proc
fs: proc
mountPoint: /proc
- device: sys
fs: sysfs
mountPoint: /sys
- device: /dev
mountPoint: /dev
options: bind
- device: tmpfs
fs: tmpfs
mountPoint: /run
- device: /run/dev
mountPoint: /run/dev
options: bind

View File

@ -0,0 +1,6 @@
---
unpack:
- source: "/cdrom/casper/filesystem.ubuntu.squashfs"
sourcefs: squashfs
destination: "/"

View File

@ -0,0 +1,36 @@
defaultGroups:
- name: users
system: true
- adm:
system: true
- cdrom:
system: true
- sudo:
system: true
- dip:
system: true
- plugdev:
system: true
- lxd:
system: true
sudoersGroup: sudo
setRootPassword: false
passwordRequirements:
minLength: -1 # Password at least this many characters
maxLength: -1 # Password at most this many characters
libpwquality:
- minlen=0
- minclass=0
user:
shell: /bin/bash
forbidden_names: [ root ]
home_permissions: "0700"
hostname:
location: EtcFile
writeHostsFile: true
template: "derp-${cpu}"
forbidden_names: [ localhost ]

View File

@ -14,10 +14,12 @@ sequence:
- summary
- exec:
- partition
- mount
- machineid
- locale
- keyboard
- users
- umount
- bootloader
- show:
- finished

View File

@ -5,6 +5,10 @@ set -e
export HOME=/root
export LC_ALL=C
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
@ -86,18 +90,16 @@ function reconfigure_network_manager() {
mkdir -p /etc/NetworkManager
cat <<EOF > /etc/NetworkManager/NetworkManager.conf
[main]
rc-manager=none
plugins=ifupdown,keyfile
dns=systemd-resolved
plugins=keyfile
[ifupdown]
managed=false
[keyfile]
unmanaged-devices=none
EOF
mkdir -p /etc/NetworkManager/system-connections/
cat <<EOL > /etc/NetworkManager/system-connections/dhcp-all.nmconnection
[connection]
id=Auto DHCP
id=Cable
type=ethernet
autoconnect=true
@ -262,6 +264,7 @@ install_mesa_repo
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_no_recommends linux-image-generic
set_root_passwd
configure_divert
configure_lightdm
autostart_calamares