Skip to content

Instantly share code, notes, and snippets.

@milosmrda
Forked from yesdrs13/backup_flatpaks.sh
Created October 29, 2023 10:17
Show Gist options
  • Select an option

  • Save milosmrda/72a8ac481043135e04faf64a766b07ab to your computer and use it in GitHub Desktop.

Select an option

Save milosmrda/72a8ac481043135e04faf64a766b07ab to your computer and use it in GitHub Desktop.
Backup flatpaks (and re-install them)
#! /bin/bash
# This script will make a folder called 'Backups' in the users 'home' (~) folder
# if it does not exist already and then make a backup of all flatpak software
# with a time stamp prepended to the beginning of the file called
# '_install_flatpaks.sh'. After this file is created, you can use it to
# install (or re-install) all of your flatpaks.
cd ~
mkdir -p ./Backups
cd ./Backups
tmp=$(flatpak list --app --columns=application | xargs echo -n)
echo -e '#!/bin/bash'"\nflatpak install "$tmp > install_flatpaks.sh
sudo chmod +x install_flatpaks.sh
mv install_flatpaks.sh "$(date +%Y-%m-%d--%H-%M-%S)_install_flatpaks.sh"
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment