From b154e4a448c52b20f99868ac2c15648f43c20e37 Mon Sep 17 00:00:00 2001 From: Paul M Date: Fri, 27 Oct 2023 16:34:59 -0500 Subject: [PATCH] save point adding exclusions --- restore.arch.bash | 2 ++ restore.deb.bash | 5 +++++ restore.lib.bash | 11 +++++++++++ restore.wrt.bash | 2 ++ syssetup.bash | 3 +++ 5 files changed, 23 insertions(+) create mode 100644 restore.lib.bash diff --git a/restore.arch.bash b/restore.arch.bash index 6f4d24f..52e5546 100755 --- a/restore.arch.bash +++ b/restore.arch.bash @@ -1,5 +1,7 @@ #!/bin/bash +source ./restore.lib.bash + function cprint () { color="$1" shift diff --git a/restore.deb.bash b/restore.deb.bash index 7e9c152..e43a381 100755 --- a/restore.deb.bash +++ b/restore.deb.bash @@ -1,5 +1,7 @@ #!/bin/bash +source ./restore.lib.bash + function cprint () { color="$1" shift @@ -32,6 +34,9 @@ function restore_config() { apt update apt upgrade -y # now the programs installed via apt before we restore configs + if [ -f ./exclusions ]; then + exclusions # this runs exclusions + fi apt install -y $(cat $aptpkgfile | awk '{print $1}') # we should be set app wise now the configs cp -R etc/ /etc diff --git a/restore.lib.bash b/restore.lib.bash new file mode 100644 index 0000000..6d7f6f2 --- /dev/null +++ b/restore.lib.bash @@ -0,0 +1,11 @@ +#!/bin/bash + +# Extra functions for restore scripts + +function exclusions () { + # rebuild installed_packages file minus those listed in the exclusions file + + mv installed_packages installed_packages.orig + grep -vf exclusions installed_packages.orig > installed_packages + +} \ No newline at end of file diff --git a/restore.wrt.bash b/restore.wrt.bash index a65008b..35b0f8d 100755 --- a/restore.wrt.bash +++ b/restore.wrt.bash @@ -2,6 +2,8 @@ # This will be called after the bootstrap. As we need to make sure bash is present +source ./restore.lib.bash + function cprint () { color="$1" shift diff --git a/syssetup.bash b/syssetup.bash index a6333c6..78857af 100755 --- a/syssetup.bash +++ b/syssetup.bash @@ -48,6 +48,9 @@ function copy_config() { tmpdir=$(mktemp -d) echo $tmpdir cp -r /etc/ $tmpdir + if [ -f ./exclusions ]; then + cp ./exclusions $tmpdir + fi if [ "$osp" = "Debian" ]; then dpkg --get-selections > $tmpdir/installed_packages cp ./restore.deb.bash $tmpdir/restore.bash