#!/bin/bash user1=$(grep :1000:1000: /etc/passwd|cut -d: -f1) if [ $USER = "root" ];then langbackup=$LANG LANG=C while :;do partlist=$(blkid 2>/dev/null|sed -e "s/: /:/" -e "s/UUID=\"[^\"]*\" //" -e "s/LABEL=//" -e "s/SEC_TYPE=\"[^\"]*\"//" -e "s/TYPE=\"\([^\"]*\)\"/\1/g" -e "s/UUID_SUB=\"[^\"]*\"//" -e "s/ */ /g" -e "s/ *$//"|tr " " "_"|sort) mountlist=$(df|grep ^/dev/|cut -d " " -f1) list1="" for a in $partlist;do if [ -n "$(echo "$mountlist"|grep "$(echo $a|cut -d: -f1)$")" ];then list1="$list1 TRUE ${a}_MOUNTon=$(mount|grep "$(echo $a|cut -d: -f1) "|sed -e "s/.* on //" -e "s/ .*//")" else list1="$list1 FALSE $a" fi done list1=$(echo "$list1"|sed -n -e "2,100p") mount1=$(zenity --width=700 --height=$(expr 160 + 30 \* \( $(echo "$list1"|wc -l|cut -d " " -f1) - 5 \) ) --title="Please check/uncheck partitions you want to mount/unmount" --list --text="" --multiple --checklist --separator=" " --column="Mount" --column="Partition" $list1) if [ $? = 1 ];then LANG=$langbackup;exit 0;fi echo "partitions which should be mounted are:" $mount1 for a in $partlist;do devname=$(echo $a|cut -d: -f1) if [ -n "$(echo "$list1"|grep $a|grep ^TRUE)" ];then if [ -z "$(echo $mount1|grep "${devname}:")" ];then umount $devname || zenity --warning --text="$devname cannot be unmounted." fi elif [ -n "$(echo $mount1|grep "${devname}:")" ];then udisks --mount $devname $(if [ -z "$(blkid -o udev $devname|grep ID_FS_TYPE=|grep -v ntfs|grep -v vfat)" ];then echo "--mount-options rw,umask=0000";fi) if [ -n "$(mount 2>/dev/null|grep ^"$devname ")" ];then gksu -u $user1 pcmanfm $(mount 2>/dev/null|grep "$devname "|cut -d" " -f3) & else zenity --warning --text="$devname cannot be mounted." fi fi done done else gksu -m "Enter root password to get information on partitions of all the media" bash $0 exit 0 fi