Fix zypper_autoremove.bash
This commit is contained in:
parent
a836a3c882
commit
7228b78447
1 changed files with 2 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Script that imitates `apt autoremove` for zypper as there is no native solution.
|
# Script that imitates `apt autoremove` for zypper as there is no native solution.
|
||||||
|
|
||||||
package_list=$(sudo zypper packages --unneeded)
|
package_list=$(LC_ALL=C sudo zypper packages --unneeded)
|
||||||
table_start=$(echo "$package_list" | grep -n "S | Repository | Name"| gawk '{print $1}' FS=":")
|
table_start=$(echo "$package_list" | grep -n "S | Repository | Name"| gawk '{print $1}' FS=":")
|
||||||
|
|
||||||
unneeded_packages=()
|
unneeded_packages=()
|
||||||
|
@ -13,7 +13,7 @@ done < <(echo "$package_list" | tail -n+$((table_start+2)))
|
||||||
|
|
||||||
unneeded_package_list=$(printf '%s ' "${unneeded_packages[@]}")
|
unneeded_package_list=$(printf '%s ' "${unneeded_packages[@]}")
|
||||||
|
|
||||||
if [ "$unneeded_package_list" = " " ]; then
|
if [ ! "$unneeded_package_list" = " " ]; then
|
||||||
sudo zypper rm -u $unneeded_package_list
|
sudo zypper rm -u $unneeded_package_list
|
||||||
else
|
else
|
||||||
echo "No unneeded packages."
|
echo "No unneeded packages."
|
||||||
|
|
Loading…
Reference in a new issue