From dc8d497a298165ec954a5ff550cd97c79dde1a8a Mon Sep 17 00:00:00 2001 From: VG Date: Thu, 11 May 2017 10:01:40 +0200 Subject: add more scripts --- scripts/pumount | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 scripts/pumount (limited to 'scripts/pumount') diff --git a/scripts/pumount b/scripts/pumount new file mode 100755 index 0000000..db1ce8b --- /dev/null +++ b/scripts/pumount @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +dash_found= +for arg in "$@"; do + if [ -z "${arg##-*}" ]; then + dash_found=true + break + fi +done + +if [ "$#" -gt 0 ]; then + if [ -n "$dash_found" ]; then + exec /usr/bin/pumount "$@" + fi + for arg in "$@"; do + /usr/bin/pumount "$arg" + done + exit 0 +fi + +cd /media/ + +mps=(*) + +if [ ${#mps[@]} -eq 0 ]; then + echo "Nothing to be done." + exit 0 +fi + +if [ ${#mps[@]} -eq 1 ]; then + if [ "${mps[0]}" == "*" ]; then + echo "Nothing to be done." + exit 0 + fi + echo "unmounting /media/${mps[0]}" + exec /usr/bin/pumount "/media/${mps[0]}" +fi + +select mp in ${mps[*]}; do + echo "unmounting /media/$mp" + exec /usr/bin/pumount "/media/$mp" +done -- cgit v1.2.3