save point adding exclusions

This commit is contained in:
Paul M 2023-10-27 16:34:59 -05:00
parent ed616685c8
commit b154e4a448
5 changed files with 23 additions and 0 deletions

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
source ./restore.lib.bash
function cprint () { function cprint () {
color="$1" color="$1"
shift shift

View file

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
source ./restore.lib.bash
function cprint () { function cprint () {
color="$1" color="$1"
shift shift
@ -32,6 +34,9 @@ function restore_config() {
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
if [ -f ./exclusions ]; then
exclusions # this runs exclusions
fi
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/ /etc cp -R etc/ /etc

11
restore.lib.bash Normal file
View file

@ -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
}

View file

@ -2,6 +2,8 @@
# This will be called after the bootstrap. As we need to make sure bash is present # This will be called after the bootstrap. As we need to make sure bash is present
source ./restore.lib.bash
function cprint () { function cprint () {
color="$1" color="$1"
shift shift

View file

@ -48,6 +48,9 @@ function copy_config() {
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
echo $tmpdir echo $tmpdir
cp -r /etc/ $tmpdir cp -r /etc/ $tmpdir
if [ -f ./exclusions ]; then
cp ./exclusions $tmpdir
fi
if [ "$osp" = "Debian" ]; then if [ "$osp" = "Debian" ]; then
dpkg --get-selections > $tmpdir/installed_packages dpkg --get-selections > $tmpdir/installed_packages
cp ./restore.deb.bash $tmpdir/restore.bash cp ./restore.deb.bash $tmpdir/restore.bash