Skip to content

Instantly share code, notes, and snippets.

@frontierpsycho
Created February 14, 2021 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frontierpsycho/2628244d95d187f922c7f8ce07fa0c79 to your computer and use it in GitHub Desktop.
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)
#!/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