Small programs that automatically mount and uninstall iso image files in Linux

Source: Internet
Author: User
Article Title: small programs that automatically mount and uninstall iso image files in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
There are too many iso files. Every time you open it, you need to enter the command line and then run the mount xxx. iso/misc-oloop command.
  
Wait, and enter the command line to use the umount/misc command.
  
For anyone who can mount the iso file as a file system and know the mount command, there are only two additional commands.
  
But for those who are not familiar with linux, this problem is more difficult.
  
Yesterday, my girlfriend asked me how to open the iso file? Do you want to download the virtual optical drive?
  
I said no, just use a command. But I know that the command is still difficult for her. After all, I have never used linux, so I want to be unable to automatically mount the command when I access it?
  
So I wrote a small program. After testing, this function can be implemented now, but there are still some imperfections.
  
The procedure is as follows:
  
$ Cat mountiso. sh
  
#! /Bin/bash # --------------------------------------------------------------- # mountiso. sh iso image file automatic mounting, uninstallation Program # Author: Zhao Weiguo mlsx@xplore.cn # Use method: In the kde environment, right click a iso file, select the file opening method # select the path of your program (my path is/home/mlsx/bin/mountiso. sh ). # Then select how to open the file on the terminal and remember it # define myself =$ $ echo "mountiso parent pid is $ myself" function umountiso {sudo umount/misc kill-9 $1 exit 0} trap "umountiso $ myself" 1 2 3 9 15 sudo mount $1/misc-oloopkonqueror/misc & child = 'ps-ef & line; grep 'konqueror/misc' & line; grep-v grep & line; awk '{print $2} ''echo "mount pid is $ child" while ["1"-lt "2"] do is_exist = 'ps-ef & line; grep $ child & line; grep-v grep 'if [-z "$ is_exist"] then sudo umount/misc exit 0 fi sleep 3 done
  
For instructions, see program annotations.
  
When you open an iso file, the iso file is automatically mounted under/misc (you can modify it), and a corresponding terminal will also be opened. Do not close this terminal. When you close the opened konqueror window, the terminal will also be closed automatically.
  
Gnome has not been tested. Tell me who has tested it.
  
You are welcome to improve this program.
  
Note: Because the mount command requires root permission, if you use root for login, delete sudo in the program.
  
If you are a common user, you need to add this user to sudo, and configure it to not require password access (of course you can also configure the password, however, you need to enter the password for each mount ). To achieve this, you need to use the root account to log on and execute the following command
  
# Mongodo
  
Open a file and add such a line at the end
  
Mlsx ALL = (ALL) NOPASSWD: ALL
  
After saving, you can use the above program.
  
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.