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

View file

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