Created
November 4, 2024 09:34
-
-
Save vitalfadeev/0a0149030bf37e00427da9a366ac1300 to your computer and use it in GitHub Desktop.
Mount *.zip to *.mnt in current folder usin FUSE. View zip images on-fly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Mount *.zip to *.mnt in current folder | |
| echo_color() { | |
| local color=$1 | |
| local text=$2 | |
| echo -e -n "\e[${color}m${text}\e[0m" | |
| } | |
| echo_green() { | |
| echo_color 32 "$1" | |
| } | |
| echo_red() { | |
| echo_color 31 "$1" | |
| } | |
| for I in *.zip | |
| do | |
| echo -n "$I.mnt... " | |
| if [ -d "$I.mnt" ] | |
| then | |
| echo -n "umount... " | |
| fusermount -u "$I.mnt" | |
| else | |
| echo -n "mkdir... " | |
| mkdir "$I.mnt" | |
| fi | |
| echo -n "mount... " | |
| fuse-zip -r "$I" "$I.mnt" | |
| if [ $? -eq 0 ] | |
| then | |
| echo_green "[ OK ]" | |
| else | |
| echo_red "[FAIL]" | |
| fi | |
| echo "" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment