diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-03-03 14:46:04 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-03-04 18:59:06 +0300 |
commit | 18e35dfdbb5a828c646a6c0e24a394840123cfbf (patch) | |
tree | 0c9721ebb306033d74b941d71f9f004d3479484c | |
parent | 45a8800cd8a49bd2960f96f0d64557cbf0c6cf30 (diff) |
nc-automount: fix dependenciesv0.46.37
-rwxr-xr-x | build-SD.sh | 2 | ||||
-rw-r--r-- | changelog.md | 4 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/fail2ban.sh | 8 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-automount.sh | 10 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-ramlogs.sh | 2 | ||||
-rw-r--r-- | etc/nextcloudpi-config.d/nc-swapfile.sh | 11 | ||||
-rwxr-xr-x | update.sh | 22 |
7 files changed, 44 insertions, 15 deletions
diff --git a/build-SD.sh b/build-SD.sh index 11597008..a61a9d89 100755 --- a/build-SD.sh +++ b/build-SD.sh @@ -14,7 +14,7 @@ IP=$1 # First argument is the QEMU Raspbian IP address [[ "$FTPPASS" == "" ]] && { - echo -e "\e[1mNo FTPPASS variable found, FTP won't work.\nYou probably want to cancel now" + echo -e "\e[1mNo FTPPASS variable found, FTP won't work.\nYou probably want to cancel now\e[0m" sleep 5 } diff --git a/changelog.md b/changelog.md index d06f0afc..fc9f514a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ -[v0.46.36](https://github.com/nextcloud/nextcloudpi/commit/b071266) (2018-03-03) build: fix systemd dir not existing +[v0.46.37](https://github.com/nextcloud/nextcloudpi/commit/1044dbb) (2018-03-03) nc-automount: fix dependencies + +[v0.46.36](https://github.com/nextcloud/nextcloudpi/commit/33fae1f) (2018-03-03) build: fix systemd dir not existing [v0.46.35](https://github.com/nextcloud/nextcloudpi/commit/6aa39ed) (2018-02-26) ncp-web: add localization (#372) diff --git a/etc/nextcloudpi-config.d/fail2ban.sh b/etc/nextcloudpi-config.d/fail2ban.sh index c3426259..ddb8511d 100644 --- a/etc/nextcloudpi-config.d/fail2ban.sh +++ b/etc/nextcloudpi-config.d/fail2ban.sh @@ -19,10 +19,10 @@ ACTIVE_=no BANTIME_=600 # cooldown time for incorrect passwords -FINDTIME_=600 +FINDTIME_=600 # bad attempts before banning an IP -MAXRETRY_=6 +MAXRETRY_=6 # email to send notifications to EMAIL_=optional@email.com @@ -65,6 +65,10 @@ EOF sed -i 's|Fail2Ban|NextCloudPi|' /etc/fail2ban/action.d/sendmail-whois-lines.conf grep -q actionstart_ "$F" || sed -i 's|actionstart|actionstart_|' "$F" grep -q actionstop_ "$F" || sed -i 's|actionstop|actionstop_|' "$F" + + # delay init because of automount + sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" /lib/systemd/system/fail2ban.service + } configure() diff --git a/etc/nextcloudpi-config.d/nc-automount.sh b/etc/nextcloudpi-config.d/nc-automount.sh index 1d9cbed4..3841e0ab 100644 --- a/etc/nextcloudpi-config.d/nc-automount.sh +++ b/etc/nextcloudpi-config.d/nc-automount.sh @@ -38,7 +38,7 @@ EOF cat > /usr/lib/systemd/system/nc-automount.service <<'EOF' [Unit] Description=Automount USB drives -Before=mysqld.service +Before=mysqld.service dphys-swapfile.service fail2ban.service smbd.service nfs-server.service [Service] Restart=always @@ -51,6 +51,7 @@ EOF cat > /usr/lib/systemd/system/nc-automount-links.service <<'EOF' [Unit] Description=Monitor /media for mountpoints and create USBdrive* symlinks +Before=nc-automount.service [Service] Restart=always @@ -96,11 +97,8 @@ done EOF chmod +x /usr/local/etc/nc-automount-links-mon - # adjust when mariaDB starts - local DBUNIT=/lib/systemd/system/mariadb.service - grep -q sleep $DBUNIT || sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" $DBUNIT - - systemctl daemon-reload + # delay init because of automount + sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" /lib/systemd/system/mariadb.service } configure() diff --git a/etc/nextcloudpi-config.d/nc-ramlogs.sh b/etc/nextcloudpi-config.d/nc-ramlogs.sh index 9459f32d..88b48828 100644 --- a/etc/nextcloudpi-config.d/nc-ramlogs.sh +++ b/etc/nextcloudpi-config.d/nc-ramlogs.sh @@ -41,7 +41,7 @@ EOF [Unit] Description=Populate ramlogs dir Requires=network.target -Before=redis-server apache2 mysqld +Before=redis-server.service apache2.service mysqld.service [Service] ExecStart=/bin/bash /usr/local/bin/ramlog-dirs.sh diff --git a/etc/nextcloudpi-config.d/nc-swapfile.sh b/etc/nextcloudpi-config.d/nc-swapfile.sh index 7587847b..3f2c1670 100644 --- a/etc/nextcloudpi-config.d/nc-swapfile.sh +++ b/etc/nextcloudpi-config.d/nc-swapfile.sh @@ -44,19 +44,22 @@ configure() sed -i "s|#\?CONF_SWAPSIZE=.*|CONF_SWAPSIZE=$SWAPSIZE_|" /etc/dphys-swapfile grep -q vm.swappiness /etc/sysctl.conf || echo "vm.swappiness = 10" >> /etc/sysctl.conf && sysctl --load &>/dev/null - # workaround for automount, systemd doesn't get the order right - grep -q sleep /etc/init.d/dphys-swapfile || sed -i "/\<start)/asleep 15" /etc/init.d/dphys-swapfile - dphys-swapfile setup && dphys-swapfile swapon && { [[ -f "$ORIG" ]] && swapoff "$ORIG" && rm -f "$ORIG" echo "swapfile moved successfully" return 0 } + echo "moving swapfile failed" return 1 } -install() { :; } +install() +{ + # delay init because of automount + sed -i "/\<start)/asleep 30" /etc/init.d/dphys-swapfile +} + # License # @@ -222,6 +222,28 @@ EOF grep -q '^ACTIVE_=yes$' /usr/local/etc/nextcloudpi-config.d/samba.sh || \ update-rc.d nmbd disable + # fix automount dependencies with other ncp-apps + sed -i \ + 's|^Before=.*|Before=mysqld.service dphys-swapfile.service fail2ban.service smbd.service nfs-server.service|' \ + /usr/lib/systemd/system/nc-automount.service + + sed -i \ + 's|^Before=.*|Before=nc-automount.service|' \ + /usr/lib/systemd/system/nc-automount-links.service + + # fix ramlogs dependencies with other ncp-apps + sed -i \ + 's|^Before=.*|Before=redis-server.service apache2.service mysqld.service|' \ + /usr/lib/systemd/system/ramlogs.service + + # adjust when other services start + DBUNIT=/lib/systemd/system/mariadb.service + F2BUNIT=/lib/systemd/system/fail2ban.service + SWPUNIT=/etc/init.d/dphys-swapfile + grep -q sleep "$DBUNIT" || sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" "$DBUNIT" + grep -q sleep "$F2BUNIT" || sed -i "/^ExecStart=/iExecStartPre=/bin/sleep 10" "$F2BUNIT" + grep -q sleep "$SWPUNIT" || sed -i "/\<start)/asleep 30" "$SWPUNIT" + } # end - only live updates exit 0 |