Add autoinstall flatpak
This commit is contained in:
		
							parent
							
								
									790f3e8039
								
							
						
					
					
						commit
						cadb8e01d0
					
				
					 4 changed files with 26 additions and 3 deletions
				
			
		| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										13
									
								
								autoinstall/flatpak_command.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								autoinstall/flatpak_command.sh
									
										
									
									
									
										Normal 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
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue