commit 566a45b29a6753997236039fd4294d8be9896d94
parent 6ebd8a319c69b52850c42f5558844d890bbc38cb
Author: Claudio Alessi <smoppy@gmail.com>
Date: Sun, 21 Jan 2018 17:11:53 +0100
[iwpick] Switch to dhclient.
Diffstat:
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/droid b/src/droid
@@ -12,10 +12,9 @@ GRADLE_URL=https://services.gradle.org/distributions/gradle-2.3-bin.zip
[ ! -f "local.properties" ] && export ANDROID_HOME="$SDKDIR"
_adb() {
- pids="$(pgrep -f adb)"
+ pids="$(pgrep -f ^adb)"
if [ ${#pids} -eq 0 ]; then
- echo "You need to start ADB first. Run $ADB start-server as root."
- exit 1
+ echo "WARNING: ADB server is not running, start it with: sudo droid adb start-server."
fi
apk="./build/outputs/apk/$(basename $(pwd))-debug.apk"
$ADB "$@" "$apk"
@@ -80,12 +79,16 @@ do_deploy() {
}
do_init() {
+ # droid-init/src/main/java/org/learn/Main.java
+ # droid-init/src/main/res/layout/hello_layout.xml
+ # droid-init/src/main/res/values/strings.xml
+ # droid-init/src/main/AndroidManifest.xml
+ # droid-init/build.gradle
echo 'To be implemented.'
}
usage() {
echo "Usage: $(basename "$0") <cmd>"
-
echo "
Commands:
setup\t: creates the development environment
@@ -98,13 +101,12 @@ Commands:
clean\t: removes the builds from the current directory
help\t\t: print this help
"
-
exit 1
}
main() {
- cmd=$1
- case $cmd in
+ case $1 in
+ adb) shift; _adb $@;;
setup) do_setup;;
install) do_install;;
uninstall) do_uninstall;;
diff --git a/src/iwpick b/src/iwpick
@@ -1,6 +1,6 @@
#!/bin/bash
# Connects to a network
-# Requires: wpa_supplicant, sdhcp, iwconfig suite
+# Requires: wpa_supplicant, dhclient and the iwconfig suite
NETWORKS_FILE=~/.networks
@@ -16,7 +16,7 @@ connect() {
wpa_supplicant -i $iface -c "$tmp" -B 2>&1 > /dev/null
rm $tmp
fi
- sdhcp -d $iface >/dev/null &
+ dhclient $iface >/dev/null &
while [ -z "$gw" ]; do
pkt="$(tcpdump -vlni $iface -c 1 -Q in udp 2>&1)"
addr="$(echo "$pkt" |grep "Your-IP" |tr -d [:space:] |cut -b8-)"
@@ -84,7 +84,7 @@ main() {
done
[ "$(id -u)" -ne 0 ] && die "You must be root"
- ifconfig $iface up
+ ifconfig $iface up 0.0.0.0
if [ $pick -eq 1 ]; then
echo "Looking for a suitable network... "
essid="$(pickone "$iface" "$file")"
@@ -105,7 +105,7 @@ main() {
# If explicitly specified, check if the ESSID do exists
valid="$(iwlist $iface scan |grep ESSID |grep -wc "$essid")"
[ $valid -eq 0 ] && die "$essid: no network found"
- apps=(wpa_supplicant sdhcp)
+ apps=(wpa_supplicant dhclient)
for a in ${apps[@]}
do
pkill -f "$a"