#!/bin/bash if [[ -d /etc/restore ]]; then rm -rf /etc/restore fi mkdir /etc/restore dpkg --get-selections > /etc/restore/Package.list aptitude search --disable-columns -F%p '~i!~M!~v' > /etc/restore/InstallOnly.list #apt-key exportall > /etc/restore/Repo.keys rsync -avhHi /etc/apt/trusted.gpg.d /etc/restore/ cat > /etc/restore/restore.sh </dev/null || install+=" rsync" dpkg-query -l 'aptitude' &>/dev/null || install+=" aptitude" dpkg-query -l 'borgbackup' &>/dev/null || install+=" borgbackup" dpkg-query -l 'borgmatic' &>/dev/null || install+=" borgmatic" if [[ -n "\$install" ]]; then apt -y install \$install fi rsync --ignore-existing -raz /etc/restore/trusted.gpg.d/ /etc/apt/trusted.gpg.d/ xargs aptitude --schedule-only install < /etc/restore/InstallOnly.list aptitude install EOF