working as tested with VM

This commit is contained in:
Paul 2023-09-20 17:01:48 -05:00
parent 220e500d81
commit 105d5f481c
2 changed files with 6 additions and 3 deletions

View file

@ -42,7 +42,8 @@ function copy_config() {
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
echo $tmpdir echo $tmpdir
cp -r /etc/ $tmpdir cp -r /etc/ $tmpdir
apt list --installed | awk -F/ '{print $1}' > $tmpdir/installed_packages #apt list --installed | awk -F/ '{print $1}' > $tmpdir/installed_packages
dpkg --get-selections > $tmpdir/installed_packages
# From https://wiki.debian.org/AptCLI#apt-file # From https://wiki.debian.org/AptCLI#apt-file
# dpkg --get-selections >/backup/package-selections # dpkg --get-selections >/backup/package-selections
# apt install $(cat /backup/package-selections | awk '{print $1}') # apt install $(cat /backup/package-selections | awk '{print $1}')

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
set -x
function cprint () { function cprint () {
color="$1" color="$1"
shift shift
@ -32,13 +34,13 @@ function restore_config() {
aptpkgfile="installed_packages" aptpkgfile="installed_packages"
# restore apt first # restore apt first
cp -R apt/ /etc cp -R etc/apt/ /etc
apt update apt update
apt upgrade -y apt upgrade -y
# now the programs installed via apt before we restore configs # now the programs installed via apt before we restore configs
apt install -y $(cat $aptpkgfile | awk '{print $1}') apt install -y $(cat $aptpkgfile | awk '{print $1}')
# we should be set app wise now the configs # we should be set app wise now the configs
cp -R . /etc cp -R etc/ /etc
# most files in here with me are from /etc # most files in here with me are from /etc