-
-
Save jau88/f6575666f2f920d110c9 to your computer and use it in GitHub Desktop.
dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed
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 | |
set -e | |
# Clean out /var/cache/apt/archives | |
apt-get clean | |
# Fill it with all the .debs we need | |
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' | cut -f1) | |
DIR=$(mktemp -d -t info-XXXXXX) | |
for deb in /var/cache/apt/archives/*.deb | |
do | |
# Move to working directory | |
cd "$DIR" | |
# Create DEBIAN directory | |
mkdir -p DEBIAN | |
# Extract control files | |
dpkg-deb -e "$deb" | |
# Extract file list, fixing up the leading ./ and turning / into /. | |
dpkg-deb -c "$deb" | awk '{print $NF}' | cut -c2- | sed -e 's/^\/$/\/./' > DEBIAN/list | |
# Figure out binary package name | |
DEB=$(basename "$deb" | cut -d_ -f1) | |
# Copy each control file into place | |
cd DEBIAN | |
for file in * | |
do | |
cp -a "$file" /var/lib/dpkg/info/"$DEB"."$file" | |
done | |
# Clean up | |
cd .. | |
rm -rf DEBIAN | |
done | |
rmdir "$DIR" |
@setop but I got this,
dpkg-deb: error: failed to read archive '/var/cache/apt/archives/*.deb': No such file or directory
Everytime i run.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks !
After one thousand posts on the web saying I have to reinstall all packages (hundreds in my case) youre hint does what I expected : regenerate the list from the package itself.
GG