-
Notifications
You must be signed in to change notification settings - Fork 0
/
iso_manager-mount-image.sh
executable file
·37 lines (27 loc) · 1.14 KB
/
iso_manager-mount-image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#################################################################
# For KDE-Services. 2012-2017. #
# By Geovani Barzaga Rodriguez <[email protected]> #
# Improved by Victor Guardiola (vguardiola) Jan 5 2014 #
# -Fixed the problem of [dir|file]name with whitespaces. #
# Imporved by Jaydeep Godara (JaydeepGo) 23 Sept 2018 #
# -Remove fuseiso dependency to work on Fedora Linux #
#################################################################
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/$USER/bin
MOUNTEXIT=""
##############################
############ Main ############
##############################
cd /tmp/
mkdir -p /tmp/$2
password=$(kdialog --password "Enter your password")
echo $password | sudo -S mount -o loop $1 /tmp/$2
MOUNTEXIT=$?
if [ "$MOUNTEXIT" = "0" ]; then
kdialog --icon=ks-media-optical-mount --title="Mount ISO Image" --passivepopup="[Finished] $2 mounted."
else
kdialog --icon=ks-error --title="Mount ISO Image" \
--passivepopup="[Error] Can't mount $2: Already mount or Wrong Password"
exit 1
fi
exit 0