Files
android/libwvdrmengine/move_widevine_data.sh
Ereth McKnight-MacNeil 63eae1f4a4 Shell quoting in move_widevine_data.sh
Add double quotes to prevent globbing and word splitting.

Bug: crbug.com/1168550
Test: Create /data/mediadrm files and observe they are moved
Change-Id: I8d1cd70971588f903657825ea6e10c019954f403
(cherry picked from commit 8649f7a952b7e4f8edd17edfca0b0962e2fb2662)
(cherry picked from commit 84d0d73be5)
2021-04-27 00:27:27 +00:00

30 lines
823 B
Bash
Executable File

#!/system/bin/sh
DEST_PATH="/data/vendor/mediadrm"
FILES_MOVED="/data/vendor/mediadrm/files_moved"
SRC_PATH="/data/mediadrm"
L3_FILE_PATTERN="ay64.dat*"
if [ ! -f "$FILES_MOVED" ]; then
for i in "$SRC_PATH/IDM"*; do
dest_path=$DEST_PATH/"${i#$SRC_PATH/}"
if [ -d "$i" ]; then
mkdir -p "$dest_path" -m 700
mv "$i" "$DEST_PATH"
for file in ${dest_path}/${L3_FILE_PATTERN}; do
[ -e "${file}" ] || continue
# We need to move any L3 files in the IDM folder to the L3 subfolder.
l3_dir="${dest_path}/L3/"
mkdir -p "${l3_dir}" -m 700
mv "${file}" "${l3_dir}"
done
find "$dest_path" -print0 | while IFS= read -r -d '' file
do
chgrp media "$file"
done
fi
done
restorecon -R "$DEST_PATH"
echo 1 > "$FILES_MOVED"
fi