search
Log In
Ask Solus is a community edited knowledge base and support forum for Solus. We are not endorsed or supported by Solus Project.
1 vote
15 views

Posted by AngelKrauze

{WIP } I made up a tiny script for auto-detect and repair broken packages

1 – Save the following code as fix_broken.sh

#!/bin/bash
Red="\033[0;31m" # Red
 
Yellow="\033[0;33m" # Yellow
if [ $USER != root ]; then
 
echo -e $Red"Error: must run as root user"
 
exit 0
 
fi
declare -a _installed=($(eopkg list-installed | cut -f1 -d " "))
echo -e $Yellow "    Verifying packages instalation"
for i in "${_installed[@]}"; do
 
((_index++))
 
printf "\r [!] $_index/${#_installed[*]} $i\033[K"
 
_status=$(eopkg check $i)
if [[ $_status != *"OK"* ]]; then
 
echo -e $Red"\033[5m $i seems broken"
 
sudo eopkg it --reinstall $i > /dev/null 2>&1 & echo  -e $Yellow"reinstalling $i"
 
fi
 
done
 
printf "\033[K" & echo -e "\n     Package verification ... DONE"
 

2 – Open in terminal the folder that contains fix_broken.sh

cd /home/<USERNAME>/Downloads

3 – Give it execution permissions

sudo chmod +x fix_broken.sh

4 – Execute as root

sudo sh fix_broken.sh

5 – Enjoy(:

For the curious:

The script save the installed packages list into the _installed array, then checks the packages, if its status is not “OK” then repairs it.

 

15.9k points 3 4 7

Please log in or register to answer this question.

...