File tree 1 file changed +22
-4
lines changed
1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,31 @@ base_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)/.."
5
5
unpack_dir=" ${base_dir} /unpack_dir"
6
6
target_dir=" ${base_dir} /src/ale/python/roms"
7
7
8
+ file_url=" https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64"
9
+ expected_checksum=" 02ca777c16476a72fa36680a2ba78f24c3ac31b2155033549a5f37a0653117de"
10
+ temp_file=" Roms.tar.gz.b64"
11
+
8
12
# make the directory where we will do the unpacking
9
13
mkdir $unpack_dir
10
14
11
- # download the ROMs from the git gist, decode it, then unpack it
12
- curl " https://gist.githubusercontent.com/jjshoots/61b22aefce4456920ba99f2c36906eda/raw/00046ac3403768bfe45857610a3d333b8e35e026/Roms.tar.gz.b64" \
13
- | base64 --decode \
14
- | tar -xzf - -C $unpack_dir
15
+ # Download the ROMs
16
+ curl -o " $temp_file " " $file_url "
17
+
18
+ # Compute the SHA256 checksum of the ROMs file and compare with the expected checksum
19
+ computed_checksum=$( sha256sum " $temp_file " | awk ' { print $1 }' ) # use `shasum -a 256` for macos
20
+
21
+ if [ " $computed_checksum " == " $expected_checksum " ]; then
22
+ # Decode the base64 file and extract the tar.gz content
23
+ cat " $temp_file " \
24
+ | base64 --decode \
25
+ | tar -xzf - -C " $unpack_dir "
26
+
27
+ # Clean up the temporary file
28
+ rm -f " $temp_file "
29
+ else
30
+ echo " Checksum verification failed! Exiting."
31
+ exit 1 # Stop the script on checksum failure
32
+ fi
15
33
16
34
# move the ROMs out into a roms folder
17
35
mv ${unpack_dir} /ROM/* /* .bin $target_dir
You can’t perform that action at this time.
0 commit comments