Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

Raspberry Pi OS • Re: Bookworm LVM rootfs

$
0
0
Sigh. Best intentions and all that.

Unfortunately, with what you've provided there are way too many things where I'd say "you can do this, or you can do that", because of missing context, etc. I really wanted to give you back a close-to-working solution, but alas, that's not to be.

So, here's a bit to get you started:
  • A bash script to do the customize. Takes the IMG name as the first parameter

    Code:

    #!/bin/bashimg=$1sudo sdm $img \    --customize \    --extend --xmb 2048 \    --logwidth 132 \    --L10n \    --plugin disable:"piwiz|triggerhappy" \    --reboot 20 \    --plugin user:"adduser=swampdog|password=goodpassword" \    --plugin raspiconfig:"boot_behaviour=B4" \    --plugin copyfile:"from=/path/to/file|to=/path/in/the/IMG|chown=0:0|chmod=755" \    --plugin network:"wifissid=MYSSID|wifipassword=MYPASSWORD" \    --plugin apps:"name=group0|apps=mlocate,sysstat,iftop,dnsutils,screen,lsof,bc,dnsutils,lsscsi,minicom" \    --plugin apps:"name=lsscsi|apps=lvm2,initramfs-tools-core" \    --plugin apps:"name=fcp_gui|apps=labavahi-compat-libdnssd1"
  • A bash script to burn the IMG to a disk. Takes the IMG name as the first parameter, the burn device as the 2nd parameter, and the hostname as the 3rd parameter.

    Code:

    #!/bin/bashimg=$1burndev=$2hname=$3sudo sdm --burn $burndev --hostname $hname --expand-root --regen-ssh-host-keys $img
There are of course many things you could add/change in the customize script. The general idea is to use plugins to do as much work as possible, so I've provided a few examples. All the plugins are documented https://github.com/gitbls/sdm/blob/mast ... Plugins.md, and there are lots of examples.

You copy a bunch of files into the IMG, that's easy to do with sdm's copyfile plugin. The copydir plugin will copy a directory tree (using rsync). Nice thing about using the plugins is that they take care of the hassle of knowing what to copy when, that is, what needs to be done when the IMG is mounted but not in the IMG container, vs running in the context of the IMG container.

I used 3 different apps plugin invocations since that's what your script did. These of course can be collapsed into a single invocation if desired, and the list of packages to install can be put into a file, as noted in the above Plugins doc.

Other plugins you may find useful:
  • bootconfig -- manage /boot/firmware/config.txt settings
  • serial -- manage serial port
  • system -- configure system config files, such as cron, modprobe, enable/disable services, various systemd config files (e.g., timesyncd)
  • trim-enable -- Enable trim on disks that are trimmable

Sorry that I over-promised and under-delivered a bit, but hopefully this will be sufficient to give you a jump-start.

Statistics: Posted by bls — Thu Mar 28, 2024 10:00 pm



Viewing all articles
Browse latest Browse all 3552

Trending Articles