B
BlueBuild3mo ago
Heus

Questions about firstboot scripts

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.
4 Replies
Luke Skywunker
Luke Skywunker3mo ago
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
Heus
HeusOP3mo ago
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:
# 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
# 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
Luke Skywunker
Luke Skywunker3mo ago
Yeah that could totally work
xyny
xyny3mo ago
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
Want results from more Discord servers?
Add your server