Skip to content

Instantly share code, notes, and snippets.

@CPT-GrayWolf
Last active September 22, 2025 06:51
Show Gist options
  • Select an option

  • Save CPT-GrayWolf/c26446298bc769238b349165a051e4b1 to your computer and use it in GitHub Desktop.

Select an option

Save CPT-GrayWolf/c26446298bc769238b349165a051e4b1 to your computer and use it in GitHub Desktop.
Install Blu-Ray AACS VUK keys for libaacs automatically from the FindVUK database.
#!/bin/bash
#
# This is a simple bash script, designed to allow
# quick download and installation of the FindVUK
# AACS VUK database.
#
# This allows Blu-Ray disks who's VUK is known
# to be played on systems using libaacs.
#
# It's reccomended to schedule this file to run
# once or twice daily, in order to keep your
# KEYDB.cfg up-to-date.
#
# NOTE:
# This *does not* provide the files needed to
# properly decode the small number of disks that
# use BD+.
#
# Created by T.I. "Luna" Ericson.
#
# Thanks to gsquarediv, for making me aware of
# several typos that I had missed.
tmpname="$(mktemp).zip"
if [ "$1" = "-l" ]
then
target="$HOME/.config/aacs"
else
if [ "$(id -u)" -ne 0 ]
then
>&2 echo "Superuser privileges required for global update."
>&2 echo "Try '-l' to update the local database, or run as root."
exit 1
fi
target="/etc/xdg/aacs"
fi
echo "Attempting to fetch database from FindVUK:"
echo "This may take some time."
for i in {1..6}
do
echo "Try ${i}."
# I have removed the progress bar options, as they're too
# unreliable. If you want them, feel free to add them back.
if wget -q --timeout=15 -t 1 --continue -O "${tmpname}" http://fvonline-db.bplaced.net/fv_download.php?lang=eng
then
break
fi
if [ "$i" -eq 6 ]
then
>&2 echo "Failed to download database!"
>&2 echo "Please try again later."
exit 1
fi
echo "Failed! Retrying..."
sleep 5
done
if ! [ -d "$target" ]
then
echo -e "\nDirectory \"${target}\" is missing!"
echo "Creating \"${target}\"..."
if ! mkdir -p "$target"
then
>&2 echo "Failed to create \"${target}\"!"
exit 1
fi
fi
if ! cd "$target"
then
>&2 echo -e "\nFailed to switch directory to \"${target}\""
exit 1
fi
if ! unzip -uo "${tmpname}"
then
>&2 echo -e "\nFailed to open archive!"
exit 1
fi
# Check if a device key header file is present
# Otherwise, just install the VUK database.
if [ -f key_header ]
then
echo -e "\nFound key_header in \"${target}\"."
cp -f key_header KEYDB.cfg
cat keydb.cfg >> KEYDB.cfg
rm -f keydb.cfg
else
echo -e "\nNo key_header found."
echo "Only the VUK database will be installed."
mv -f keydb.cfg KEYDB.cfg
fi
if ! [ "$1" = "-l" ]
then
chmod -R a+r "$target"
fi
echo -e "\nAACS database is up-to-date."
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment