Skip to content
This repository was archived by the owner on Jan 7, 2024. It is now read-only.

Commit dccf14d

Browse files
authored
Merge pull request #44 from linuxserver/symlinks
use loop to simplify symlinks
2 parents 91ec364 + f3a5553 commit dccf14d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Use `ubnt` as the password to login and `$address` is the IP address of the host
9999

100100
## Versions
101101

102+
+ **08.02.18:** Use loop to simplify symlinks.
102103
+ **08.01.18:** Update to 5.6.29.
103104
+ **15.12.17:** Update to 5.6.26.
104105
+ **09.12.17:** Fix continuation lines.

root/etc/cont-init.d/20-config

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
mkdir -p \
55
/config/{data,logs,run}
66

7+
78
# create symlinks for config
8-
[[ -L /usr/lib/unifi/data && ! /usr/lib/unifi/data -ef /config/data ]] && unlink /usr/lib/unifi/data
9-
[[ -L /usr/lib/unifi/logs && ! /usr/lib/unifi/logs -ef /config/logs ]] && unlink /usr/lib/unifi/logs
10-
[[ -L /usr/lib/unifi/run && ! /usr/lib/unifi/run -ef /config/run ]] && unlink /usr/lib/unifi/run
11-
[[ ! -L /usr/lib/unifi/data ]] && ln -s /config/data /usr/lib/unifi/data
12-
[[ ! -L /usr/lib/unifi/logs ]] && ln -s /config/logs /usr/lib/unifi/logs
13-
[[ ! -L /usr/lib/unifi/run ]] && ln -s /config/run /usr/lib/unifi/run
9+
symlinks=( \
10+
/usr/lib/unifi/data \
11+
/usr/lib/unifi/logs \
12+
/usr/lib/unifi/run )
13+
14+
for i in "${symlinks[@]}"
15+
do
16+
[[ -L "$i" && ! "$i" -ef /config/"$(basename "$i")" ]] && unlink "$i"
17+
[[ ! -L "$i" ]] && ln -s /config/"$(basename "$i")" "$i"
18+
done
1419

1520
# permissions
1621
chown -R abc:abc \

0 commit comments

Comments
 (0)