wesleybliss
5/3/2017 - 9:03 PM

Restores repos + apps on RPM based distros

Restores repos + apps on RPM based distros

#!/bin/bash

BASE="~/Dropbox/fedora-backups/installed-software-list"

echo
echo "Are you sure you want to restore DNF repos/configs, and install all packages?"
echo
echo "You should make a backup first!"
echo

read -r -p "Really? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then
    echo
    echo "Roger that."
    echo
    echo "Restoring DNF (Yum) configs..."
    sudo /bin/cp -LRf "$BASE/etc_yum.repos.d/*" /etc/yum.repos.d/
    echo
    echo "Installing all packages..."
    sudo dnf install -y $(cat "$BASE/dnf-installed-packages.log")
    echo
    echo "Finished restoring DNF config & packages!"
fi