Skip to content

Instantly share code, notes, and snippets.

@CPT-GrayWolf
Last active April 20, 2024 03:37
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CPT-GrayWolf/c26446298bc769238b349165a051e4b1 to your computer and use it in GitHub Desktop.
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 decone the small number of disks that
# use BD+.
#
# Created by T.I. "Luna" Ericson.
tmpname="$(mktemp).zip"
if [ "$1" = "-l" ]
then
target="$HOME/.config/aacs"
else
if [ "$(id -u)" -ne 0 ]
then
>&2 echo "Superuser privileges required for glabal 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 make take some time."
for i in {1..6}
do
echo "Try ${i}."
if wget -q --show-progress --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 "\nDerectory \"${target}\" is missing!"
echo "Creating \"${target}\"..."
mkdir -p "$target" || exit 1
fi
cd "$target" || (>&2 echo -e "\n Failed to switch directory to \"${target}\""; exit 1)
if ! unzip "${tmpname}"
then
>&2 echo -e "\nFailed to open archive!"
exit 1
fi
# Check is 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 "\nNot key_header found."
echo "Onky 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