mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-18 13:24:40 +00:00
38cdcdda50
This aims to fix two issues with the previous implementation: 1. the whole content of downloaded archives were extracted, while only few files are necessary; 2. the archives were extracted in the prebuild-deps/ directory as is. As a consequence of (2), the actual directory name relied on the root directory of the archive. For adb, this root directory was always "platform-tools", so when bumping the adb version, the target directory already existed and the dependency was not upgraded (the old one had to be removed manually). Expose common function to download a file and check its checksum, but let the custom script for each dependency extract only the needed files and reorganize the content if necessary.
23 lines
414 B
Plaintext
Executable File
23 lines
414 B
Plaintext
Executable File
PREBUILT_DATA_DIR=data
|
|
|
|
checksum() {
|
|
local file="$1"
|
|
local sum="$2"
|
|
echo "$file: verifying checksum..."
|
|
echo "$sum $file" | sha256sum -c
|
|
}
|
|
|
|
get_file() {
|
|
local url="$1"
|
|
local file="$2"
|
|
local sum="$3"
|
|
if [[ -f "$file" ]]
|
|
then
|
|
echo "$file: found"
|
|
else
|
|
echo "$file: not found, downloading..."
|
|
wget "$url" -O "$file"
|
|
fi
|
|
checksum "$file" "$sum"
|
|
}
|