From abc306c6455e69f2667948eef3a3d596342b65e1 Mon Sep 17 00:00:00 2001 From: BlackDragon Date: Sun, 14 Sep 2025 21:33:21 +0200 Subject: [PATCH] changes --- .gitignore | 4 +--- createlookup.sh | 1 - extractapps.sh | 7 ++++++- validatevhd.sh | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) mode change 100644 => 100755 createlookup.sh create mode 100755 validatevhd.sh diff --git a/.gitignore b/.gitignore index b468cad..2c31100 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1 @@ -images/app/* -images/tree/*/* -images/vhd/* \ No newline at end of file +images/* \ No newline at end of file diff --git a/createlookup.sh b/createlookup.sh old mode 100644 new mode 100755 index ec8bce8..70be1b0 --- a/createlookup.sh +++ b/createlookup.sh @@ -5,7 +5,6 @@ if [ $# -eq 0 ]; then fi profile="$1" -rm images/lookup/phase1_$1.csv while IFS=, read -r version backingversion url do vhd=$(basename "$url" | sed -E "s/.app/.vhd/") diff --git a/extractapps.sh b/extractapps.sh index 73b909d..70bc938 100755 --- a/extractapps.sh +++ b/extractapps.sh @@ -18,11 +18,16 @@ do else echo "Decrypting $file" fsdecrypt images/app/$file - copy images/ + mv images/app/*.vhd images/vhd fi else if [ ! -f images/vhd/$vhd ]; then echo "Downloading $file" + aria2c -x 8 -j 8 -o images/app/$file $url + + echo "Decrypting $file" + fsdecrypt images/app/$file + mv images/app/*.vhd images/vhd fi fi done < profiles/$profile/apps.csv \ No newline at end of file diff --git a/validatevhd.sh b/validatevhd.sh new file mode 100755 index 0000000..ddd40c3 --- /dev/null +++ b/validatevhd.sh @@ -0,0 +1,34 @@ +#!/bin/bash +if [ $# -eq 0 ]; then + echo "Usage: $0 " + exit 1 +fi + +profile="$1" +while IFS=, read -r version backingversion url +do + vhd=$(basename "$url" | sed -E "s/.app/.vhd/") + if [ -f "images/vhd/$vhd" ]; then + input=$(vhdiinfo images/vhd/$vhd) + + identifier=$(echo "$input" | grep -i "Identifier" | head -1 | awk '{print $NF}') + parent_identifier=$(echo "$input" | grep -i "Parent identifier" | awk '{print $NF}') + parent_filename=$(echo "$input" | grep -i "Parent filename" | awk -F': ' '{print $2}') + if [ -n "$(printf "%s" "$parent_filename" | tr -d '\000-\177')" ]; then + echo "Parent filename contains non-ASCII characters" + str=$(strings -e l images/vhd/$vhd | head -n 1) + be=$(echo -n $str | iconv -f UTF-8 -t UTF-16BE | xxd -p -c1 | tr -d '\n ' | sed 's/../\\x&/g') + le=$(echo -n $str | iconv -f UTF-8 -t UTF-16LE | xxd -p -c1 | tr -d '\n ' | sed 's/../\\x&/g') + mv images/vhd/$vhd images/vhd/$vhd.old + bbe -e "s/$le/$be/" images/vhd/$vhd.old | pv -s $(stat --printf="%s" images/vhd/$vhd.old) > images/vhd/$vhd + + echo $parent_filename + + else + echo "Parent filename contains only ASCII characters" + fi + else + echo "images/vhd/$vhd not found" + fi + +done < profiles/$profile/apps.csv \ No newline at end of file