socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

active devel

This commit is contained in:
David 2012-05-15 19:03:27 +02:00
parent f4449481a7
commit 51f5b703cc
1 changed files with 43 additions and 4 deletions

View File

@ -2,26 +2,65 @@
import os
#fileoperations
file = open("/proc/partitions", "r")
parts = file.read()
file.close()
file = open("/proc/mounts", "r")
mounts = file.read()
file.close()
# getting all local partitions (regardless if mounted or not)
#definitions
partitions = []
blocks = []
mountpoints = []
# getting all local partitions (regardless if mounted or not)
for line in parts.split("\n"):
if line and "name" not in line and "sr0" not in line:
if line.split()[2] != "1":
partitions.append(line.split()[3])
partitions.append("/dev/" + line.split()[3])
blocks.append(line.split()[2])
print "partitions: %s \nblocks: %s" %(partitions, blocks)
hold="nothing"
holdblocks = 0
blockcount = 0
counter = 0
for part in partitions:
if hold in part:
print "part %s contains hold %s" %(part, hold)
blockcount = blockcount + int(blocks[counter])
print blockcount
else:
print "part %s does not contain hold %s" %(part, hold)
hold = part
holdblocks = blocks[counter]
blockcount = 0
counter += 1
exit()
#getting mountpoints to devices
for item in partitions:
for line in mounts.split("\n"):
if line and item in line:
mountpoints.append(line.split()[1])
break
# mountpoints.append("%s not mounted" %(item))
print "partitions: %s\nblocks: %s\nmountpoints: %s" %(partitions, blocks, mountpoints)
exit()
# given paths(mountpoints)
path=("/boot", "/", "/dev/sda6")