Mount iso file with a shell script

mount-iso-file-with-a-shell-script

Mount iso file with a shell script, it’s easy in linux. I’ve done in linux.  And I’m using ubuntu 9.10. This script I use to mount an and many iso files of ubuntu repositiry at one time. Of course this script will be different with your script, according to your address of source iso files and target of destination directory for mounting.

Mount iso file script

The first step: Make mountisocdrepo.sh files

#!/bin/bash
#autor sadam
echo ++++++++++++++++++++++++++++++++++++++++++++++++++

if
echo author : Asep Sudiyono
echo blog   : https://kencur.net/
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
echo
echo
echo latihan pertama
echo
echo
echo user :
whoami
then
mkdir /winrepo/u904d1/
mkdir /winrepo/u904d2/
mkdir /winrepo/u904d3/
mkdir /winrepo/u904d4/
mkdir /winrepo/u904d5/
mkdir /winrepo/u904d6/
mkdir /winrepo/u904d7/
# command		source	iso			destination
mount -o loop /media/LINUX/ubuntu9.04/u904disk1.iso /winrepo/u904d1/
mount -o loop /media/LINUX/ubuntu9.04/u904disk2.iso /winrepo/u904d2/
mount -o loop /media/LINUX/ubuntu9.04/u904disk3.iso /winrepo/u904d3/
mount -o loop /media/LINUX/ubuntu9.04/u904disk4.iso /winrepo/u904d4/
mount -o loop /media/LINUX/ubuntu9.04/u904disk5.iso /winrepo/u904d5/
mount -o loop /media/LINUX/ubuntu9.04/u904disk6.iso /winrepo/u904d6/
mount -o loop /media/LINUX/ubuntu9.04/tambahan9041-CD1.iso /winrepo/u904d7/
echo #################################################
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
fi
echo done

The second step:

Create the file into executeable mode (chmod + x mountisocdrepo.sh then hit enter).

The third step:

Type “sudo ./mountisocdrepo.sh” in your gnome-terminal then press enter (without quote).

UnMount iso file script

For unmount create use this script:
For example name is umountisocdrepo.sh (Don’t forget to make executeable).

#!/bin/bash
#autor sadam
echo ++++++++++++++++++++++++++++++++++++++++++++++++++

if
echo latihan kedua
whoami

then
umount /winrepo/u904d1/
umount /winrepo/u904d2/
umount /winrepo/u904d3/
umount /winrepo/u904d4/
umount /winrepo/u904d5/
umount /winrepo/u904d6/
umount /winrepo/u904d7/
echo #################################################
echo ++++++++++++++++++++++++++++++++++++++++++++++++++
rm -rf /winrepo/u904d1/
rm -rf /winrepo/u904d2/
rm -rf /winrepo/u904d3/
rm -rf /winrepo/u904d4/
rm -rf /winrepo/u904d5/
rm -rf /winrepo/u904d6/
rm -rf /winrepo/u904d7/
fi
echo done

Just sharing my experience. This may be useful for the new to learn linux. Like me. :-D
Sorry my english is very bad.

Download

Tinggalkan sebuah komentar

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *

2 pemikiran di “Mount iso file with a shell script”

Mulai chat
1
Butuh Informasi?
Ya, Ada yang bisa saya bantu?