cmd: Failure calling service settings: Failed transaction (2147483646)
cmd: Failure calling service activity: Failed transaction (2147483646)
必须修改SElinux状态
This commit is contained in:
aixiao 2019-05-04 18:23:06 +08:00
parent 8d4dd18f65
commit 2a284682c2
2 changed files with 51 additions and 30 deletions

View File

@ -6,10 +6,10 @@ inss="/data/local/inss";
ip_addr_array1=(10); # 10 ip_addr_array1=(10); # 10
#填写自己需要的内网IP.IP第二个字节值.SHELL数组. #填写自己需要的内网IP.IP第二个字节值.SHELL数组.
ip_addr_array2=(99); # 4 43 31 ip_addr_array2=(70); # 4 43 31 99 70
#填写自己的网卡. #填写自己的网卡.
NIC="rmnet_data1"; NIC="rmnet_data0";
#网卡开启状态. #网卡开启状态.
NIC_STATUS="U"; NIC_STATUS="U";

67
inss.sh
View File

@ -1,14 +1,8 @@
#!/system/bin/sh #!/system/bin/sh
parameter="${@}";
#开启飞行模式(关闭网络)
STOP="settings put global airplane_mode_on 1 &> /dev/null; am broadcast -a android.intent.action.AIRPLANE_MODE &> /dev/null; svc data disable";
#关闭飞行模式(开启网络)
START="settings put global airplane_mode_on 0 &> /dev/null; am broadcast -a android.intent.action.AIRPLANE_MODE &> /dev/null; svc data enable";
function INIT_() { function INIT_() {
ARGV="$@";
null="/dev/null"; null="/dev/null";
bbox="/system/xbin/busybox"; bbox="/system/xbin/busybox";
inss="/data/local/inss"; inss="/data/local/inss";
@ -17,10 +11,11 @@ function INIT_() {
ip_addr_array1=(10); # 10 ip_addr_array1=(10); # 10
#填写自己需要的内网IP.IP第二个字节值.SHELL数组. #填写自己需要的内网IP.IP第二个字节值.SHELL数组.
ip_addr_array2=(99); # 4 43 31 ip_addr_array2=(70); # 4 43 31 70
#填写自己的网卡. #填写自己的网卡.
NIC="rmnet_data0"; NIC="rmnet_data1";
#网卡开启状态. #网卡开启状态.
NIC_STATUS="U"; NIC_STATUS="U";
@ -28,28 +23,35 @@ function INIT_() {
#等待7秒. #等待7秒.
SLEEP="7"; SLEEP="7";
if ! ${bbox} &> /dev/null; then echo "BusyBox No Found !"; exit 1; fi if ! ${bbox} &> /dev/null; then echo "BusyBox No Found !"; exit 1; fi
svc_="$(${bbox} which svc)"; svc_="$(${bbox} which svc)";
settings_="$(${bbox} which settings)"; settings_="$(${bbox} which settings)";
am_="$(${bbox} which am)"; am_="$(${bbox} which am)";
netcfg_="$(${bbox} which netcfg)"; netcfg_="$(${bbox} which netcfg)";
setenforce_="$(${bbox} which setenforce)";
#判断必须要命令.否则退出子壳返回错误代码1. #判断必须要命令.否则退出子壳返回错误代码1.
if ${bbox} [[ "${svc_}" = "" ]]; then echo "Svc No Found !"; exit 1; fi if ${bbox} [[ "${svc_}" = "" ]]; then echo "Svc Command No Found !"; exit 1; fi
if ${bbox} [[ "${settings_}" = "" ]]; then echo "Settings No Found !"; exit 1; fi if ${bbox} [[ "${settings_}" = "" ]]; then echo "Settings Command No Found !"; exit 1; fi
if ${bbox} [[ "${am_}" = "" ]]; then echo "Am No Found !"; exit 1; fi if ${bbox} [[ "${am_}" = "" ]]; then echo "Am Command No Found !"; exit 1; fi
if ${bbox} [[ "${setenforce_}" = "" ]]; then echo "Setenforce Command No Found !"; exit 1; fi
if ${bbox} [[ "${parameter}" != "" ]]; then
: 判断参数是不是全为数字 #开启飞行模式(关闭网络)
num=`${bbox} echo ${parameter} | ${bbox} sed 's/[0-9]//g'`; STOP="settings put global airplane_mode_on 1 &> /dev/null; am broadcast -a android.intent.action.AIRPLANE_MODE &> /dev/null; ${svc_} data disable";
# ${bbox} echo ${parameter} | grep [0-9] > /dev/null 2>&1 && ip_addr_array2=(${parameter}); #关闭飞行模式(开启网络)
if ${bbox} [[ ${num} = "" ]]; then START="settings put global airplane_mode_on 0 &> /dev/null; am broadcast -a android.intent.action.AIRPLANE_MODE &> /dev/null; ${svc_} data enable";
ip_addr_array2=(${parameter});
fi
if ${bbox} test -n "${ARGV}"; then
ip_addr_array2=(${ARGV});
fi fi
#设置SElinux状态
setenforce 0
}
function HELP_() { function HELP_() {
#帮助 #帮助
${bbox} cat << EOF ${bbox} cat << EOF
@ -63,11 +65,22 @@ options:
[FILE] (default: ${inss}/conf/inss.ini). [FILE] (default: ${inss}/conf/inss.ini).
-h : print help. -h : print help.
inss by aixiao@aixiao.me. inss by aixiao@aixiao.me
EOF EOF
exit 0; exit 0;
} }
# 判断参数是不是全部参数
function parameter_() {
for n in ${@}; do
if ${bbox} test -n "$(echo $n | ${bbox} sed -n "/^[0-9]\+$/p")"; then
:
else
echo $n 'Not a number.'
exit 1;
fi
done
} }
function ROOT_(){ function ROOT_(){
@ -153,7 +166,7 @@ function MAIN_ {
done done
} }
INIT_ INIT_ ${@};
while getopts :xc:h? l; do while getopts :xc:h? l; do
case ${l} in case ${l} in
x) x)
@ -171,6 +184,7 @@ esac
done done
shift $((OPTIND-1)); shift $((OPTIND-1));
test "${debug}" = "x" && set -x; test "${debug}" = "x" && set -x;
parameter_ ${@};
ROOT_; # 判断ROOT用户执行. ROOT_; # 判断ROOT用户执行.
one_ ; # 调用自定义函数one_, 打印IP的第一个字节值. one_ ; # 调用自定义函数one_, 打印IP的第一个字节值.
two_; # 调用自定义函数two_, 打印IP的第二个字节值. two_; # 调用自定义函数two_, 打印IP的第二个字节值.
@ -179,4 +193,11 @@ INSTATUS_ 2> ${null}; # 调用自定
MAIN_; MAIN_;
exit $?; exit $?;
201812262344 201812262344
aixiao@aixiao.me 201904011601
201905041759
错误:
cmd: Failure calling service settings: Failed transaction (2147483646)
cmd: Failure calling service activity: Failed transaction (2147483646)
必须修改SElinux状态
by aixiao@aixiao.me