commit ea1c742e8afd129dc3e8716adfde285ff94975cb
parent ee3ce1af8553c1099fca3415cb47183dea0d5ad1
Author: Christos Margiolis <christos@margiolis.net>
Date: Mon, 4 Apr 2022 03:37:35 +0300
merged android mnt scripts
Diffstat:
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
@@ -20,7 +20,6 @@ SCRIPTS = ausplit \
setscreens \
sysact \
tag \
- umntdroid \
unix \
upd \
vdq \
@@ -47,8 +46,8 @@ install: all
cp -f ${SCRIPTS} ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/${SCRIPTS}
-uninstall:
- rm -f ${DESTDIR}${PREFIX}/bin/${SCRIPTS}
+# FIXME: FOR LOOP
+#uninstall:
clean:
rm -f ${DIST}.tar.gz
diff --git a/mntdroid b/mntdroid
@@ -1,9 +1,23 @@
#!/bin/sh
MTPT="/mnt/droid"
+f_umnt=0
+
+while getopts u arg; do
+case "${arg}" in
+ u) f_umnt=1 ;;
+ *) echo "usage: ${0##*/} [-u]" 1>&2 && exit 1 ;;
+esac
+done
n=$(simple-mtpfs -l 2>/dev/null | dmenu -i -p "Available devices" | cut -f1 -d':')
-mkdir -p "${MTPT}/${n}"
-simple-mtpfs --device "${n}" -o allow_other "${MTPT}/${n}" | dmenu -p "Check" >/dev/null
-simple-mtpfs --device "${n}" -o allow_other "${MTPT}/${n}" &&
-echo "Android device mounted to: ${MTPT}/${n}" | nfy
+if [ ${f_umnt} -ne 1 ]; then
+ mkdir -p "${MTPT}/${n}"
+ simple-mtpfs --device "${n}" -o allow_other "${MTPT}/${n}" | dmenu -p "Check" >/dev/null
+ simple-mtpfs --device "${n}" -o allow_other "${MTPT}/${n}" &&
+ echo "Mounted: ${MTPT}/${n}" | nfy
+else
+ umount "${MTPT}/${n}"
+ rm -rf "${MTPT}/${n}"
+ echo "Unmounted: ${MTPT}/${n}" | nfy
+fi
diff --git a/umntdroid b/umntdroid
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-MTPT="/mnt/droid"
-
-n=$(simple-mtpfs -l 2>/dev/null | dmenu -i -p "Available devices" | cut -f1 -d':')
-umount "${MTPT}/${n}"
-rm -rf "${MTPT}/${n}"