Skip to content

Commit d938481

Browse files
committed
nc-scan-auto: recursive and home-only options
Signed-off-by: nachoparker <nacho@ownyourbits.com>
1 parent 7589081 commit d938481

File tree

4 files changed

+47
-13
lines changed

4 files changed

+47
-13
lines changed

bin/ncp/CONFIG/nc-scan-auto.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,20 @@ configure()
3232
[[ $hour == 0 ]] && hour="*" || { hour="*/$hour" mins="15"; }
3333
fi
3434

35+
[[ "$RECURSIVE" == no ]] && local recursive=--shallow
36+
[[ "$NONEXTERNAL" == yes ]] && local non_external=--home-only
37+
3538
cat > /usr/local/bin/ncp-scan-auto <<EOF
3639
#!/bin/bash
3740
(
3841
3942
echo -e "\n[ nc-scan-auto ]"
4043
41-
[[ "$PATH1" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH1"
42-
[[ "$PATH2" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH2"
43-
[[ "$PATH3" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH3"
44+
[[ "$PATH1" != "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v -p "$PATH1"
45+
[[ "$PATH2" != "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v -p "$PATH2"
46+
[[ "$PATH3" != "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v -p "$PATH3"
4447
45-
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && /usr/local/bin/ncc files:scan -n -v --all
48+
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && /usr/local/bin/ncc files:scan $recursive $non_external -n -v --all
4649
4750
) 2>&1 >>/var/log/ncp.log
4851
EOF

bin/ncp/TOOLS/nc-scan.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,43 @@
99
#
1010

1111

12-
install()
13-
{
12+
install()
13+
{
1414
cat > /usr/local/bin/ncp-scan <<'EOF'
1515
#!/bin/bash
1616
ncc files:scan -n -v --all
1717
EOF
1818
chmod +x /usr/local/bin/ncp-scan
1919
}
2020

21-
configure()
21+
configure()
2222
{
23+
local ret=0
24+
2325
[[ "$RECURSIVE" == no ]] && local recursive=--shallow
2426
[[ "$NONEXTERNAL" == yes ]] && local non_external=--home-only
2527

26-
[[ "$PATH1" != "" ]] && \
28+
[[ "$PATH1" != "" ]] && {
2729
ncc files:scan -n -v $recursive $non_external -p "$PATH1"
30+
[[ $? -ne 0 ]] && ret=1
31+
}
2832

29-
[[ "$PATH2" != "" ]] && \
33+
[[ "$PATH2" != "" ]] && {
3034
ncc files:scan -n -v $recursive $non_external -p "$PATH2"
35+
[[ $? -ne 0 ]] && ret=1
36+
}
3137

32-
[[ "$PATH3" != "" ]] && \
38+
[[ "$PATH3" != "" ]] && {
3339
ncc files:scan -n -v $recursive $non_external -p "$PATH3"
40+
[[ $? -ne 0 ]] && ret=1
41+
}
42+
43+
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && {
44+
ncc files:scan -n -v $recursive $non_external --all
45+
[[ $? -ne 0 ]] && ret=1
46+
}
3447

35-
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && ncc files:scan -n -v --all
48+
return ${ret}
3649
}
3750

3851
# License

changelog.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11

2-
[v1.12.0](https://github.com/nextcloud/nextcloudpi/commit/703ff6f) (2019-04-29) ncp-web: add backups panel
2+
[v1.12.3](https://github.com/nextcloud/nextcloudpi/commit/b797129) (2019-05-11) nc-scan-auto: recursive and home-only options
33

4-
[v1.11.5](https://github.com/nextcloud/nextcloudpi/commit/01cd421) (2019-04-29) letsencrypt: force renewal by default
4+
[v1.12.2 ](https://github.com/nextcloud/nextcloudpi/commit/7589081) (2019-05-11) fix logrotate files
5+
6+
[v1.12.1](https://github.com/nextcloud/nextcloudpi/commit/1be5ddd) (2019-05-01) Rename configuration variables into self-documenting ones (#889)
7+
8+
[v1.12.0](https://github.com/nextcloud/nextcloudpi/commit/f34354c) (2019-04-29) ncp-web: add backups panel
9+
10+
[v1.11.5 ](https://github.com/nextcloud/nextcloudpi/commit/01cd421) (2019-04-29) letsencrypt: force renewal by default
511

612
[v1.11.4 ](https://github.com/nextcloud/nextcloudpi/commit/b3c7d13) (2019-04-28) letsencrypt: switch to apt version
713

etc/ncp-config.d/nc-scan-auto.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@
1212
"value": "no",
1313
"type": "bool"
1414
},
15+
{
16+
"id": "RECURSIVE",
17+
"name": "Recursive",
18+
"value": "yes",
19+
"type": "bool"
20+
},
21+
{
22+
"id": "NONEXTERNAL",
23+
"name": "Ignore external files",
24+
"value": "no",
25+
"type": "bool"
26+
},
1527
{
1628
"id": "SCANINTERVAL",
1729
"name": "Scan periodicity (in minutes)",

0 commit comments

Comments
 (0)