https://blue-build.org/ logo
Questions about firstboot scripts
# questions
h
Does the
ublue-os/firstboot
directory run any bash script that is there on the first boot or is it only for
yafti.yml
? I wanted to make a firstboot script just to configure and download some things at the beginning and never run it again.
a
message has been deleted
g
If the Ublue image itself has support for adding scripts in their, then it should work. Our modules don't touch any systemd units that Ublue would have setup on their images
h
I don't think any of their images support what I want, they use a .desktop file to call yafti and nothing else. https://github.com/ublue-os/bluefin/blob/main/system_files/shared/etc/skel/.config/autostart/bluefin-firstboot.desktop they don't use the firstboot directory, at least not in bluefin: https://github.com/ublue-os/bluefin/blob/main/system_files/shared/etc/yafti.yml
I was thinking about making a systemd service and at the end of the script it deactivates itself:
Copy code
bash
# Check if the script has already run
if [[ ! -f "$FIRSTBOOT_FILE" ]]; then
    echo "First boot detected. Running setup script..."
    run_modules

    # Create the file to indicate that the script has run
    touch "$FIRSTBOOT_FILE"

    # Generate and store the hash in the firstboot file
    generate_hash

    # Disable the systemd service after successful execution
    echo "Disabling firstboot systemd service..."
    sudo systemctl disable firstboot.service

else
    echo "First boot script has already run. Nothing to do."
fi
g
Yeah that could totally work
x
yeah, the firstboot folder is just an arbitrary data foldes used by convention
you can use a shell script to do what you suggested, but you should use a different folder for that