Skip to content

Commit

Permalink
feat: set up groundwork for post boot scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
xynydev committed Sep 26, 2024
1 parent 2cd4439 commit a45fc97
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/default-flatpaks/v2/default-flatpaks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<string>] {
Expand Down
1 change: 1 addition & 0 deletions modules/default-flatpaks/v2/post-boot/system-flatpak-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env nu
14 changes: 14 additions & 0 deletions modules/default-flatpaks/v2/post-boot/system-flatpak-setup.service
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions modules/default-flatpaks/v2/post-boot/user-flatpak-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env nu
14 changes: 14 additions & 0 deletions modules/default-flatpaks/v2/post-boot/user-flatpak-setup.service
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a45fc97

Please sign in to comment.