Signed-off-by: Denis 'GNUtoo' Carikli <gnu...@cyberdimension.org> --- networking/modem/device-files/modem.sh | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
diff --git a/networking/modem/device-files/modem.sh b/networking/modem/device-files/modem.sh index 626593b..b27aadd 100755 --- a/networking/modem/device-files/modem.sh +++ b/networking/modem/device-files/modem.sh @@ -34,10 +34,50 @@ usage() exit 1 } +check_permissions() +{ + modem_command="$1" + root_access="$(getprop persist.sys.root_access)" + uid="$(id -u)" + + # 0: Root access: Disabled, 2: Root access: ADB only + # For both the terminal application and ADB we have something + # like that: + # shell@i9100:/ $ su + # 255|shell@i9100:/ $ + # 1: Root access: Apps only + # From ADB: + # shell@i9100:/ $ su + # Permission denied + # 1|shell@i9100:/ $ + # From the terminal application + # u0_a51@i9100:/ $ su + # root@i9100:/ # + if [ "${uid}" != "0" ] ; then + echo "" + echo "This script requires root." + echo "To give it root:" + case "${root_access}" in + "0"|"1"|"2") + echo "- Go in Settings" + echo "- Go in Developer options" + echo "- Select Root access" + echo "- Set it to \"Apps and ADB\"" + ;; + esac + echo "- Run these 2 commands:" + echo " su" + echo " modem.sh ${modem_command}" + exit 1 + fi +} + modem() { command="$1" + check_permissions "${command}" + echo "Remounting system partition as writable..." mount -o rw,remount /system -- 2.27.0 _______________________________________________ Replicant mailing list Replicant@osuosl.org https://lists.osuosl.org/mailman/listinfo/replicant