Add script to install desktop apps on Linux GUI systsems, via Flatpak

This commit is contained in:
Alicia Sykes 2022-09-25 14:12:51 +01:00
parent 96bccc0442
commit 22c6a04fdb
2 changed files with 19 additions and 4 deletions

View File

@ -168,7 +168,7 @@ function apply_preferences () {
fi
# Install / update vim plugins with Plug
echo -e "${PURPLE}Installing Vim Plugins${RESET}"
echo -e "\n${PURPLE}Installing Vim Plugins${RESET}"
vim +PlugInstall +qall
# Install / update Tmux plugins with TPM
@ -207,8 +207,7 @@ function intall_macos_packages () {
fi
fi
# Update / Install the Homebrew packages in ~/.Brewfile
if command_exists brew && [ -f "$DOTFILES_DIR/installs/Brewfile" ]
then
if command_exists brew && [ -f "$DOTFILES_DIR/installs/Brewfile" ]; then
echo -e "\n${PURPLE}Updating homebrew and packages...${RESET}"
brew update
brew upgrade
@ -243,14 +242,21 @@ function intall_macos_packages () {
# Based on system type, uses appropriate package manager to install / updates apps
function install_packages () {
read -t $PROMPT_TIMEOUT -p "$(echo -e $CYAN_B)Would you like to install / update system packages? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "\n${PURPLE}Skipping package installs${RESET}"
echo -e "${PURPLE}Skipping package installs${RESET}"
return
fi
# Mac OS
if [ "$system_type" = "Darwin" ]; then
intall_macos_packages
fi
# If running in Linux desktop mode, prompt to install desktop apps via Flatpak
flatpak_script="${DOTFILES_DIR}/installs/flatpak.sh"
if [[ $(uname -s) == "Linux" ]] && [ ! -z $XDG_CURRENT_DESKTOP ] && [ -f $flatpak_script ]; then
chmod +x $flatpak_script
$flatpak_script
fi
}
# Updates current session, and outputs summary

View File

@ -113,6 +113,15 @@ function install_flatpak () {
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
}
# Ask user if they'd like to proceed, and exit if not
echo -e "${CYAN_B}Would you like to install Flatpak desktop apps? (y/N)${RESET}\n"
read -t $PROMPT_TIMEOUT -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo -e "${YELLOW}Skipping Flatpak installations..."
exit 0
fi
echo -e "${CYAN_B}Starting Flatpak App Installation Script${RESET}"
# Check that Flatpak is present, prompt to install or exit if not