generated from blue-build/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trying the firtboot script in the recipe-vm
- Loading branch information
Showing
3 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# File to indicate that the script has already run | ||
FIRSTBOOT_FILE="$HOME/.config/firstboot/firstboot_done" | ||
|
||
# Function to generate a hash and write it to the firstboot file | ||
generate_hash() { | ||
# Create a unique hash based on the current timestamp and a random number | ||
local hash | ||
hash=$(echo "$(date +%s) $RANDOM" | sha256sum | cut -d' ' -f1) | ||
echo "$hash" >"$FIRSTBOOT_FILE" | ||
} | ||
|
||
# Function to run modular commands and scripts | ||
run_modules() { | ||
# Add your commands and scripts here that you want to run on the first boot | ||
|
||
# Example commands | ||
echo "Setting up the environment..." | ||
# Command to install packages, update the system, etc. | ||
xdg-user-dirs-update | ||
|
||
echo "Running theme setup script..." | ||
# Example of running an external script | ||
flatpak override --filesystem=xdg-data/themes | ||
flatpak override --filesystem=xdg-data/icons | ||
flatpak override --filesystem=xdg-config/gtk-3.0 | ||
flatpak override --filesystem=xdg-config/gtk-4.0 | ||
flatpak override --filesystem=xdg-config/Kvantum | ||
# ./setup_theme.sh | ||
|
||
echo "Initial setup completed!" | ||
} | ||
|
||
# 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..." | ||
systemctl disable firstboot.service | ||
|
||
else | ||
echo "First boot script has already run. Nothing to do." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters