Skip to content

Instantly share code, notes, and snippets.

@nexus166
Created April 19, 2020 03:51
Show Gist options
  • Select an option

  • Save nexus166/ddeeefb25264fe602998b89fb92773ca to your computer and use it in GitHub Desktop.

Select an option

Save nexus166/ddeeefb25264fe602998b89fb92773ca to your computer and use it in GitHub Desktop.
OpenWRT encrypted microSD mount hook
if [ "$DEVNAME" = "sda3" ]; then
if [ "$ACTION" = "add" ]; then
/usr/sbin/cryptsetup luksOpen "/dev/$DEVNAME" "$DEVNAME" --key-file "/root/$DEVNAME.key"
/usr/bin/mount "/dev/mapper/$DEVNAME" "/mnt/$DEVNAME"
elif [ "$ACTION" = "remove"]; then
/usr/bin/umount -r "/mnt/$DEVNAME"
/usr/sbin/cryptsetup luksClose "$DEVNAME"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment