34 lines
985 B
Bash
Executable file
34 lines
985 B
Bash
Executable file
#!/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 <<EOF
|
|
#!/bin/bash
|
|
|
|
#apt-key add /etc/restore/Repo.keys
|
|
#dpkg --set-selections < /etc/restore/Package.list
|
|
#apt-get dselect-upgrade
|
|
|
|
install=""
|
|
|
|
dpkg-query -l 'rsync' &>/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
|