2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-17 21:26:22 +00:00

nanodroid-overlay: guard non-universal paths, prevent useless find error messages

This commit is contained in:
Christopher Roy Bratusek 2019-10-08 20:44:52 +02:00
parent 62661ee514
commit cfaaa2b630

View File

@ -163,20 +163,26 @@ overrides_list () {
echo " * $(basename $(dirname "${app}"))" echo " * $(basename $(dirname "${app}"))"
done done
echo "Overrides for /system/reserve:" if [ -d /system/reserve ]; then
for app in $(find "${OVERLAY_PATH}/system/reserve" -name "*.replace"); do echo "Overrides for /system/reserve:"
echo " * $(basename $(dirname "${app}"))" for app in $(find "${OVERLAY_PATH}/system/reserve" -name "*.replace"); do
done echo " * $(basename $(dirname "${app}"))"
done
fi
echo "Overrides for /system/product/app:" if [ -d /system/product/app ]; then
for app in $(find "${OVERLAY_PATH}/system/product/app" -name "*.replace"); do echo "Overrides for /system/product/app:"
echo " * $(basename $(dirname "${app}"))" for app in $(find "${OVERLAY_PATH}/system/product/app" -name "*.replace"); do
done echo " * $(basename $(dirname "${app}"))"
done
fi
echo "Overrides for /system/product/priv-app:" if [ -d /system/product/priv-app ]; then
for app in $(find "${OVERLAY_PATH}/system/product/priv-app" -name "*.replace"); do echo "Overrides for /system/product/priv-app:"
echo " * $(basename $(dirname "${app}"))" for app in $(find "${OVERLAY_PATH}/system/product/priv-app" -name "*.replace"); do
done echo " * $(basename $(dirname "${app}"))"
done
fi
else else
echo "Moved-Out apps from /system/app:" echo "Moved-Out apps from /system/app:"
for app in $(find "${SYS_BACKUP_PATH}/app" -mindepth 1 -maxdepth 1 -type d); do for app in $(find "${SYS_BACKUP_PATH}/app" -mindepth 1 -maxdepth 1 -type d); do
@ -188,20 +194,26 @@ overrides_list () {
echo " * $(basename $(dirname "${app}"))" echo " * $(basename $(dirname "${app}"))"
done done
echo "Moved-Out apps from /system/reserve:" if [ -d /system/reserve ]; then
for app in $(find "${SYS_BACKUP_PATH}/reserve" -mindepth 1 -maxdepth 1 -type d); do echo "Moved-Out apps from /system/reserve:"
echo " * $(basename $(dirname "${app}"))" for app in $(find "${SYS_BACKUP_PATH}/reserve" -mindepth 1 -maxdepth 1 -type d); do
done echo " * $(basename $(dirname "${app}"))"
done
fi
echo "Moved-Out apps from /system/product/app:" if [ -d /system/product/app ]; then
for app in $(find "${SYS_BACKUP_PATH}/product/app" -mindepth 1 -maxdepth 1 -type d); do echo "Moved-Out apps from /system/product/app:"
echo " * $(basename $(dirname "${app}"))" for app in $(find "${SYS_BACKUP_PATH}/product/app" -mindepth 1 -maxdepth 1 -type d); do
done echo " * $(basename $(dirname "${app}"))"
done
fi
echo "Moved-Out apps from /system/product/priv-app:" if [ -d /system/product/priv-app ]; then
for app in $(find "${SYS_BACKUP_PATH}/product/priv-app" -mindepth 1 -maxdepth 1 -type d); do echo "Moved-Out apps from /system/product/priv-app:"
echo " * $(basename $(dirname "${app}"))" for app in $(find "${SYS_BACKUP_PATH}/product/priv-app" -mindepth 1 -maxdepth 1 -type d); do
done echo " * $(basename $(dirname "${app}"))"
done
fi
fi fi
} }
@ -217,20 +229,26 @@ overrides_list_non () {
[[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})" [[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})"
done done
echo "non-overriden apps from /system/reserve:" if [ -d /system/reserve ]; then
for app in $(find "/system/reserve" -mindepth 1 -maxdepth 1 -type d); do echo "non-overriden apps from /system/reserve:"
[[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})" for app in $(find "/system/reserve" -mindepth 1 -maxdepth 1 -type d); do
done [[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})"
done
fi
echo "non-overriden apps from /system/product/app:" if [ -d /system/product/app ]; then
for app in $(find "/system/product/app" -mindepth 1 -maxdepth 1 -type d); do echo "non-overriden apps from /system/product/app:"
[[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})" for app in $(find "/system/product/app" -mindepth 1 -maxdepth 1 -type d); do
done [[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})"
done
fi
echo "non-overriden apps from /system/product/priv-app:" if [ -d /system/product/priv-app ]; then
for app in $(find "/system/product/priv-app" -mindepth 1 -maxdepth 1 -type d); do echo "non-overriden apps from /system/product/priv-app:"
[[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})" for app in $(find "/system/product/priv-app" -mindepth 1 -maxdepth 1 -type d); do
done [[ ! -d ${OVERLAY_PATH}/${app} ]] && echo " * $(basename ${app})"
done
fi
else else
echo "non-moved-out apps from /system/app:" echo "non-moved-out apps from /system/app:"
for app in $(find "/system/app" -mindepth 1 -maxdepth 1 -type d); do for app in $(find "/system/app" -mindepth 1 -maxdepth 1 -type d); do
@ -242,21 +260,26 @@ overrides_list_non () {
echo " * $(basename ${app})" echo " * $(basename ${app})"
done done
echo "non-moved-out apps from /system/reserve:" if [ -d /system/reserve ]; then
for app in $(find "/system/reserve" -mindepth 1 -maxdepth 1 -type d); do echo "non-moved-out apps from /system/reserve:"
echo " * $(basename ${app})" for app in $(find "/system/reserve" -mindepth 1 -maxdepth 1 -type d); do
done echo " * $(basename ${app})"
done
fi
echo "non-moved-out apps from /system/product/app:" if [ -d /system/product/app ]; then
for app in $(find "/system/product/app" -mindepth 1 -maxdepth 1 -type d); do echo "non-moved-out apps from /system/product/app:"
echo " * $(basename ${app})" for app in $(find "/system/product/app" -mindepth 1 -maxdepth 1 -type d); do
done echo " * $(basename ${app})"
done
echo "non-moved-out apps from /system/product/priv-app:" fi
for app in $(find "/system/product/priv-app" -mindepth 1 -maxdepth 1 -type d); do
echo " * $(basename ${app})"
done
if [ -d /system/product/priv-app ]; then
echo "non-moved-out apps from /system/product/priv-app:"
for app in $(find "/system/product/priv-app" -mindepth 1 -maxdepth 1 -type d); do
echo " * $(basename ${app})"
done
fi
fi fi
} }
@ -264,11 +287,11 @@ overrides_list_non () {
overrides_clear () { overrides_clear () {
if [[ ${NO_MAGISK} -eq 0 ]]; then if [[ ${NO_MAGISK} -eq 0 ]]; then
echo " removing Overlays from ${OVERLAY_PATH}" echo " removing Overlays from ${OVERLAY_PATH}"
for app in $(find "${OVERLAY_PATH}/system/app" -name "*.replace") \ for app in $(find "${OVERLAY_PATH}/system/app" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/priv-app" -name "*.replace") \ $(find "${OVERLAY_PATH}/system/priv-app" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/reserve" -name "*.replace") \ $(find "${OVERLAY_PATH}/system/reserve" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/product/app" -name "*.replace") \ $(find "${OVERLAY_PATH}/system/product/app" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/product/priv-app" -name "*.replace") ; do $(find "${OVERLAY_PATH}/system/product/priv-app" -name "*.replace" 2>/dev/null) ; do
echo " removing override: $(basename $(dirname ${app}))" echo " removing override: $(basename $(dirname ${app}))"
rm -rf "$(dirname "${app}")" rm -rf "$(dirname "${app}")"
done done
@ -283,11 +306,11 @@ overrides_genconfig () {
export config="/data/.nanodroid-overlay" export config="/data/.nanodroid-overlay"
touch ${config} touch ${config}
for app in $(find "${OVERLAY_PATH}/system/app" -name "*.replace") \ for app in $(find "${OVERLAY_PATH}/system/app" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/priv-app" -name "*.replace") \ $(find "${OVERLAY_PATH}/system/priv-app" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/reserve" -name "*.replace") \ $(find "${OVERLAY_PATH}/system/reserve" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/product/app" -name "*.replace") \ $(find "${OVERLAY_PATH}/system/product/app" -name "*.replace" 2>/dev/null) \
$(find "${OVERLAY_PATH}/system/product/priv-app" -name "*.replace"); do $(find "${OVERLAY_PATH}/system/product/priv-app" -name "*.replace" 2>/dev/null); do
xapp=$(basename $(dirname ${app})) xapp=$(basename $(dirname ${app}))
echo " adding ${xapp} to configuration" echo " adding ${xapp} to configuration"
grep -q "^${xapp}$" "${config}" 2>/dev/null || echo "${xapp}" >> "${config}" grep -q "^${xapp}$" "${config}" 2>/dev/null || echo "${xapp}" >> "${config}"