#!/bin/sh UCI_SPOOLDIR="/var/spool/uvol" _uvol_init_spooldir() { [ ! -d "$(dirname "$UCI_SPOOLDIR")" ] && mkdir -p "$(dirname "$UCI_SPOOLDIR")" mkdir -m 0700 -p "$UCI_SPOOLDIR" } uvol_uci_add() { local volname="$1" local devname="$2" local mode="$3" local autofs uuid uciname uciname=${volname//-/_} uuid="$(/sbin/block info | grep "^$2" | xargs -n 1 echo | grep "^UUID=.*")" [ "$uuid" ] || return 22 _uvol_init_spooldir uuid="${uuid:5}" autofs=0 [ "$mode" = "ro" ] && autofs=1 if [ -e "${UCI_SPOOLDIR}/remove-$1" ]; then rm "${UCI_SPOOLDIR}/remove-$1" fi cat >"${UCI_SPOOLDIR}/add-$1" <"${UCI_SPOOLDIR}/remove-$1" <