Hallo Werner
Besten Dank für deine Suche, hilft uns leider nicht weiter.
Hätte da noch ne Notlösung ;-(
Notlösung ist nicht richtig, wir erstellen uns ein ISO um es dann
wieder auf einen USB-Stick zu bringen?????
Also warum nicht gleich auf den Stick damit, es geht sogar direkt aus dem Script
heraus.
1.) einen leeren Fat32 Formatierten Stick (bei mir ist die Bezeichnung „BANK“)
einstecken, er sollte dann unter „/media/xxxxx/BANK“ eingehängt sein.
2.) das lubuntu-22.04.1-desktop-amd64.iso muss in /source/ liegen
3.) in Zeile 288 den Hashtag entfernen und für die xxxxxe den richtigen nahmen,
Pfad eintragen. Kann sein das der Pfad (das Ziel) in einer VM ein wenig anders
ist. Bei mir ist Lubuntu direkt auf der Platte installiert.
Alternativ Zeile 288 so lassen und mit einem Dateimanager die Verzeichnisse
unter iso (.disk, boot, casper und EFI) auf einen Fat32 formatierten USB-Stick
kopieren und fertig.
Nach einem neuen Durchlauf des Script´s brauch dann nur das casper Verzeichnis
ausgetauscht werden.
Hab es gerade durchlaufen lassen, läuft prima. Stick stecken lassen, Neustart und
sofort vom Bankix Stick starten.
#!/bin/bash
set -o xtrace
#### Kernel bauen #### BEGIN ####
# Kernel-Verzeichnis anlegen, benoetigte Pakete einspielen, Kernel-Quellcode herunterladen
#Das iso lubuntu-22.04.1-desktop-amd64 muss in /source/ liegen
# wenn das script durch ist, einfach die Verzeichnisse unter iso (.disk, boot, casper und EFI) auf
#einen Fat32 formatierten USB-Stick kopieren und fertig. Nach einem neuen Durchlauf brauch dann nur
#das casper verzeichniss ausgetauscht werden.
mkdir kernel
cd kernel
# Quelltext-Paketquelle hinzufügen/aktivieren
add-apt-repository -s "deb http://de.archive.ubuntu.com/ubuntu/ $(lsb_release -sc)-updates main"
apt-get update
apt-get -y install fakeroot
apt-get -y build-dep linux
apt-get source linux
cd $(ls -d */ | grep linux-)
### Patchen
sed -i '/^static inline unsigned int ata_dev_enabled(const struct ata_device \*dev)/{N;N;N;s/return ata_class_enabled(dev->class);/return dev->class == ATA_DEV_ATAPI;/}' include/linux/libata.h
sed -i '/^CONFIG_BLK_DEV_NVME/d' debian.hwe-5.15/config/config.common.ubuntu
sed -i '/^CONFIG_NVME_/d' debian.hwe-5.15/config/config.common.ubuntu
sed -i '/^# CONFIG_NVME_/d' debian.hwe-5.15/config/config.common.ubuntu
cat >> debian.hwe-5.15//config/config.common.ubuntu << EOF
# CONFIG_BLK_DEV_NVME is not set
# CONFIG_NVME_FC is not set
# CONFIG_NVME_RDMA is not set
# CONFIG_NVME_TARGET is not set
# CONFIG_NVME_TCP is not set
EOF
sed -i "/^CONFIG_BLK_DEV_NVME/ s/'[my-]'/'n'/g" debian.hwe-5.15/config/annotations
sed -i "/^CONFIG_NVME_/ s/'[mny]'/'-'/g" debian.hwe-5.15/config/annotations
sed -i "/^CONFIG_NVME_FC / s/'[my-]'/'n'/g" debian.hwe-5.15/config/annotations
sed -i "/^CONFIG_NVME_RDMA / s/'[my-]'/'n'/g" debian.hwe-5.15/config/annotations
sed -i "/^CONFIG_NVME_TARGET / s/'[my-]'/'n'/g" debian.hwe-5.15/config/annotations
sed -i "/^CONFIG_NVME_TCP / s/'[my-]'/'n'/g" debian.hwe-5.15/config/annotations
# Kernel bauen
fakeroot debian/rules clean
skipabi=true skipmodule=true fakeroot debian/rules binary-indep
skipabi=true skipmodule=true fakeroot debian/rules binary-perarch
skipabi=true skipmodule=true fakeroot debian/rules binary-generic
cd ../../
#### Kernel bauen #### END ######
#### Return-Values der Bash-Kommandos auswerten #### BEGIN #####
function CHECK {
#if [ ${PIPESTATUS[0]} -ne 0 ]
if [ $? -eq 0 ]
then
echo $(tput bold)$(tput setaf 2)[PASS]$(tput sgr0)
else
echo $(tput bold)$(tput setaf 1)[FAIL]$(tput sgr0)
fi
}
export PS4='$(CHECK)\n\n$(tput bold)$(tput setaf 7)$(tput setab 4)+ (${BASH_SOURCE}:${LINENO}):$(tput sgr0) '
#### Return-Values der Bash-Kommandos auswerten #### END #######
#### System bauen #### BEGIN ####
apt-get -y install build-essential debootstrap squashfs-tools genisoimage syslinux-common syslinux-utils
#das neue system aus sources
mount -o loop source/lubuntu-22.04.1-desktop-amd64.iso /mnt/
mkdir iso
mkdir iso/casper
# Bereits gebautes Live-System des verwendeteten ISOs entpacken
unsquashfs -d squashfs /mnt/casper/filesystem.squashfs
# Ressourcen des Build-Systems in Live-System hineinmappen
mount --bind /dev squashfs/dev
mount -t devpts devpts squashfs/dev/pts
mount -t proc proc squashfs/proc
mount -t sysfs sysfs squashfs/sys
# DNS + Paketquellen des Build-Systems nutzen, vorher Ressourcen des Live-Systems sichern
chroot squashfs/ cp -dp /etc/resolv.conf /etc/resolv.conf.original
chroot squashfs/ cp -dp /etc/apt/sources.list /etc/apt/sources.list.original
cp /etc/resolv.conf squashfs/etc/
cp /etc/apt/sources.list squashfs/etc/apt/
# Locales setzen
chroot squashfs/ locale-gen de_DE.UTF-8
#chroot squashfs/ locale-gen de_CH.UTF-8
# System schlank machen
chroot squashfs/ apt-get -y purge snapd
chroot squashfs/ apt-get -y purge libreoffice-* libuno-* transmission-common vim fonts-noto-cjk calamares* lvm2 apport* cryptsetup* sane-airscan hunspell-en-us aspell-en 2048-qt pocketsphinx-en-us vlc* hplip-* skanlite quassel*
chroot squashfs/ apt-get -y purge linux-image-* linux-headers-* linux-modules-*
chroot squashfs/ apt-get -y autoremove --purge
# alle Updates einspielen
chroot squashfs/ apt-get update
chroot squashfs/ apt-get -y upgrade
# Zusaetzliche Pakete einspielen
chroot squashfs/ apt-get -y install squashfs-tools wswiss wngerman wogerman aspell-de hunspell-de-de openjdk-11-jre libccid libpcsc-perl pcsc-tools pcscd conky lm-sensors
# Zeitzone setzen
echo "Europe/Berlin" | tee squashfs/etc/timezone
rm squashfs/etc/localtime
chroot squashfs/ ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
chroot squashfs/ dpkg-reconfigure --frontend noninteractive tzdata
# Modifizierten Kernel einspielen
cp kernel/linux-headers*.deb kernel/linux-image*.deb kernel/linux-modules*.deb squashfs/
chroot squashfs/ ls | chroot squashfs/ grep .deb | chroot squashfs/ tr '\n' ' ' | chroot squashfs/ xargs dpkg -i
chroot squashfs/ apt-get -f -y install
rm squashfs/*.deb
# Microcodes + Tools nachinstallieren, die durch das Entfernen der linux*-Pakete verloren gegangen sind
chroot squashfs/ apt-get -y install amd64-microcode intel-microcode iucode-tool thermald
# APT + Software-Center aufrauemen
chroot squashfs/ apt-get -y check
chroot squashfs/ apt-get -y autoremove --purge
chroot squashfs/ apt-get -y clean
# Home-Profil ins Zielsystem kopieren alles unter "source/skel" wird im neuen System da sein
cp -r source/skel squashfs/etc/
#M2 script für den Autostart
#cp -r source/bank/M2.sh squashfs/usr/local/bin/
#net nach
#cp -ar source/bank/system-connections/A10 squashfs/etc/NetworkManager/system-connections/
#cp -ar source/bank/system-connections/Ryzen squashfs/etc/NetworkManager/system-connections/
#cp -ar source/bank/system-connections/VBOX squashfs/etc/NetworkManager/system-connections/
#Jameica für Hibiscus nach /opt
#cp -ar source/bank/op/jameica squashfs/opt
# Menue bauen
mkdir iso
cp -r /mnt/boot iso
cp -r /mnt/EFI iso
cp -r /mnt/.disk iso
# Boot
cat > iso/boot/grub/grub.cfg << EOF
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
menuentry "c't Bankix Lubuntu 22.04" {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper showmounts quiet splash noprompt -- debian-installer/locale=de_DE console-setup/layoutcode=de
initrd /casper/initrd.lz
}
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
EOF
# apt-Pinning um das Einspielen ungepatchter Kernel zu verhindern
cat > squashfs/etc/apt/preferences << EOF
Package: linux-image*
Pin: origin *.ubuntu.com
Pin-Priority: -1
Package: linux-headers*
Pin: origin *.ubuntu.com
Pin-Priority: -1
Package: linux-modules*
Pin: origin *.ubuntu.com
Pin-Priority: -1
Package: linux-lts*
Pin: origin *.ubuntu.com
Pin-Priority: -1
Package: linux-generic*
Pin: origin *.ubuntu.com
Pin-Priority: -1
EOF
cat > squashfs/excludes << EOF
casper/*
cdrom/*
cow/*
etc/mtab
home/lubuntu/.cache/*
media/*
mnt/*
proc/*
rofs/*
root/.cache/*
sys/*
tmp/*
var/log/*
EOF
# Skript zur Erzeugung des Snapshots bereitstellen
cat > squashfs/usr/sbin/BankixCreateSnapshot.sh << EOF
#!/bin/bash
echo "Snapshot erstellen"
echo "=================="
echo
echo "1. Alle Anwendungen schließen!"
echo "2. Schreibschutzschalter am USB-Stick (sofern vorhanden) auf 'offen' stellen!"
echo
read -r -p "Snapshot jetzt erstellen? [j/N] " questionResponse
if [[ \$questionResponse = [jJ] ]]
then
echo
sudo apt-get -y clean
sudo blockdev --setrw \$(findmnt -n -o SOURCE --mountpoint /cdrom)
sudo mount -o remount,rw /cdrom
sudo mksquashfs / /cdrom/casper/filesystem_new.squashfs -ef /excludes -wildcards -comp lz4 -Xhc
sudo rm -f /cdrom/filesystem_old.squashfs
sudo mv /cdrom/casper/filesystem.squashfs /cdrom/filesystem_old.squashfs
sudo mv /cdrom/casper/filesystem_new.squashfs /cdrom/casper/filesystem.squashfs
sudo sync
sudo mount -o remount,ro /cdrom
echo
echo "Das System muss heruntergefahren werden! Aktivieren Sie anschließend den mechanischen Schreibschutzschalter und starten neu. Bitte Taste druecken!"
read dummy
sudo shutdown -P now
else
echo
echo "Es wurde kein Snapshot erstellt!"
read dummy
fi
EOF
chmod +x squashfs/usr/sbin/BankixCreateSnapshot.sh
mkdir squashfs/etc/skel/Desktop/
cat > squashfs/etc/skel/Desktop/BankixCreateSnapshot.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=Snapshot erstellen
Exec=/usr/sbin/BankixCreateSnapshot.sh
Type=Application
Terminal=true
Icon=/usr/share/icons/Humanity/actions/48/document-save.svg
EOF
chmod +x squashfs/etc/skel/Desktop/BankixCreateSnapshot.desktop
# Echtzeituhr: Lokalzeit anstatt UTC verwenden für Dual-Boot mit Windows
echo "0.0 0 0" > squashfs/etc/adjtime
echo "0" >> squashfs/etc/adjtime
echo "LOCAL" >> squashfs/etc/adjtime
#### System bauen #### END ######
####
cp squashfs/boot/initrd.img-* iso/casper/initrd.lz
cp squashfs/boot/vmlinuz-* iso/casper/vmlinuz
umount squashfs/dev/pts squashfs/dev squashfs/proc squashfs/sys /mnt
chroot squashfs/ mv /etc/resolv.conf.original /etc/resolv.conf
chroot squashfs/ mv /etc/apt/sources.list.original /etc/apt/sources.list
mksquashfs squashfs iso/casper/filesystem.squashfs -noappend -comp lz4 -Xhc
#Die x durch original Pfad ersetzen
#cp -r iso/.disk/ iso/boot iso/EFI iso/casper /media/xxxxx/BANK
date
echo
grus
tb