-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathpost-fs-data.sh
More file actions
37 lines (29 loc) · 986 Bytes
/
post-fs-data.sh
File metadata and controls
37 lines (29 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Certificates are collected during post-fs-data so that they are auto-mounted on top of /system for non-conscrypt devices
MODDIR=${0%/*}
SYS_CERT_DIR=/system/etc/security/cacerts
log() {
echo "$(date '+%m-%d %H:%M:%S ')" "$@" >> $MODDIR/log.txt
}
collect_user_certs(){
mkdir -p $MODDIR$SYS_CERT_DIR
# Clean directory so that deleted certs actually disappear
rm -rf $MODDIR$SYS_CERT_DIR/*
log "Grabbing user certs"
# Add the user-defined certs, looping over all available users
for dir in /data/misc/user/*; do
if [ -d "$dir/cacerts-added" ]; then
for cert in "$dir/cacerts-added"/*; do
cp "$cert" $MODDIR$SYS_CERT_DIR/
log "Grabbing user cert: $(basename "$cert")"
done
fi
done
}
main(){
echo "" > $MODDIR/log.txt
log "MagiskTrustUserCerts - post-fs-data.sh"
collect_user_certs
log "Grabbing /system certs"
cp $SYS_CERT_DIR/* $MODDIR$SYS_CERT_DIR
}
main