Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
689c236d
Commit
689c236d
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Function to count the number of wlans
parent
3ab26870
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-utils-wifi
+93
-81
93 additions, 81 deletions
src/freedombone-utils-wifi
with
93 additions
and
81 deletions
src/freedombone-utils-wifi
+
93
−
81
View file @
689c236d
...
...
@@ -39,95 +39,107 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
# repo for atheros AR9271 wifi driver
ATHEROS_WIFI_REPO
=
"https://github.com/qca/open-ath9k-htc-firmware.git"
function
count_wlan
{
# counts the number of wlan devices
ctr
=
0
for
i
in
$(
seq
0 10
)
;
do
if
grep
-q
"wlan
${
i
}
"
/proc/net/dev
;
then
ctr
=
$((
ctr
+
1
))
fi
done
echo
$ctr
}
function
setup_wifi
{
if
[[
$SYSTEM_TYPE
==
"
$VARIANT_MESH
"
]]
;
then
return
fi
if
[
!
$WIFI_SSID
]
;
then
return
fi
if
[
${#
WIFI_SSID
}
-lt
2
]
;
then
return
fi
if
grep
-Fxq
"setup_wifi"
$COMPLETION_FILE
;
then
return
fi
if
[[
$SYSTEM_TYPE
==
"
$VARIANT_MESH
"
]]
;
then
return
fi
if
[
!
$WIFI_SSID
]
;
then
return
fi
if
[
${#
WIFI_SSID
}
-lt
2
]
;
then
return
fi
if
grep
-Fxq
"setup_wifi"
$COMPLETION_FILE
;
then
return
fi
HOTSPOT
=
'no'
if
[[
$WIFI_HOTSPOT
!=
'no'
]]
;
then
HOTSPOT
=
'yes'
fi
HOTSPOT
=
'no'
if
[[
$WIFI_HOTSPOT
!=
'no'
]]
;
then
HOTSPOT
=
'yes'
fi
if
[
-f
$WIFI_NETWORKS_FILE
]
;
then
${
PROJECT_NAME
}
-wifi
-i
$WIFI_INTERFACE
--networks
$WIFI_NETWORKS_FILE
echo
'setup_wifi'
>>
$COMPLETION_FILE
return
fi
if
[
-f
$WIFI_NETWORKS_FILE
]
;
then
${
PROJECT_NAME
}
-wifi
-i
$WIFI_INTERFACE
--networks
$WIFI_NETWORKS_FILE
echo
'setup_wifi'
>>
$COMPLETION_FILE
return
fi
if
[[
$WIFI_TYPE
!=
'none'
]]
;
then
if
[
!
$WIFI_PASSPHRASE
]
;
then
echo
$'No wifi passphrase was given'
return
fi
if
[
${#
WIFI_PASSPHRASE
}
-lt
2
]
;
then
echo
$'Wifi passphrase was too short'
return
fi
${
PROJECT_NAME
}
-wifi
-i
$WIFI_INTERFACE
-s
$WIFI_SSID
-t
$WIFI_TYPE
-p
$WIFI_PASSPHRASE
--hotspot
$HOTSPOT
--networks
$WIFI_NETWORKS_FILE
else
${
PROJECT_NAME
}
-wifi
-i
$WIFI_INTERFACE
-s
$WIFI_SSID
-t
$WIFI_TYPE
--hotspot
$HOTSPOT
--networks
$WIFI_NETWORKS_FILE
fi
echo
'setup_wifi'
>>
$COMPLETION_FILE
if
[[
$WIFI_TYPE
!=
'none'
]]
;
then
if
[
!
$WIFI_PASSPHRASE
]
;
then
echo
$'No wifi passphrase was given'
return
fi
if
[
${#
WIFI_PASSPHRASE
}
-lt
2
]
;
then
echo
$'Wifi passphrase was too short'
return
fi
${
PROJECT_NAME
}
-wifi
-i
$WIFI_INTERFACE
-s
$WIFI_SSID
-t
$WIFI_TYPE
-p
$WIFI_PASSPHRASE
--hotspot
$HOTSPOT
--networks
$WIFI_NETWORKS_FILE
else
${
PROJECT_NAME
}
-wifi
-i
$WIFI_INTERFACE
-s
$WIFI_SSID
-t
$WIFI_TYPE
--hotspot
$HOTSPOT
--networks
$WIFI_NETWORKS_FILE
fi
echo
'setup_wifi'
>>
$COMPLETION_FILE
}
# ath9k_htc driver
function
install_atheros_wifi
{
if
grep
-Fxq
"install_atheros_wifi"
$COMPLETION_FILE
;
then
return
fi
if
[
$INSTALLING_ON_BBB
!=
"yes"
]
;
then
return
fi
if
[[
$ENABLE_BABEL
!=
"yes"
&&
$ENABLE_BATMAN
!=
"yes"
&&
$ENABLE_CJDNS
!=
"yes"
]]
;
then
return
fi
if
[
-d
$INSTALL_DIR
/open-ath9k-htc-firmware
]
;
then
return
fi
# have drivers already been installed ?
if
[
-f
/lib/firmware/htc_9271.fw
]
;
then
return
fi
apt-get
-y
install
build-essential cmake git m4 texinfo
if
[
!
-d
$INSTALL_DIR
]
;
then
mkdir
-p
$INSTALL_DIR
fi
cd
$INSTALL_DIR
if
[
!
-d
$INSTALL_DIR
/open-ath9k-htc-firmware
]
;
then
function_check git_clone
git_clone
$ATHEROS_WIFI_REPO
$INSTALL_DIR
/open-ath9k-htc-firmware
if
[
!
"
$?
"
=
"0"
]
;
then
rm
-rf
$INSTALL_DIR
/open-ath9k-htc-firmware
exit
74283
fi
fi
cd
$INSTALL_DIR
/open-ath9k-htc-firmware
git checkout 1.4.0
make toolchain
if
[
!
"
$?
"
=
"0"
]
;
then
rm
-rf
$INSTALL_DIR
/open-ath9k-htc-firmware
exit
24820
fi
make firmware
if
[
!
"
$?
"
=
"0"
]
;
then
rm
-rf
$INSTALL_DIR
/open-ath9k-htc-firmware
exit
63412
fi
cp
target_firmware/
*
.fw /lib/firmware/
if
[
!
"
$?
"
=
"0"
]
;
then
exit
74681
fi
echo
'install_atheros_wifi'
>>
$COMPLETION_FILE
if
grep
-Fxq
"install_atheros_wifi"
$COMPLETION_FILE
;
then
return
fi
if
[
$INSTALLING_ON_BBB
!=
"yes"
]
;
then
return
fi
if
[[
$ENABLE_BABEL
!=
"yes"
&&
$ENABLE_BATMAN
!=
"yes"
&&
$ENABLE_CJDNS
!=
"yes"
]]
;
then
return
fi
if
[
-d
$INSTALL_DIR
/open-ath9k-htc-firmware
]
;
then
return
fi
# have drivers already been installed ?
if
[
-f
/lib/firmware/htc_9271.fw
]
;
then
return
fi
apt-get
-y
install
build-essential cmake git m4 texinfo
if
[
!
-d
$INSTALL_DIR
]
;
then
mkdir
-p
$INSTALL_DIR
fi
cd
$INSTALL_DIR
if
[
!
-d
$INSTALL_DIR
/open-ath9k-htc-firmware
]
;
then
function_check git_clone
git_clone
$ATHEROS_WIFI_REPO
$INSTALL_DIR
/open-ath9k-htc-firmware
if
[
!
"
$?
"
=
"0"
]
;
then
rm
-rf
$INSTALL_DIR
/open-ath9k-htc-firmware
exit
74283
fi
fi
cd
$INSTALL_DIR
/open-ath9k-htc-firmware
git checkout 1.4.0
make toolchain
if
[
!
"
$?
"
=
"0"
]
;
then
rm
-rf
$INSTALL_DIR
/open-ath9k-htc-firmware
exit
24820
fi
make firmware
if
[
!
"
$?
"
=
"0"
]
;
then
rm
-rf
$INSTALL_DIR
/open-ath9k-htc-firmware
exit
63412
fi
cp
target_firmware/
*
.fw /lib/firmware/
if
[
!
"
$?
"
=
"0"
]
;
then
exit
74681
fi
echo
'install_atheros_wifi'
>>
$COMPLETION_FILE
}
# NOTE: deliberately no exit 0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment