summaryrefslogtreecommitdiff
path: root/rootdir/system
diff options
context:
space:
mode:
authornailyk-fr <nailyk_git@nailyk.fr>2017-05-03 22:27:01 +0200
committernailyk-fr <nailyk_git@nailyk.fr>2017-05-10 11:17:37 +0000
commit5da01ebea7bd3f4344b8eb0f887ac1e9927644cd (patch)
tree870fbd76f35b17a48a2ea31b8acf81d6406625ab /rootdir/system
parentbd03c504e298e968aba8a584b37ca60692e7c2cd (diff)
shinano-common: init: Correct credmgrd boot script
Log improvements: * new: added logfile (/cache/credmgr.log) instead of logwrapper for better debugging * new: more verbose logging * fix: replaced toybox cmds with generic ones (so either ramdisk or system can provide them) Known issue: * Can cause a black screen issue Change-Id: I19710e8b6e45d4fa9397575f4f9f31b7727e4468
Diffstat (limited to 'rootdir/system')
-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