Created
February 14, 2021 10:20
-
-
Save frontierpsycho/2628244d95d187f922c7f8ce07fa0c79 to your computer and use it in GitHub Desktop.
Restore disabled fortune databases (in case it's needed to update the package)
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 | |
# replace with your least favourite databases | |
COLLECTIONNAMES=('zippy' 'knghtbrd' 'misogyny' 'racism' 'misandry' 'hphobia') | |
FORTUNES_DIRECTORY=/usr/share/games/fortunes | |
OFFENSIVE_FORTUNES_DIRECTORY=${FORTUNES_DIRECTORY}/off | |
for collection in "${COLLECTIONNAMES[@]}"; do | |
echo "==================" | |
echo "Restoring ${collection}" | |
echo "Non offensive first..." | |
if [ -e "${FORTUNES_DIRECTORY}/${collection}.dat.no" ]; then | |
if sudo mv "${FORTUNES_DIRECTORY}/${collection}.dat.no" "${FORTUNES_DIRECTORY}/${collection}.dat"; then | |
echo "${collection} restored." | |
else | |
echo "Failed to move ${collection}!" | |
exit 1 | |
fi | |
else | |
echo "${FORTUNES_DIRECTORY}/${collection}.dat.no does not exist, doing nothing" | |
fi | |
echo "Then offensive..." | |
if [ -e "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat.no" ]; then | |
if sudo mv "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat.no" "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat"; then | |
echo "${collection} restored." | |
else | |
echo "Failed to move ${collection}!" | |
exit 1 | |
fi | |
else | |
echo "${OFFENSIVE_FORTUNES_DIRECTORY}/${collection}.dat.no does not exist, doing nothing" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment