Update 2025-01-01 10:04 OpenBSD/amd64-t14
This commit is contained in:
parent
6b2b5ae779
commit
1c9a2b446a
32
.bin/mount-cryptoffs
Executable file
32
.bin/mount-cryptoffs
Executable file
@ -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
|
3
.bin/mount-exfat
Executable file
3
.bin/mount-exfat
Executable file
@ -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
|
3
.bin/mount-fat32
Executable file
3
.bin/mount-fat32
Executable file
@ -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
|
10
.bin/umount-cryptoffs
Executable file
10
.bin/umount-cryptoffs
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user