Skip to content

Commit

Permalink
tmp-ca-copy -> adg-ca-copy
Browse files Browse the repository at this point in the history
  • Loading branch information
sfionov committed Sep 25, 2023
1 parent 88da525 commit 763f325
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions module/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,23 @@ set_context /system/etc/security/cacerts ${MODDIR}/system/etc/security/cacerts
# Since Magisk ignore /apex for module file injections, use non-Magisk way
if [ -d /apex/com.android.conscrypt/cacerts ]; then
# Clone directory into tmpfs
rm -f /data/local/tmp/tmp-ca-copy
mkdir -p /data/local/tmp/tmp-ca-copy
mount -t tmpfs tmpfs /data/local/tmp/tmp-ca-copy
cp -f /apex/com.android.conscrypt/cacerts/* /data/local/tmp/tmp-ca-copy/
rm -f /data/local/tmp/adg-ca-copy
mkdir -p /data/local/tmp/adg-ca-copy
mount -t tmpfs tmpfs /data/local/tmp/adg-ca-copy
cp -f /apex/com.android.conscrypt/cacerts/* /data/local/tmp/adg-ca-copy/
# Do the same as in Magisk module
cp -f ${AG_CERT_FILE} /data/local/tmp/tmp-ca-copy
chown -R 0:0 /data/local/tmp/tmp-ca-copy
set_context /apex/com.android.conscrypt/cacerts /data/local/tmp/tmp-ca-copy
cp -f ${AG_CERT_FILE} /data/local/tmp/adg-ca-copy
chown -R 0:0 /data/local/tmp/adg-ca-copy
set_context /apex/com.android.conscrypt/cacerts /data/local/tmp/adg-ca-copy
# Mount directory inside APEX if it is valid, and remove temporary one.
CERTS_NUM="$(ls -1 /data/local/tmp/tmp-ca-copy | wc -l)"
CERTS_NUM="$(ls -1 /data/local/tmp/adg-ca-copy | wc -l)"
if [ "$CERTS_NUM" -gt 10 ]; then
mount --bind /data/local/tmp/tmp-ca-copy /apex/com.android.conscrypt/cacerts
mount --bind /data/local/tmp/adg-ca-copy /apex/com.android.conscrypt/cacerts
else
echo "Cancelling replacing CA storage due to safety"
fi
umount /data/local/tmp/tmp-ca-copy
rmdir /data/local/tmp/tmp-ca-copy
umount /data/local/tmp/adg-ca-copy
rmdir /data/local/tmp/adg-ca-copy
fi

0 comments on commit 763f325

Please sign in to comment.