Skip to content

Instantly share code, notes, and snippets.

@r3b311i0n
Created November 27, 2017 21:54
Show Gist options
  • Save r3b311i0n/73ad2ad494094463c8303188db5f4ce7 to your computer and use it in GitHub Desktop.
Save r3b311i0n/73ad2ad494094463c8303188db5f4ce7 to your computer and use it in GitHub Desktop.
Script for extracting gresource archives.
# The GResource file name
GR_FILE="gtk.gresource"
# The base folder of the extracted resources
GR_BASEDIR="/org/gnome/"
## Check for required utilities...
for REQUIRED_PROG in gresource
do
which ${REQUIRED_PROG} &>/dev/null
if [ $? -ne 0 ]; then
echo "Unable to find required program '${REQUIRED_PROG}' in PATH."
exit 1
fi
done
for RSRC in $(gresource list $GR_FILE)
do
RSRC_FILE=$(echo "${RSRC#$GR_BASEDIR}")
mkdir -p $(dirname "./$RSRC_FILE") ||:
gresource extract "$GR_FILE" "$RSRC" > "./$RSRC_FILE"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment