diff options
author | Karel Kočí <cynerd@email.cz> | 2021-01-17 14:36:50 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2021-01-17 14:38:05 +0100 |
commit | f07b44c37989517c4406e9f442ebff7beb6360c7 (patch) | |
tree | 45f4002b632007e8e363f3a990341df748bb8a08 /mount-data/files | |
parent | 09212955cbfd464e80f7ac2ebe87817bcdb37c85 (diff) | |
download | openwrt-personal-pkgs-f07b44c37989517c4406e9f442ebff7beb6360c7.tar.gz openwrt-personal-pkgs-f07b44c37989517c4406e9f442ebff7beb6360c7.tar.bz2 openwrt-personal-pkgs-f07b44c37989517c4406e9f442ebff7beb6360c7.zip |
mount-data: add package back
Diffstat (limited to 'mount-data/files')
-rwxr-xr-x | mount-data/files/init | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mount-data/files/init b/mount-data/files/init new file mode 100755 index 0000000..035f82f --- /dev/null +++ b/mount-data/files/init @@ -0,0 +1,58 @@ +#!/bin/sh /etc/rc.common + +START=36 +STOP=90 + +UUID_A="3472bef9-cbae-48bd-873e-fd4858a0b72f" +UUID_B="ad73f0bf-3cc5-4aee-842f-992db6a642e3" +UUID="f71f2b6c-fc49-4a9b-91b3-7eaab853a02d" + +is_open() { + [ -b "/dev/mapper/data_$1" ] +} + +open() { + cryptsetup open --key-file /etc/keys/sd "UUID=$2" "data_$1" +} + +close() { + cryptsetup close "data_$1" +} + +is_mounted() { + findmnt >/dev/null "$1" +} + +mount_btrfs() { + mount -o subvol="$1" "UUID=$UUID" "$2" +} + +umount_drive() { + umount -lf "UUID=$UUID" +} + + +status() { + is_mounted "/data" && is_mounted "/srv" +} + +start() { + is_open a || open a "$UUID_A" + is_open b || open b "$UUID_B" + is_mounted "/data" || mount @data /data + is_mounted "/srv" || mount @srv /srv +} + +stop() { + unmount_drive + close a + close b +} + +restart() { + : +} + +reload() { + : +} |