15
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
COMMENT
17
17
18
- version=" mnttools v0.4.1 "
19
- blue=' \e[0 ;34m' ; green=' \e[0;32m' ; red=' \e[0;31m' ; yellow=' \e[0;33m' ; bold=' \e[1m' ; none=' \e[0m'
18
+ version=" mnttools v0.4.2 "
19
+ blue=' \e[1 ;34m\e[47m ' ; green=' \e[0;32m' ; red=' \e[0;31m' ; yellow=' \e[0;33m' ; bold=' \e[1m' ; none=' \e[0m'
20
20
function menu {
21
21
n=0
22
22
choices=(" $@ " )
23
- echo -e " $blue$bold$ version - $menutitle "
23
+ echo -e " $blue$version - $menutitle$none "
24
24
for i in " ${choices[@]} " ; do
25
25
echo -e " $none $(( n++ )) ) $yellow$i "
26
26
done
@@ -231,11 +231,10 @@ function smbbrowse {
231
231
}
232
232
233
233
function histmenu {
234
- IFS=$' \n '
235
- recent=(` cat " $history_file " 2> /dev/null` )
234
+ recent=(` cat " $history_file " | cut -d' |' -f1` )
236
235
menutitle=" Mount History"
237
236
menu ${recent[@]} " Edit history" " Main Menu"
238
- IFS= $oIFS
237
+ l= $(( $? + 1 ))
239
238
case $choice in
240
239
Main* ) mainmenu ;;
241
240
Edit* )
@@ -247,16 +246,12 @@ function histmenu {
247
246
fi
248
247
histmenu ;;
249
248
* )
250
- fs=; mntopts=; DEVNAME=; mntpoint=
251
- IFS=' |' ; n=0
252
- for i in $choice ; do
253
- [[ $i = -t * ]] && fs=$i
254
- [[ $i = -o * ]] && mntopts=$i
255
- [[ $n -eq 0 ]] && DEVNAME=$i
256
- [[ $n -eq 1 ]] && mntpoint=$i
257
- (( n++ ))
258
- done
259
- IFS=$oIFS
249
+ unset fs mntopts DEVNAME mntpoint
250
+ data=` grep -n $choice " $history_file " | grep ^$l :`
251
+ DEVNAME=$choice
252
+ mntpoint=` echo $data | cut -d' |' -f2`
253
+ fs=` echo $data | cut -d' |' -f3`
254
+ mntopts=` echo $data | cut -d' |' -f4`
260
255
_mount ;;
261
256
esac
262
257
}
@@ -281,7 +276,7 @@ function mainmenu {
281
276
* NFS) nfsmenu ;;
282
277
* history) histmenu ;;
283
278
Unmount) unmountmenu ;;
284
- * conkyfc ) modconkyrc removeall ;;
279
+ * conkyrc ) modconkyrc removeall ;;
285
280
Remount* ) remountmenu ;;
286
281
esac
287
282
}
@@ -318,12 +313,12 @@ function remountmenu {
318
313
eval " ` lsblk -P -o NAME,MOUNTPOINT | grep ${1##*/ } ` "
319
314
else
320
315
IFS=$' \n '
321
- d=(` lsblk -P -o NAME,MOUNTPOINT | grep $mntroot ` )
316
+ d=(` mount | grep $mntroot | cut -d ' ' -f1-3 ` )
322
317
menutitle=" Remount Device Menu"
323
318
menu ${d[@]} " Main Menu"
324
319
IFS=$oIFS
325
320
if [[ $choice = " Main Menu" ]]; then mainmenu; return ; fi
326
- eval " $ choice"
321
+ eval " ` lsblk -P -o NAME,MOUNTPOINT ${ choice[0]} ` "
327
322
fi
328
323
unmount " $MOUNTPOINT "
329
324
sleep 1
@@ -441,13 +436,13 @@ oIFS=$IFS
441
436
if [[ $1 = --config ]]; then
442
437
cfg=$2 ; action=$3
443
438
fi
444
- [[ -f ${cfg:= $HOME / .mnttools} ]] && source "$cfg "
439
+ [[ -f ${cfg:= ~ / .mnttools} ]] && source "$cfg "
445
440
gid=` cat /etc/group | grep ^users: | cut -d' :' -f3`
446
441
[[ $USER && $USER != root ]] && runasroot=sudo
447
442
run=yes
448
443
mntroot=${mntroot:=/ media}
449
444
save_history=${save_history:= true}
450
- history_file=${history_file:= $HOME / .mnttools_history}
445
+ history_file=${history_file:= ~ / .mnttools_history}
451
446
general_mntopts=${general_mntopts:= noatime}
452
447
winfs_mntopts=${winfs_mntopts:= gid=$gid ,umask=002,flush}
453
448
sshfs_mntopts=${sshfs_mntopts:= reconnect,compression=yes,workaround=rename,gid=$gid ,umask=002}
0 commit comments