repo.or.cz
/
dumbwifi.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add freq
[dumbwifi.git]
/
system.py
blob
0c2c99c7fd8e316c6800cb7cc8fa94d3e4854171
1
import
os
2
3
4
# OS
5
6
def
getfile
(
path
):
7
try
:
8
f
=
open
(
path
)
9
lines
=
f
.
read
()
10
f
.
close
()
11
return
lines
12
except
IOError
:
return
""
13
14
def
as_root
():
15
if
os
.
getuid
() ==
0
:
return True
16
17
def
os_which
(
binary
):
18
for
p
in
os
.
environ
.
get
(
"PATH"
,
""
).
split
(
":"
):
19
path
=
"
%s
/
%s
"
% (
p
,
binary
)
20
if
os
.
path
.
isfile
(
path
):
return
path
21
return
binary
22