local/bin/homesync: Let user set path where data is looked up for indexing

master
Pierre Neidhardt 2019-01-23 12:09:22 +01:00
parent bcc9f0a225
commit 337860b725
1 changed files with 12 additions and 6 deletions

View File

@ -5,11 +5,15 @@ usage() {
Usage: ${0##*/}
Sync home folder.
Data is indexed to ~/personal/index.
The '~/.gnupg' folder can be backup up to a LUKS encrypted device.
Options:
-p: Push upstream.
-d DEVICE: Device where to store ~/.gnupg
-d PATH: where the data is looked up for indexing.
-g DEVICE: Device where to store ~/.gnupg
-p: Push upstream.
EOF
exit
@ -17,14 +21,17 @@ EOF
OPT_UPDATE=false
OPT_DEVICE=""
while getopts ":hd:p" opt; do
OPT_DATAROOT=$(findmnt -n --fstab --output TARGET | grep ^/media/)
while getopts ":hd:g:p" opt; do
case $opt in
h)
usage
exit ;;
d)
OPT_DATAROOT="$OPTARG" ;;
p)
OPT_UPDATE=true ;;
d)
g)
OPT_DEVICE="$OPTARG" ;;
\?)
usage
@ -52,8 +59,7 @@ message() {
}
section Data index
DATAROOT=/media/$(ls -1 /media)
for i in "$DATAROOT"/*; do
for i in "$OPT_DATAROOT"/*; do
mkdir -p ~/personal/index/
case "$i" in
*/locate.db|*/lost+found|*/Sync*)