Last active
August 24, 2020 12:10
-
-
Save scicco/432ebe01ac0e7b371f3155839c85ecbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for listfile in /var/lib/dpkg/info/*.list.broken; do | |
#echo ${listfile##*/} | |
listfilename=$(basename -- "$listfile") | |
listfilename="${listfilename%.*}" | |
echo "list file name: ${listfilename}" | |
if [ -f "/var/lib/dpkg/info/${listfilename}" ]; then | |
output=$(file "/var/lib/dpkg/info/${listfilename}" | awk '{print $2}') | |
echo $output | |
#break | |
if [[ $output == *"data"* ]]; then | |
echo "$(filename) is still DATA!!!" | |
#something is not working, let's stop | |
break | |
else | |
continue | |
fi | |
fi | |
listfilename="${listfilename%.*}" | |
#echo ${listfilename} | |
echo "program name: ${listfilename}" | |
#break | |
output=$(file ${listfile}| awk '{print $2}') | |
#echo "${output}" | |
if [[ $output == *"data"* ]]; then | |
echo "${listfile} is DATA!" | |
echo "${listfilename}" | |
#echo "apt-get install -y $listfilename --reinstall || exit $?" | |
apt-get install -y "${listfilename}" --reinstall || exit $? | |
#stop after one install, check that everything works then lauch this script again ;-) | |
break | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment