feat: add azure-distrobox service
This commit is contained in:
parent
cd4b46af78
commit
ad82b8b879
7 changed files with 24 additions and 8 deletions
28
files/usr/bin/flatpak-setup
Executable file
28
files/usr/bin/flatpak-setup
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# TODO: handle multiple remotes, maybe with yaml config?
|
||||
REPO_NAME=flathub
|
||||
|
||||
# Installed flatpaks
|
||||
FLATPAK_LIST=$(flatpak list --app --columns=application)
|
||||
|
||||
# Flatpak list files
|
||||
INSTALL_LIST_FILE="/usr/share/azure/flatpaks/install"
|
||||
USER_INSTALL_LIST_FILE="/etc/azure/flatpaks/install"
|
||||
# Prefer user's install + remove list over maintainer's, in case when same flatpak ID is present in maintainer's install list + user's remove list & vice-versa
|
||||
# Also ignores words starting with # symbol, whitelines & duplicate entries
|
||||
MAINTAINER_INSTALL_LIST=$(sort "$INSTALL_LIST_FILE" | grep -v -E '^#|^$' | awk '!seen[$0]++')
|
||||
# Combine maintainer & user list. Ignore words starting with # symbol, whitelines & duplicate entries
|
||||
COMBINED_INSTALL_LIST=$(cat <(echo "$MAINTAINER_INSTALL_LIST") "$USER_INSTALL_LIST_FILE" | grep -v -E '^#|^$' | awk '!seen[$0]++')
|
||||
|
||||
# Install flatpaks in list
|
||||
if [[ -f $INSTALL_LIST_FILE ]] || [[ -f $USER_INSTALL_LIST_FILE ]]; then
|
||||
if [[ -n $FLATPAK_LIST ]]; then
|
||||
INSTALL_LIST=$(comm -23 <(echo "$COMBINED_INSTALL_LIST" | sort) <(echo "$FLATPAK_LIST" | sort))
|
||||
else
|
||||
INSTALL_LIST="$COMBINED_INSTALL_LIST"
|
||||
fi
|
||||
notify-send "Flatpak Installer" "Started install of user flatpaks" --app-name="Flatpak Installer" -u NORMAL
|
||||
flatpak install --noninteractive "$REPO_NAME" ${INSTALL_LIST[@]}
|
||||
notify-send "Flatpak Installer" "Finished install of user flatpaks:\n$INSTALL_LIST" --app-name="Flatpak Installer" -u NORMAL
|
||||
fi
|
14
files/usr/lib/systemd/user/azure-distrobox.service
Normal file
14
files/usr/lib/systemd/user/azure-distrobox.service
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Update distrobox for current user
|
||||
Wants=network-online.target
|
||||
After=network-online.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/libexec/azure-distrobox
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
14
files/usr/lib/systemd/user/flatpak-setup.service
Normal file
14
files/usr/lib/systemd/user/flatpak-setup.service
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Configure Flatpaks for current user
|
||||
Wants=network-online.target
|
||||
After=network-online.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/flatpak-setup
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
8
files/usr/libexec/azure-distrobox
Normal file
8
files/usr/libexec/azure-distrobox
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -f ~/.config/distrobox.ini ]; then
|
||||
echo "No distrobox config at ~/.config/distrobox.ini, skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
distrobox assemble create --file ~/.config/distrobox.ini
|
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p /etc/azure
|
||||
mkdir -p /etc/azure/flatpaks
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue