diff --git a/modules/default-flatpaks/v2/default-flatpaks.sh b/modules/default-flatpaks/v2/default-flatpaks.sh index 1364e06..4794676 100644 --- a/modules/default-flatpaks/v2/default-flatpaks.sh +++ b/modules/default-flatpaks/v2/default-flatpaks.sh @@ -12,7 +12,9 @@ const defaultInstallation = { } install: [] } -const configPath = '/usr/share/bluebuild/default-flatpaks/configuration.yaml' + +const usrSharePath = "/usr/share/bluebuild/default-flatpaks" +const configPath = $"($usrSharePath)/configuration.yaml" def main [configStr: string] { let config = $configStr | from yaml @@ -54,6 +56,18 @@ def main [configStr: string] { print $"(ansi green_bold)Successfully generated following installations:(ansi reset)" print ($installations | to yaml) + + print "Setting up Flatpak setup services..." + + cp -r ($"($env.MODULE_DIRECTORY)/default-flatpaks/post-boot/*" | into glob) $usrSharePath + + cp $"($usrSharePath)/system-flatpak-setup.service" /usr/lib/systemd/system/system-flatpak-setup.service + cp $"($usrSharePath)/user-flatpak-setup.service" /usr/lib/systemd/user/user-flatpak-setup.service + systemctl enable --force system-flatpak-setup.service + systemctl enable --force --global user-flatpak-setup.service + + chmod +x $"($usrSharePath)/system-flatpak-setup" + chmod +x $"($usrSharePath)/user-flatpak-setup" } def checkFlathub [packages: list] { diff --git a/modules/default-flatpaks/v2/post-boot/system-flatpak-setup b/modules/default-flatpaks/v2/post-boot/system-flatpak-setup new file mode 100644 index 0000000..ee2bc1f --- /dev/null +++ b/modules/default-flatpaks/v2/post-boot/system-flatpak-setup @@ -0,0 +1 @@ +#!/usr/bin/env nu diff --git a/modules/default-flatpaks/v2/post-boot/system-flatpak-setup.service b/modules/default-flatpaks/v2/post-boot/system-flatpak-setup.service new file mode 100644 index 0000000..c6039a1 --- /dev/null +++ b/modules/default-flatpaks/v2/post-boot/system-flatpak-setup.service @@ -0,0 +1,14 @@ +[Unit] +Description=Manage system flatpaks +Wants=network-online.target +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/usr/share/bluebuild/default-flatpaks/system-flatpak-setup +Restart=on-failure +RestartSec=30 +StartLimitInterval=0 + +[Install] +WantedBy=multi-user.target diff --git a/modules/default-flatpaks/v2/post-boot/user-flatpak-setup b/modules/default-flatpaks/v2/post-boot/user-flatpak-setup new file mode 100644 index 0000000..ee2bc1f --- /dev/null +++ b/modules/default-flatpaks/v2/post-boot/user-flatpak-setup @@ -0,0 +1 @@ +#!/usr/bin/env nu diff --git a/modules/default-flatpaks/v2/post-boot/user-flatpak-setup.service b/modules/default-flatpaks/v2/post-boot/user-flatpak-setup.service new file mode 100644 index 0000000..38ec2d7 --- /dev/null +++ b/modules/default-flatpaks/v2/post-boot/user-flatpak-setup.service @@ -0,0 +1,14 @@ +[Unit] +Description=Configure Flatpaks for current user +Wants=network-online.target +After=system-flatpak-setup.service + +[Service] +Type=simple +ExecStart=/usr/share/bluebuild/default-flatpaks/user-flatpak-setup +Restart=on-failure +RestartSec=30 +StartLimitInterval=0 + +[Install] +WantedBy=default.target