Lines 224-264
Link Here
|
224 |
os.unlink(os.path.join('staging', 'ufw-init')) |
224 |
os.unlink(os.path.join('staging', 'ufw-init')) |
225 |
os.unlink(os.path.join('staging', 'ufw-init-functions')) |
225 |
os.unlink(os.path.join('staging', 'ufw-init-functions')) |
226 |
|
226 |
|
227 |
iptables_exe = '' |
227 |
iptables_dir = '/sbin' |
228 |
iptables_dir = '' |
|
|
229 |
|
230 |
for e in ['iptables']: |
231 |
for dir in ['/sbin', '/bin', '/usr/sbin', '/usr/bin', '/usr/local/sbin', \ |
232 |
'/usr/local/bin']: |
233 |
if e == "iptables": |
234 |
if os.path.exists(os.path.join(dir, e)): |
235 |
iptables_dir = dir |
236 |
iptables_exe = os.path.join(iptables_dir, "iptables") |
237 |
print "Found '%s'" % iptables_exe |
238 |
else: |
239 |
continue |
240 |
|
241 |
if iptables_exe != "": |
242 |
break |
243 |
|
244 |
|
245 |
if iptables_exe == '': |
246 |
print >> sys.stderr, "ERROR: could not find required binary 'iptables'" |
247 |
sys.exit(1) |
248 |
|
249 |
for e in ['ip6tables', 'iptables-restore', 'ip6tables-restore']: |
250 |
if not os.path.exists(os.path.join(iptables_dir, e)): |
251 |
print >> sys.stderr, "ERROR: could not find required binary '%s'" % (e) |
252 |
sys.exit(1) |
253 |
|
254 |
(rc, out) = cmd([iptables_exe, '-V']) |
255 |
if rc != 0: |
256 |
raise OSError(errno.ENOENT, "Could not find version for '%s'" % \ |
257 |
(iptables_exe)) |
258 |
version = re.sub('^v', '', re.split('\s', out)[1]) |
259 |
print "Found '%s' version '%s'" % (iptables_exe, version) |
260 |
if version < "1.4": |
261 |
print >> sys.stderr, "WARN: version '%s' has limited IPv6 support. See README for details." % (version) |
262 |
|
228 |
|
263 |
setup (name='ufw', |
229 |
setup (name='ufw', |
264 |
version=ufw_version, |
230 |
version=ufw_version, |