#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys, subprocess, os;

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();

cmd = 'mount | grep -P "';

c = 0;
for s in aShowTypes:
    s = byte2string( s );
    if 0 == c :
        cmd += ' type ' + s + ' ';
    else:
        cmd += '| type ' + s + ' ';
    c += 1;
   
cmd += '|type fuseblk"|sort';

os.system( cmd );
