From 38dfa60508a6fabb2711d3d8cdd3c997632f5cf9 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Fri, 16 Mar 2018 14:58:49 +0100 Subject: fix for nc-automount-links --- changelog.md | 4 +++- etc/nextcloudpi-config.d/nc-automount.sh | 4 ++-- update.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index c1c082af..43ce79ee 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ -[v0.47.2](https://github.com/nextcloud/nextcloudpi/commit/3766959) (2018-03-15) improve dependency of database with automount +[v0.47.3](https://github.com/nextcloud/nextcloudpi/commit/4156bb7) (2018-03-16) fix for nc-automount-links + +[v0.47.2](https://github.com/nextcloud/nextcloudpi/commit/66cb00a) (2018-03-15) improve dependency of database with automount [v0.47.1 ](https://github.com/nextcloud/nextcloudpi/commit/9f6c479) (2018-03-10) update: make sure redis log exists diff --git a/etc/nextcloudpi-config.d/nc-automount.sh b/etc/nextcloudpi-config.d/nc-automount.sh index 8577b7d8..3ffaf1ae 100644 --- a/etc/nextcloudpi-config.d/nc-automount.sh +++ b/etc/nextcloudpi-config.d/nc-automount.sh @@ -75,9 +75,9 @@ ls -d /media/* &>/dev/null && { i=0 for d in $( ls -d /media/* 2>/dev/null ); do if [ $i -eq 0 ]; then - [[ -e /media/USBdrive ]] || mountpoint -q "$d" && ln -sT "$d" /media/USBdrive + test -e /media/USBdrive || test -d "$d" && ln -sT "$d" /media/USBdrive else - [[ -e /media/USBdrive$i ]] || mountpoint -q "$d" && ln -sT "$d" /media/USBdrive$i + test -e /media/USBdrive$i || test -d "$d" && ln -sT "$d" /media/USBdrive$i fi i=$(( i + 1 )) done diff --git a/update.sh b/update.sh index 3b1c4ab3..4d8390d2 100755 --- a/update.sh +++ b/update.sh @@ -265,6 +265,32 @@ EOF sed -i 's|^ExecStartPre=/bin/sleep .*|ExecStartPre=/bin/sleep 20|' /lib/systemd/system/mariadb.service sed -i 's|^Restart=.*|Restart=on-failure|' /lib/systemd/system/mariadb.service + # fix for nc-automount-links + cat > /usr/local/etc/nc-automount-links <<'EOF' +#!/bin/bash + +ls -d /media/* &>/dev/null && { + + # remove old links + for l in $( ls /media/ ); do + test -L /media/"$l" && rm /media/"$l" + done + + # create links + i=0 + for d in $( ls -d /media/* 2>/dev/null ); do + if [ $i -eq 0 ]; then + test -e /media/USBdrive || test -d "$d" && ln -sT "$d" /media/USBdrive + else + test -e /media/USBdrive$i || test -d "$d" && ln -sT "$d" /media/USBdrive$i + fi + i=$(( i + 1 )) + done + +} +EOF + chmod +x /usr/local/etc/nc-automount-links + } # end - only live updates exit 0 -- cgit v1.2.3