Created
February 23, 2020 19:09
-
-
Save aeifn/e4b8a6eb2d9dbc492ead33af455a7760 to your computer and use it in GitHub Desktop.
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/sh | |
| BASE_DIR=/media/kolxo3 | |
| UNION_DIR=$BASE_DIR/all | |
| DOWNLOAD_DIR=/usr/local/etc/transmission/home/Downloads/KoLXo3 | |
| kol_umount(){ | |
| echo "Unmounting UNIONFS..." | |
| while sudo umount $UNION_DIR; do true; done; | |
| echo "Unmounting MDs..." | |
| for a in /dev/md[0-9]* | |
| do | |
| NUM=${a##*md} | |
| sudo umount $a | |
| sudo mdconfig -d -u $NUM | |
| done | |
| sudo rmdir $BASE_DIR/* | |
| } | |
| kol_mount() { | |
| echo "Mounting..." | |
| sudo mkdir -p $BASE_DIR | |
| cd $DOWNLOAD_DIR | |
| for ISO in disc*.iso; | |
| do | |
| DISC_NAME=${ISO%.*} | |
| DISC_DIR=$BASE_DIR/$DISC_NAME | |
| MD_DEV=`sudo mdconfig -f $ISO` | |
| sudo mkdir -p $DISC_DIR | |
| sudo mount_cd9660 /dev/$MD_DEV $DISC_DIR | |
| done | |
| } | |
| kol_union() { | |
| cd $BASE_DIR | |
| sudo mkdir -p $UNION_DIR | |
| for DISC_DIR in disc[012]* | |
| do | |
| sudo mount_unionfs -o rw -o noatime $DISC_DIR $UNION_DIR | |
| done | |
| } | |
| case $1 in | |
| umount) | |
| kol_umount | |
| ;; | |
| mount) | |
| kol_mount | |
| ;; | |
| union) | |
| kol_union | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment