2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-09 19:10:30 +00:00
NanoDroid/Full/system/xbin/nanodroid-prop

76 lines
1.4 KiB
Plaintext
Raw Normal View History

2018-03-15 19:48:49 +00:00
#!/system/bin/sh
2018-03-15 19:50:48 +00:00
export NO_MAGISK=0
export MODPATH=@MODPATH@
[ -z "${MODPATH}" ] && NO_MAGISK=1
2018-03-15 19:50:48 +00:00
2018-03-15 19:48:49 +00:00
add_prop () {
[[ ! -f ${MODPATH}/system.prop ]] && \
touch ${MODPATH}/system.prop
resetprop ${1} ${2}
sed "/^${1}/d" -i ${MODPATH}/system.prop
echo "${1}=${2}" >> "${MODPATH}/system.prop"
}
remove_prop () {
[[ -f ${MODPATH}/system.prop ]] && \
sed "/^${1}/d" -i ${MODPATH}/system.prop
}
list_props () {
if [[ ! -f ${MODPATH}/system.prop ]]; then
echo "no properties added by NanoDroid"
else echo "properties added by NanoDroid:"
2018-04-20 18:09:20 +00:00
cat ${MODPATH}/system.prop
2018-03-15 19:48:49 +00:00
fi
}
error () {
echo "!! ${@}"
exit 1
}
[[ $(whoami) != "root" ]] && error "not running as root"
2018-03-15 19:50:48 +00:00
if [[ ${NO_MAGISK} -eq 0 ]]; then
2018-03-15 19:48:49 +00:00
case ${1} in
-C | --cast )
add_prop persist.debug.wfd.enable 1
;;
-A | --add-prop )
if [ ! -z ${2} -a ! -z ${3} ]; then
add_prop "${2}" "${3}"
fi
;;
-R | --remove-prop )
if [ ! -z ${2} ]; then
remove_prop "${2}"
fi
;;
-L | --list-props )
list_props
;;
* )
echo "nanodroid-prop
Utilize Magisk's resetprop (props survive NanoDroid update)
-C | --cast enable cast [fix for a few custom ROMS]
-A | --add-prop [prop] [value] add system property set by NanoDroid
-R | --remove-prop [prop] remove system property set by NanoDroid
-L | --list-prop list system properties set by NanoDroid"
;;
esac
2018-03-15 19:50:48 +00:00
else
error "*** Resetprop feature is not available in System Mode! ***"
fi