#!/usr/bin/python
# -*- coding: utf-8 -*-
# Options:
# -w : wait for a input at end (usefull in grafic envirements)
# Config:
extraTypes='fuseblk, fuse.sshfs, nfs, smbfs, cifs, swap';
###
import sys, subprocess, os, time;
def byte2string ( b ):
pythonArchitektur = int( sys.version.split( '.' )[0] );
if 3 == pythonArchitektur:
return str( b.strip(), 'UTF-8' );
return str( b.strip() );
p = subprocess.Popen( 'which blkid' , shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE )
out, err = p.communicate();
if 0 != p.returncode :
print ( 'Fatal: Entweder ist das Kein Linux oder ihr Linux ist zu alt dafür...' );
sys.exit( 1 );
out = byte2string( out );
o = subprocess.Popen( out + ' -k', shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT );
aShowTypes = o.stdout.readlines() + extraTypes.split( ',' );
aShowTypes.sort();
cmd = 'mount | grep -iP \'';
c = 0;
for s in aShowTypes :
s = byte2string( s ).strip( );
if 0 == c :
cmd += ' type ' + s + ' ';
else :
cmd += '| type ' + s + ' ';
c += 1;
cmd += '\' | sort -t \' \' -k 1';
os.system( cmd );
if 2 == len( sys.argv ) and '-w' == sys.argv[1] :
print '';
z = str( raw_input( ' Press [ENTER] ' ) );
print '';