Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Restore a file from the package that provides it.

View restore-file-from-package.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/bin/bash
 
# Usage:
#
# sudo ./restore-file-from-package.sh <filepath>
#
# Restore a file from the package that provides it.
#
# Source: http://askubuntu.com/a/67028/30482
 
set -x
set -e
 
FILE_TO_RESTORE=$(readlink -e $1)
mv -n ${FILE_TO_RESTORE} ${FILE_TO_RESTORE}.bak
apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall $(dpkg -S ${FILE_TO_RESTORE} | head -1 | cut -d ':' -f1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.