Added apt keyrings copy/restore

This commit is contained in:
Eric Renfro 2023-09-22 01:28:14 -04:00
parent 9a7618655e
commit 018bdb500a
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
1 changed files with 7 additions and 4 deletions

View File

@ -23,6 +23,7 @@ hook_pre() {
cp -a /etc/apt/sources.list "$restoreDir/"
rsync -avhHi /etc/apt/sources.list.d "$restoreDir/"
rsync -avhHi /etc/apt/trusted.gpg.d "$restoreDir/"
[[ -d /etc/apt/keyrings ]] && rsync -avhHi /etc/apt/keyrings "$restoreDir/"
cat > restore.sh <<EOF
#!/bin/bash
@ -42,10 +43,11 @@ fi
install=""
dpkg-query -s 'rsync' &>/dev/null || install+=" rsync"
dpkg-query -s 'aptitude' &>/dev/null || install+=" aptitude"
dpkg-query -s 'borgbackup' &>/dev/null || install+=" borgbackup"
dpkg-query -s 'borgmatic' &>/dev/null || install+=" borgmatic"
dpkg-query -s 'rsync' &>/dev/null || install+=" rsync"
dpkg-query -s 'aptitude' &>/dev/null || install+=" aptitude"
dpkg-query -s 'borgbackup' &>/dev/null || install+=" borgbackup"
dpkg-query -s 'borgmatic' &>/dev/null || install+=" borgmatic"
dpkg-query -s 'apt-transport-https' &>/dev/null || install+=" apt-transport-https"
if [[ -n "\$install" ]]; then
apt -y install \$install
@ -56,6 +58,7 @@ grep ':i386' InstallOnly.list &>/dev/null && dpkg --add-architecture i386
cp -a sources.list /etc/apt/sources.list
rsync --ignore-existing -raz sources.list.d/ /etc/apt/sources.list.d/
rsync --ignore-existing -raz trusted.gpg.d/ /etc/apt/trusted.gpg.d/
[[ -d keyrings ]] && rsync --ignore-existing -raz keyrings/ /etc/apt/keyrings/
apt update