Skip to content

Instantly share code, notes, and snippets.

@CamDavidsonPilon
Last active March 14, 2024 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CamDavidsonPilon/fbf23fea3b5fc199e5c0d4f3aab79c74 to your computer and use it in GitHub Desktop.
Save CamDavidsonPilon/fbf23fea3b5fc199e5c0d4f3aab79c74 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -x
set -e
export LC_ALL=C
# List of systemd files
systemd_files=("/lib/systemd/system/avahi_aliases.service" "/lib/systemd/system/load_rp2040.service")
# Loop through each file and add 'User=pioreactor' and 'EnvironmentFile=/etc/environment' under '[Service]' if they don't already exist
for file in "${systemd_files[@]}"; do
crudini --ini-options=nospace --set "$file" Service User pioreactor
crudini --ini-options=nospace --set "$file" Service EnvironmentFile "/etc/environment"
done
systemctl daemon-reload
systemctl restart avahi_aliases.service
systemctl restart load_rp2040.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment