Added pattern vs package handling for suse agent

This commit is contained in:
Eric Renfro 2024-05-13 20:20:52 -04:00
parent ae769186d1
commit 52905dc25b
Signed by: psi-jack
SSH key fingerprint: SHA256:1TKB8Z257L8EHK8GWNxKgMhD8a+FAR+f+j3nnlcuNVM

View file

@ -8,7 +8,8 @@ hook_before() {
rpm -qa | sort > Package.versions.list rpm -qa | sort > Package.versions.list
rpm -qa --queryformat '%{NAME}.%{ARCH}\n' | sort > Package.all.list rpm -qa --queryformat '%{NAME}.%{ARCH}\n' | sort > Package.all.list
zypper se -i | awk '/^i\+/ { print $3 }' | sort > Package.list zypper se -i -t pattern | awk '/^i\+/ { print $3 }' | sort > Pattern.list
zypper se -i -t package | awk '/^i\+/ { print $3 }' | sort > Package.list
zypper lr -e Backup.repos zypper lr -e Backup.repos
zypper ll | awk '/.*\| package.*/ { print $3 }' > Package.lock zypper ll | awk '/.*\| package.*/ { print $3 }' > Package.lock
@ -62,6 +63,24 @@ fi
#zypper dist-upgrade --from packman --allow-vendor-change #zypper dist-upgrade --from packman --allow-vendor-change
#zypper install --from packman ffmpeg gstreamer-plugins-{good,bad,ugly,libav} libavcodec vlc-codecs #zypper install --from packman ffmpeg gstreamer-plugins-{good,bad,ugly,libav} libavcodec vlc-codecs
if [[ -r "Pattern.list" && "\$(wc -l --total=only Pattern.list)" -gt 0 ]]; then
echo
echo "=============================="
echo "INSTALL PATTERNS"
echo "=============================="
echo
echo "The following patterns are listed to be installed:"
cat Pattern.list
echo
read -p "Do you want to continue to install these? [Y/n] " -n 1 -sr promptPattern
if [[ "\$promptPattern" =~ ^[Yy] ]]; then
echo "Yes"
cat Pattern.list | xargs zypper install -t pattern
else
echo -e "Cancelled\n"
fi
fi
echo echo
echo "==============================" echo "=============================="
echo "INSTALL PACKAGES" echo "INSTALL PACKAGES"
@ -81,7 +100,7 @@ echo "=============================="
echo "REMOVE PACKAGES" echo "REMOVE PACKAGES"
echo "==============================" echo "=============================="
echo echo
read -p "!!WARNING!! The next step is to remove packages that may not be desired. Do you want to continue? " -n 1 -sr promptRm read -p "!!WARNING!! The next step is to remove packages that may not be desired. Do you want to continue? [Y/n] " -n 1 -sr promptRm
if [[ "\$promptRm" =~ ^[Yy]$ ]]; then if [[ "\$promptRm" =~ ^[Yy]$ ]]; then
# Do the thing # Do the thing
echo "Yes" echo "Yes"
@ -111,7 +130,7 @@ else
fi fi
# Package Locks # Package Locks
if [[ -r "Package.lock" && "$(wc -l --total=only Package.list)" -gt 0 ]]; then if [[ -r "Package.lock" && "\$(wc -l --total=only Package.list)" -gt 0 ]]; then
echo echo
echo "==============================" echo "=============================="
echo "PACKAGE LOCKS" echo "PACKAGE LOCKS"