Skip to content

Instantly share code, notes, and snippets.

@pgaskin
Last active September 7, 2023 14:16
Show Gist options
  • Save pgaskin/bf6b55d266cfe9cfbd7d5a2815ef2344 to your computer and use it in GitHub Desktop.
Save pgaskin/bf6b55d266cfe9cfbd7d5a2815ef2344 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"
if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
echo "usage: $0 fw [old_fw]"
exit 2
fi
test -f ~/kp/v/$1/nickel
rm -rf $1 && mkdir $1
rm -f kobo.resources.$1.{txt,md} nickel.$1.qInitResources_*.zip
set -x
printf '**Resource extraction:**\n\n```bash\n' >> kobo.resources.$1.md
python3 ../scripts/armqrc.py ~/kp/v/$1/nickel | sed 's/ */ /g' | while read qBin qVer q1 q2 q3 qDummy qName; do
echo go run github.com/pgaskin/qrc/cmd/qrc2zip@latest --output nickel.$1.qInitResources_$qName.zip --recursive --verbose nickel $qVer $q1 $q2 $q3 >> kobo.resources.$1.md
echo "nickel@$1/qInitResources_$qName" >> kobo.resources.$1.txt
go run github.com/pgaskin/qrc/cmd/qrc2zip@latest --output nickel.$1.qInitResources_$qName.zip --recursive --verbose $qBin $qVer $q1 $q2 $q3 >> kobo.resources.$1.txt
unzip -qqod $1 nickel.$1.qInitResources_$qName.zip
done
printf '```\n\n[Output](https://gist.github.com/pgaskin/TODO)' >> kobo.resources.$1.md
if [[ $# -eq 2 ]] && [[ -f ~/kp/v/$2/nickel ]]; then
git diff --no-index $2 $1 > kobo.resources.$2.$1.diff || true
printf ' [Diff](https://gist.github.com/pgaskin/TODO)' >> kobo.resources.$1.md
fi
printf '\n\n---\n\n' >> kobo.resources.$1.md
for x in nickel.$1.qInitResources_*.zip; do
printf 'https://krc.storage.pgaskin.net/%s\n' "$x" >> kobo.resources.$1.md
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment