From 281e1c378aaa1b7197051f9a1e4f0d75b60dcac8 Mon Sep 17 00:00:00 2001 From: Alexander Diewald Date: Tue, 28 Nov 2017 15:49:49 +0100 Subject: shinano: Move shell scripts to system/vendor. * Scripts use the /system/vendor/bin/sh shebang now. * Move shell scripts from system/etc to vendor/system/bin. * Adjust init files. Change-Id: Ib0b9eb59305425b415e2681e7943f9ebfa6480d4 Signed-off-by: Alexander Diewald Signed-off-by: Arian --- rootdir/init.camera.rc | 2 +- rootdir/init.qcom.rc | 2 +- rootdir/system/bin/credmgrfirstboot.sh | 55 --------------------------- rootdir/system/etc/init.qcom-sensor.sh | 23 ----------- rootdir/system/vendor/bin/credmgrfirstboot.sh | 55 +++++++++++++++++++++++++++ rootdir/system/vendor/bin/init.qcom-sensor.sh | 23 +++++++++++ 6 files changed, 80 insertions(+), 80 deletions(-) delete mode 100755 rootdir/system/bin/credmgrfirstboot.sh delete mode 100644 rootdir/system/etc/init.qcom-sensor.sh create mode 100755 rootdir/system/vendor/bin/credmgrfirstboot.sh create mode 100644 rootdir/system/vendor/bin/init.qcom-sensor.sh (limited to 'rootdir') diff --git a/rootdir/init.camera.rc b/rootdir/init.camera.rc index 0985683..2fb08f7 100644 --- a/rootdir/init.camera.rc +++ b/rootdir/init.camera.rc @@ -94,7 +94,7 @@ service taimport /system/bin/taimport oneshot # This script init /cache/CredentialManagerData if /data/credmgr doesn't meet our requirements -service initcredmgr /system/bin/credmgrfirstboot.sh +service initcredmgr /system/vendor/bin/credmgrfirstboot.sh class late_start user root group root diff --git a/rootdir/init.qcom.rc b/rootdir/init.qcom.rc index 1bbc442..d1c90d1 100644 --- a/rootdir/init.qcom.rc +++ b/rootdir/init.qcom.rc @@ -511,7 +511,7 @@ service sensors /system/vendor/bin/sensors.qcom user root group root wakelock -service qcom-sensor-sh /system/bin/sh /system/vendor/etc/init.qcom-sensor.sh +service qcom-sensor-sh /system/vendor/bin/init.qcom-sensor.sh class main user root oneshot diff --git a/rootdir/system/bin/credmgrfirstboot.sh b/rootdir/system/bin/credmgrfirstboot.sh deleted file mode 100755 index 36e0c08..0000000 --- a/rootdir/system/bin/credmgrfirstboot.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/system/bin/sh -CREDFOLDER=/data/credmgr -LOG=/cache/credmgr.log - -# 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 - echo "CREDINIT: $MSG failed!" >> $LOG - exit $ERR - else - echo "CREDINIT: $MSG finished successfully" >> $LOG - fi -} - -# If credmgrd data doesn't match our -CREDMGRCNT=$(find $CREDFOLDER -group system -type f -name "credmgr.db" | wc -l ) - -echo -e "credmgr folder:\n$(ls -la $CREDFOLDER)\ncredmgr match (if any):" >> $LOG -find $CREDFOLDER -group system -type f -name "credmgr.db" >> $LOG - - -if [ "x$CREDMGRCNT" == "x0" ]; then - # If /data/credmgr exist remove it - echo "CREDINIT: Dont match" - if [ -d "$CREDFOLDER" ]; then - echo "CREDINIT: Drop old credmgrdata" - mv -vf $CREDFOLDER ${CREDFOLDER}.$(date +"%Y-%m-%d") >> $LOG 2>&1 - fi - # Put binary into /cache - mkdir $CREDFOLDER >> $LOG 2>&1 - F_ERR $? "mkdir $CREDFOLDER" - # Set perms on folder - chown system:system $CREDFOLDER >> $LOG 2>&1 - F_ERR $? "chown $CREDFOLDER" - chmod 770 $CREDFOLDER >> $LOG 2>&1 - F_ERR $? "chmod 770" - chcon u:object_r:credmgrd_data_file:s0 $CREDFOLDER >> $LOG 2>&1 - F_ERR $? "chcon $CREDFOLDER" - echo "CREDINIT: cp initial file" >> $LOG 2>&1 - cp -v /system/vendor/CredentialManagerData /cache/CredentialManagerData >> $LOG 2>&1 - F_ERR $? "copy CredentialManagerData" - chown system:system /cache/CredentialManagerData >> $LOG 2>&1 - F_ERR $? "chown CredentialManagerData" -else - F_ERR 0 "credmgr found already. no preparation required." -fi - -# Tell init we are ready -setprop sys.credmgrdready true -F_ERR $? "setting property" diff --git a/rootdir/system/etc/init.qcom-sensor.sh b/rootdir/system/etc/init.qcom-sensor.sh deleted file mode 100644 index 21d24c7..0000000 --- a/rootdir/system/etc/init.qcom-sensor.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/system/bin/sh -# Copyright (C) 2013 Sony Mobile Communications AB. - -# -# Function to start sensors for DSPS enabled platforms -# -start_sensors() -{ - if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then - chmod -h 775 /persist/sensors - chmod -h 664 /persist/sensors/sensors_settings - chown -h system.root /persist/sensors/sensors_settings - - mkdir -p /data/misc/sensors - chmod -h 775 /data/misc/sensors - - echo 1 > /persist/sensors/settings - start sensors - fi -} - -start_sensors - diff --git a/rootdir/system/vendor/bin/credmgrfirstboot.sh b/rootdir/system/vendor/bin/credmgrfirstboot.sh new file mode 100755 index 0000000..3b3ade9 --- /dev/null +++ b/rootdir/system/vendor/bin/credmgrfirstboot.sh @@ -0,0 +1,55 @@ +#!/system/vendor/bin/sh +CREDFOLDER=/data/credmgr +LOG=/cache/credmgr.log + +# 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 + echo "CREDINIT: $MSG failed!" >> $LOG + exit $ERR + else + echo "CREDINIT: $MSG finished successfully" >> $LOG + fi +} + +# If credmgrd data doesn't match our +CREDMGRCNT=$(find $CREDFOLDER -group system -type f -name "credmgr.db" | wc -l ) + +echo -e "credmgr folder:\n$(ls -la $CREDFOLDER)\ncredmgr match (if any):" >> $LOG +find $CREDFOLDER -group system -type f -name "credmgr.db" >> $LOG + + +if [ "x$CREDMGRCNT" == "x0" ]; then + # If /data/credmgr exist remove it + echo "CREDINIT: Dont match" + if [ -d "$CREDFOLDER" ]; then + echo "CREDINIT: Drop old credmgrdata" + mv -vf $CREDFOLDER ${CREDFOLDER}.$(date +"%Y-%m-%d") >> $LOG 2>&1 + fi + # Put binary into /cache + mkdir $CREDFOLDER >> $LOG 2>&1 + F_ERR $? "mkdir $CREDFOLDER" + # Set perms on folder + chown system:system $CREDFOLDER >> $LOG 2>&1 + F_ERR $? "chown $CREDFOLDER" + chmod 770 $CREDFOLDER >> $LOG 2>&1 + F_ERR $? "chmod 770" + chcon u:object_r:credmgrd_data_file:s0 $CREDFOLDER >> $LOG 2>&1 + F_ERR $? "chcon $CREDFOLDER" + echo "CREDINIT: cp initial file" >> $LOG 2>&1 + cp -v /system/vendor/CredentialManagerData /cache/CredentialManagerData >> $LOG 2>&1 + F_ERR $? "copy CredentialManagerData" + chown system:system /cache/CredentialManagerData >> $LOG 2>&1 + F_ERR $? "chown CredentialManagerData" +else + F_ERR 0 "credmgr found already. no preparation required." +fi + +# Tell init we are ready +setprop sys.credmgrdready true +F_ERR $? "setting property" diff --git a/rootdir/system/vendor/bin/init.qcom-sensor.sh b/rootdir/system/vendor/bin/init.qcom-sensor.sh new file mode 100644 index 0000000..f8ab53f --- /dev/null +++ b/rootdir/system/vendor/bin/init.qcom-sensor.sh @@ -0,0 +1,23 @@ +#!/system/vendor/bin/sh +# Copyright (C) 2013 Sony Mobile Communications AB. + +# +# Function to start sensors for DSPS enabled platforms +# +start_sensors() +{ + if [ -c /dev/msm_dsps -o -c /dev/sensors ]; then + chmod -h 775 /persist/sensors + chmod -h 664 /persist/sensors/sensors_settings + chown -h system.root /persist/sensors/sensors_settings + + mkdir -p /data/misc/sensors + chmod -h 775 /data/misc/sensors + + echo 1 > /persist/sensors/settings + start sensors + fi +} + +start_sensors + -- cgit v1.2.3