diff --git a/.bin/mount-cryptoffs b/.bin/mount-cryptoffs new file mode 100755 index 0000000..4587442 --- /dev/null +++ b/.bin/mount-cryptoffs @@ -0,0 +1,32 @@ +#!/bin/sh +_dev=${1:-sd2} + +if mount | grep -q "/mnt" +then + echo "already mounted" + mount | grep "/mnt" + exit 1 +fi + +# check if already decrypted +_biodev=$(doas bioctl softraid0 | grep -B1 $_dev | head -1 | awk '{print $5}' \ + || exit 1) + +# if not +if [ -z "$_biodev" ] +then + # decrypt + doas bioctl -c C -l ${_dev}a softraid0 + # and read again + _biodev=$(doas bioctl softraid0 | grep -B1 $_dev | head -1 | awk '{print $5}' \ + || exit 1) +fi + +# it still might not be there (wrong password etc..) +if [ -n "$_biodev" ] +then + echo "${_dev}a attached as $_biodev" + # mount biodev + doas mount /dev/${_biodev}a /mnt \ + && echo "${_biodev}a mounted to /mnt" +fi diff --git a/.bin/mount-exfat b/.bin/mount-exfat new file mode 100755 index 0000000..870a1a8 --- /dev/null +++ b/.bin/mount-exfat @@ -0,0 +1,3 @@ +#!/bin/sh -x +_dev=${1:-sd2} +doas mount.exfat-fuse -o nodev,nosuid,noatime,uid=1000,gid=1000 /dev/${_dev}i /mnt diff --git a/.bin/mount-fat32 b/.bin/mount-fat32 new file mode 100755 index 0000000..f766600 --- /dev/null +++ b/.bin/mount-fat32 @@ -0,0 +1,3 @@ +#!/bin/sh -x +_dev=${1:-sd2} +doas /sbin/mount_msdos -o nodev,nosuid,noatime -u 1000 -g 1000 /dev/${_dev}i /mnt diff --git a/.bin/umount-cryptoffs b/.bin/umount-cryptoffs new file mode 100755 index 0000000..abbf406 --- /dev/null +++ b/.bin/umount-cryptoffs @@ -0,0 +1,10 @@ +#!/bin/sh +_dev=${1:-sd3} +doas umount /mnt 2>&1 | grep -q busy && echo "/mnt is busy" && exit 1 +_biodev=$(doas bioctl softraid0 | grep -C1 sd3 | grep CRYPTO | awk '{ print $5 }') +if [ -n "$_biodev" ] +then + doas bioctl -d ${_biodev} && echo "bioctl: $_dev detached" +else + echo "bioctl: $_dev: currently not attached" +fi diff --git a/.bin/port-remake-mystuff b/.bin/update-mystuff similarity index 100% rename from .bin/port-remake-mystuff rename to .bin/update-mystuff