Add autoinstall flatpak

This commit is contained in:
Tobias Reisinger 2024-05-12 23:50:11 +02:00
parent 790f3e8039
commit cadb8e01d0
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
4 changed files with 26 additions and 3 deletions

View file

@ -115,3 +115,13 @@ commands:
- name: target - name: target
required: true required: true
help: The path to write the result to help: The path to write the result to
- name: flatpak
help: Install a flatpak
args:
- name: flatpak
required: true
help: The flatpak to install
- name: mode
required: true
help: The target to install into (user or system)

View file

@ -2,8 +2,8 @@
action=${action:?} action=${action:?}
# if action is run or completions, do nothing # do nothing on some selected actions
if [ "$action" = "run" ] || [ "$action" = "completions" ] if [ "$action" = "completions" ] || [ "$action" = "flatpak" ] || [ "$action" = "run" ]
then then
return return
fi fi

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
flatpak=${args[flatpak]:?}
mode=${args[mode]:?}
if ! flatpak info "$flatpak" &> /dev/null
then
echo "Installing flatpak $flatpak"
flatpak install -y "--$mode" "$flatpak"
_run_hook
fi

View file

@ -44,5 +44,5 @@ _config_query ".[]" | while read -r entry; do
install_args+=("$(eval "echo $target")") install_args+=("$(eval "echo $target")")
"$0" "${install_args[@]}" "$0" "${install_args[@]}" || true # Continue on error
done done