[fsug-calicut] Easy mount script in python

  • From: Sajjad Anwar <sajjadkm@xxxxxxxxx>
  • To: fsug-calicut <fsug-calicut@xxxxxxxxxxxxx>, fsug-tvm <ilug-tvm@xxxxxxxxxxxxxxxx>
  • Date: Thu, 20 Aug 2009 23:00:30 +0530

Hello all,

Just wrote a simple script in python to mount any iso image to any required
location.

Inspiration:

My friends have been finding it difficult to mount iso's. they asked whether
it could be made more easy. guess this went fine.

Inputs:

1. Location of the iso
2. Destination to which it is to be mounted
3. sudo password

To run this script:

1. Set permissions using the following command
$ chmod a+x mnt.py

2. run the script using
$ ./mnt.py

please try and post comments.

thanks

Regards.

-- 
Sajjad Anwar
http://geohackers.in
http://fsugcalicut.org
geohackers.in@xxxxxxxxx
+91 9995 19 13 12
#!/usr/bin/python

import os

a=raw_input("\nEnter the path of the iso image: ")
b=raw_input("\nEnter the destination: ")
pwd=raw_input("\nOnly root can mount, specify your sudo password: ")

sudo_command = 'mount -o loop %s %s'%(a,b)
print(sudo_command)
do = os.system('echo %s|sudo -S %s' % (pwd, sudo_command))

Other related posts:

  • » [fsug-calicut] Easy mount script in python - Sajjad Anwar