summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-03-01 02:10:48 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-03-01 02:10:48 +0100
commitf4f1bb259ec37c05ccaefd80126508ba26a0e666 (patch)
tree72896dc560ed5427942adda30b46174ea34ea6b6
parentccb6e97d1742f0627d016ab329ce1cdfb5e3fc4b (diff)
downloaduser-scripts-f4f1bb259ec37c05ccaefd80126508ba26a0e666.tar.gz
user-scripts-f4f1bb259ec37c05ccaefd80126508ba26a0e666.tar.bz2
user-scripts-f4f1bb259ec37c05ccaefd80126508ba26a0e666.zip
wifi: be more sensitive about permissions and remove unneeded stuff
The wifi directory should be kept in place with its default ownership and permissions. Unfortunately, this reverts Timothy's fix for the issue where files were not pushed correctly to the device. Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rw-r--r--networking/wifi/device-files/check_modules.sh127
-rw-r--r--networking/wifi/device-files/networks/add_network.sh2
-rw-r--r--networking/wifi/device-files/rstr.sh51
-rw-r--r--networking/wifi/device-files/setup_variables.sh9
-rw-r--r--networking/wifi/device-files/write_config.sh2
-rwxr-xr-x[-rw-r--r--]networking/wifi/setup.sh4
6 files changed, 3 insertions, 192 deletions
diff --git a/networking/wifi/device-files/check_modules.sh b/networking/wifi/device-files/check_modules.sh
deleted file mode 100644
index 302e6d0..0000000
--- a/networking/wifi/device-files/check_modules.sh
+++ /dev/null
@@ -1,127 +0,0 @@
-#
-# THIS IS FREE SOFTWARE
-#
-# Copyright (C) 2016, 2017 Filippo Fil Bergamo
-#
-# This file is part of "RepWifi", a set of shell scripts to ease libre wifi connectivity.
-#
-# RepWifi is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# RepWifi is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# setup environment variables:
-source "/data/misc/wifi/setup_variables.sh"
-if [ $? -ne 0 ]; then
- exit 1
-fi
-
-globresult=0
-
-# check, for every module, if it is running,
-# if not, insmod it.
-
-
-# ---- mac80211 ----
-mod=$(ls /sys/module | grep -c -Fx "mac80211")
-if [ "$mod" = "0" ]; then
- echo -n -e "\tloading module mac80211.ko ..."
- insmod $mod_mac80211
- if [ $? = 0 ]; then
- echo " [ OK! ]"
- else
- globresult=1
- echo " [* FAIL! *]"
- fi
-else
- echo -e "\tmac80211.ko already loaded [ OK! ]"
-fi
-
-
-
-# ---- ath.ko ----
-mod=$(ls /sys/module | grep -c -Fx "ath")
-if [ "$mod" = "0" ]; then
- echo -n -e "\tloading module ath.ko ..."
- insmod "$mod_ath"
- if [ $? = 0 ]; then
- echo " [ OK! ]"
- else
- globresult=-1
- echo " [* FAIL! *]"
- fi
-else
- echo -e "\tath.ko already loaded [ OK! ]"
-fi
-
-
-
-# ---- ath9k_hw ----
-mod=$(ls /sys/module | grep -c -Fx "ath9k_hw")
-if [ "$mod" = "0" ]; then
- echo -n -e "\tloading module ath9k_hw.ko ..."
- insmod "$mod_ath9k_hw"
- if [ $? = 0 ]; then
- echo " [ OK! ]"
- else
- globresult=1
- echo " [* FAIL! *]"
- fi
-else
- echo -e "\tath9k_hw.ko already loaded [ OK! ]"
-fi
-
-
-
-# ---- ath9k_common ----
-mod=$(ls /sys/module | grep -c -Fx "ath9k_common")
-if [ "$mod" = "0" ]; then
- echo -n -e "\tloading module ath9k_common.ko ..."
- insmod "$mod_ath9k_common"
- if [ $? = 0 ]; then
- echo " [ OK! ]"
- else
- globresult=1
- echo " [* FAIL! *]"
- fi
-else
- echo -e "\tath9k_common.ko already loaded [ OK! ]"
-fi
-
-
-
-# ---- ath0k_htc ----
-mod=$(ls /sys/module | grep -c -Fx "ath9k_htc")
-if [ "$mod" = "0" ]; then
- echo -n -e "\tloading module ath9k_htc.ko ..."
- insmod "$mod_ath9k_htc"
- if [ $? = 0 ]; then
- echo " [ OK! ]"
- else
- globresult=1
- echo " [* FAIL! *]"
- fi
-else
- echo -e "\tath9k_htc.ko already loaded [ OK! ]"
-fi
-
-
-
-# check for global result:
-if [ "$globresult" -lt 0 ]; then
- echo "ERRORS loading one or more modules.."
- echo "Try re-running the script.."
- exit $globresult
-else
- echo "All modules loaded!"
-fi
-
-
diff --git a/networking/wifi/device-files/networks/add_network.sh b/networking/wifi/device-files/networks/add_network.sh
index 04c93da..2196e6a 100644
--- a/networking/wifi/device-files/networks/add_network.sh
+++ b/networking/wifi/device-files/networks/add_network.sh
@@ -52,7 +52,7 @@ if ! [ -e "$knets_file" ]; then
echo -n "" > "$knets_file"
fi
-if [$NO_PASSWORD -eq 1]; then
+if [ $NO_PASSWORD -eq 1 ]; then
echo -e "$curnet" >> $knets_file
else
echo -e "$curnet""\t""$pass" >> $knets_file
diff --git a/networking/wifi/device-files/rstr.sh b/networking/wifi/device-files/rstr.sh
deleted file mode 100644
index e7050f2..0000000
--- a/networking/wifi/device-files/rstr.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (C) 2016, 2017 Filippo Fil Bergamo
-#
-# This file is part of "RepWifi", a set of shell scripts to ease libre wifi connectivity.
-#
-# RepWifi is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# RepWifi is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# setup environment variables:
-source "/data/misc/wifi/setup_variables.sh"
-if [ $? -ne 0 ]; then
- exit
-fi
-
-echo "Beginning a best-effort attempt to setup/restore Libre WiFi connectivity:"
-
-idx=1
-
-echo -n $idx") chmod -R 777 $workdir... "
-chmod -R 777 $workdir
-if [ $? = 0 ]; then
- echo " [ OK! ]"
-else
- echo " [* FAIL! *]"
-fi
-
-if [ -e "$wpaconfile" ]; then
-
- idx=$(($idx+1))
- echo -n $idx") chmod 777 "$wpaconfile"... "
- chmod 777 "$wpaconfile"
- if [ $? = 0 ]; then
- echo " [ OK! ]"
- else
- echo " [* FAIL! *]"
- fi
-fi
-
-idx=$(($idx+1))
-echo $idx") Check and load needed modules:"
-source "$scriptChkMod"
-
diff --git a/networking/wifi/device-files/setup_variables.sh b/networking/wifi/device-files/setup_variables.sh
index 0f94532..7d05618 100644
--- a/networking/wifi/device-files/setup_variables.sh
+++ b/networking/wifi/device-files/setup_variables.sh
@@ -30,20 +30,11 @@ export pidfile="$workdir""/pidfile"
export wpaconfile="$workdir""/wpa_supplicant.conf"
# script paths
-export scriptChkMod="$workdir""/check_modules.sh"
export scriptWriteConf="$workdir""/write_config.sh"
export scriptStartWPA="$workdir""/startwpa.sh"
export scriptConnect="$workdir""/connect.sh"
export scriptDiscon="$workdir""/disconnect.sh"
-# kernel modules
-export modulesPath="/system/lib/modules"
-export mod_mac80211="$modulesPath""/mac80211.ko"
-export mod_ath="$modulesPath""/ath.ko"
-export mod_ath9k_hw="$modulesPath""/ath9k_hw.ko"
-export mod_ath9k_common="$modulesPath""/ath9k_common.ko"
-export mod_ath9k_htc="$modulesPath""/ath9k_htc.ko"
-
# known networks database
export knets_dir="networks"
export knets_file="$workdir""/""$knets_dir""/known-networks"
diff --git a/networking/wifi/device-files/write_config.sh b/networking/wifi/device-files/write_config.sh
index 8c07eb1..b1a6084 100644
--- a/networking/wifi/device-files/write_config.sh
+++ b/networking/wifi/device-files/write_config.sh
@@ -40,7 +40,7 @@ network={
\tpsk=\"$pass\"
}" > $wpaconfile
-chmod 777 "$wpaconfile"
+chmod 660 "$wpaconfile"
echo "Network connection has been set up for "$ssid"!"
diff --git a/networking/wifi/setup.sh b/networking/wifi/setup.sh
index ec6edaf..bbc52f9 100644..100755
--- a/networking/wifi/setup.sh
+++ b/networking/wifi/setup.sh
@@ -1,7 +1,5 @@
root_dir="/data/misc/wifi"
adb root
sleep 3
-adb shell rm -r "$root_dir"
-adb shell mkdir "$root_dir"
-adb push ./device-files/* "$root_dir"
+adb push ./device-files/ "$root_dir"
adb push ./device-files/networks "$root_dir""/networks"