Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- mountpoint="/mnt/backup/"
- devicedir="/dev/cryptpool/"
- echo "$1" | grep -q "$mountpoint"
- if [ $? -ne 0 ] ; then
- exit 0
- fi
- orig=$(echo "$1" | sed -e 's:^'$mountpoint'::' -e 's:/$::')
- full=$(echo "$1" | sed 's:/$::')
- if [ "$full" != "$mountpoint$orig" ];
- then
- echo "Error!"
- exit 1
- fi
- lvcreate -n "$orig"backup -s "$devicedir$orig" -l 100%FREE
- retlv=$?
- if [ $retlv -ne 0 ]; then
- echo "Error creating logical volume. return value: $retlv"
- exit $retlv
- fi
- mkdir -p $full
- mount -o ro "$devicedir$orig"backup $full
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement