summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrootdir/system/bin/credmgrfirstboot.sh36
1 files changed, 22 insertions, 14 deletions
diff --git a/rootdir/system/bin/credmgrfirstboot.sh b/rootdir/system/bin/credmgrfirstboot.sh
index 4c21a83..20de77d 100755
--- a/rootdir/system/bin/credmgrfirstboot.sh
+++ b/rootdir/system/bin/credmgrfirstboot.sh
@@ -1,42 +1,50 @@
#!/system/bin/sh
CREDFOLDER=/data/credmgr
+LOG=/cache/credmgr.log
-# simple error function
+# start new log file
+echo -e "\n*********************************\n$(date) - $0 started" > $LOG
+
+# simple error function writing to kernel buffer and logfile
F_ERR(){
ERR="$1"
MSG="$2"
if [ $ERR -ne 0 ];then
- system/bin/toybox echo "CREDINIT: $MSG failed!" >> /dev/kmsg
+ echo "CREDINIT: $MSG failed!" >> $LOG
exit $ERR
else
- system/bin/toybox echo "CREDINIT: $MSG finished successfully" >> /dev/kmsg
+ echo "CREDINIT: $MSG finished successfully" >> $LOG
fi
}
# If credmgrd data doesn't match our
CREDMGRCNT=$(find $CREDFOLDER -group credmgr_client -type f -name "credmgr.db" | wc -l )
-if [ "$CREDMGRCNT" == "0" ]; then
+echo -e "credmgr folder:\n$(ls -la $CREDFOLDER)\ncredmgr match (if any):" >> $LOG
+find $CREDFOLDER -group credmgr_client -type f -name "credmgr.db" >> $LOG
+
+
+if [ "x$CREDMGRCNT" == "x0" ]; then
# If /data/credmgr exist remove it
- /system/bin/logwrapper /system/bin/toybox echo "CREDINIT: Dont match"
+ echo "CREDINIT: Dont match"
if [ -d "$CREDFOLDER" ]; then
- /system/bin/logwrapper /system/bin/toybox echo "CREDINIT: Drop old credmgrdata"
- /system/bin/mv -vf $CREDFOLDER $CREDFOLDER.old
+ echo "CREDINIT: Drop old credmgrdata"
+ mv -vf $CREDFOLDER ${CREDFOLDER}.old
fi
# Put binary into /cache
- /system/bin/logwrapper mkdir $CREDFOLDER
+ mkdir $CREDFOLDER >> $LOG 2>&1
F_ERR $? "mkdir $CREDFOLDER"
- /system/bin/logwrapper chown system:credmgr_client $CREDFOLDER
+ chown system:credmgr_client $CREDFOLDER >> $LOG 2>&1
F_ERR $? "chown $CREDFOLDER"
- /system/bin/logwrapper chcon u:object_r:credmgrd_data_file:s0 $CREDFOLDER
+ chcon u:object_r:credmgrd_data_file:s0 $CREDFOLDER >> $LOG 2>&1
F_ERR $? "chcon $CREDFOLDER"
- /system/bin/logwrapper /system/bin/toybox echo "CREDINIT: cp initial file"
- /system/bin/logwrapper cp -v /system/vendor/CredentialManagerData /cache/CredentialManagerData
+ echo "CREDINIT: cp initial file" >> $LOG 2>&1
+ cp -v /system/vendor/CredentialManagerData /cache/CredentialManagerData >> $LOG 2>&1
F_ERR $? "copy CredentialManagerData"
else
F_ERR 0 "credmgr found already. no preparation required."
fi
# Tell init we are ready
-/system/bin/setprop sys.credmgrdready true
-F_ERR $? "setting property"
+setprop sys.credmgrdready true
+F_ERR $? "setting property" \ No newline at end of file