This commit is contained in:
Kyan 2025-09-14 21:33:21 +02:00
parent 66ee671c6e
commit abc306c645
4 changed files with 41 additions and 5 deletions

4
.gitignore vendored
View file

@ -1,3 +1 @@
images/app/*
images/tree/*/*
images/vhd/*
images/*

1
createlookup.sh Normal file → Executable file
View file

@ -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/")

View file

@ -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

34
validatevhd.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <profile>"
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