Added apt repos to backup/restore
This commit is contained in:
parent
2f4e9c280b
commit
9769d2a137
1 changed files with 11 additions and 2 deletions
|
@ -2,9 +2,15 @@
|
||||||
|
|
||||||
restoreDir="/etc/restore"
|
restoreDir="/etc/restore"
|
||||||
|
|
||||||
|
function is_bin_in_path {
|
||||||
|
builtin type -P "$1" &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
hook_check() {
|
hook_check() {
|
||||||
:
|
if ! is_bin_in_path aptitude; then
|
||||||
|
echo "aptitude needs to be installed for backups to work properly."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
hook_pre() {
|
hook_pre() {
|
||||||
|
@ -14,7 +20,9 @@ hook_pre() {
|
||||||
dpkg --get-selections > Package.list
|
dpkg --get-selections > Package.list
|
||||||
aptitude search --disable-columns -F%p '~i!~M!~v' > InstallOnly.list
|
aptitude search --disable-columns -F%p '~i!~M!~v' > InstallOnly.list
|
||||||
#apt-key exportall > /etc/restore/Repo.keys
|
#apt-key exportall > /etc/restore/Repo.keys
|
||||||
rsync -avhHi /etc/apt/trusted.gpg.d /etc/restore/
|
cp -a /etc/apt/sources.list "$restoreDir/"
|
||||||
|
rsync -avhHi /etc/apt/sources.list.d "$restoreDir/"
|
||||||
|
rsync -avhHi /etc/apt/trusted.gpg.d "$restoreDir/"
|
||||||
|
|
||||||
cat > restore.sh <<EOF
|
cat > restore.sh <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
@ -43,6 +51,7 @@ if [[ -n "\$install" ]]; then
|
||||||
apt -y install \$install
|
apt -y install \$install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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/
|
||||||
xargs aptitude --schedule-only install < InstallOnly.list
|
xargs aptitude --schedule-only install < InstallOnly.list
|
||||||
aptitude install
|
aptitude install
|
||||||
|
|
Loading…
Reference in a new issue