diff --git a/bin/ncp-diag b/bin/ncp-diag old mode 100755 new mode 100644 index e58afe72..e3f3b99b --- a/bin/ncp-diag +++ b/bin/ncp-diag @@ -32,10 +32,12 @@ echo "datadir|$DATADIR$DIRINFO" echo "data disk usage|$( df -h "$DATADIR" | tail -1 | awk '{ print $3"/"$2 }')" } echo "rootfs usage|$( df -h / | tail -1 | awk '{ print $3"/"$2 }')" -echo "swapfile|$( swapon | tail -1 | awk '{ print $1 }' )" +SWP="$( swapon | tail -1 | awk '{ print $1 }' )" +[[ "$SWP" == "" ]] && SWP="none" +echo "swapfile|$SWP" # Nextcloud -VERSION="$( sudo -u www-data php /var/www/nextcloud/occ status | grep "version:" | awk '{ print $3 }' )" +VERSION="$( php /var/www/nextcloud/occ status | grep "version:" | awk '{ print $3 }' )" if [[ "$VERSION" != "" ]]; then echo "Nextcloud check|ok" echo "Nextcloud version|$VERSION" @@ -75,13 +77,10 @@ echo "gateway|$GW" echo "interface|$IFACE" # Certificates -LEOUT="$( /etc/letsencrypt/letsencrypt-auto certificates 2>/dev/null )" -CERTS="$( echo -e "$LEOUT" | grep "Domains:" | awk '{ print $2 }' | tr '\n' ' ' )" -CDUE="$( echo -e "$LEOUT" | grep "VALID:" | grep -oP "\d+ days" | tr '\n' ' ' )" +CERTS="$( grep "SSLCertificateFile /etc/letsencrypt/live/" /etc/apache2/sites-available/nextcloud.conf \ + | sed 's|.*SSLCertificateFile /etc/letsencrypt/live/||;s|/fullchain.pem||' )" [[ "$CERTS" == "" ]] && CERTS=none -[[ "$CDUE" == "" ]] && CDUE=none echo "certificates|$CERTS" -echo "certs due|$CDUE" RESOLV="$( ping -c 1 "$CERTS" 2>/dev/null | head -1 | grep -oP '\d{1,3}(.\d{1,3}){3}' )" echo "NAT loopback|$( [[ "$RESOLV" == "$IP" ]] && echo yes || echo no )" diff --git a/bin/ncp-report b/bin/ncp-report index 5b11ee0f..0556423b 100755 --- a/bin/ncp-report +++ b/bin/ncp-report @@ -39,7 +39,7 @@ echo "<--! Paste this in GitHub report -->" ## open_summary "NextCloudPi diagnostics" -ncp-diag | column -t -s'|' +bash /usr/local/bin/ncp-diag | column -t -s'|' close_summary ## diff --git a/bin/ncp-suggestions b/bin/ncp-suggestions new file mode 100644 index 00000000..0b7b0da3 --- /dev/null +++ b/bin/ncp-suggestions @@ -0,0 +1,38 @@ +#!/bin/bash + +# +# NextCloudPi configuration suggestions +# +# Copyleft 2018 by Ignacio Nunez Hernanz +# GPL licensed (see end of file) * Use at your own risk! +# +# Usage: +# sudo ncp-suggestions "$( ncp-diag )" +# +# More at https://ownyourbits.com +# + +OUT="$@" + +DNSMASQ_ON="$( grep "^ACTIVE_=" /usr/local/etc/nextcloudpi-config.d/dnsmasq.sh | cut -d'=' -f2 )" + +grep -q "distribution|.*bian GNU/Linux 9" <<<"$OUT" || \ + echo -e "You are using an unsupported distro release. Please upgrade to latest Debian/Raspbian" + +[[ $DNSMASQ_ON != "yes" ]] && \ + grep -q "NAT loopback|no" <<<"$OUT" && \ + echo -e "\nYou should enable dnsmasq to use your domain inside home" + +grep -q "certificates|none" <<<"$OUT" && \ + echo -e "\nYou should run Lets Encrypt for trusted encrypted access" + +grep -q "port check .*|closed" <<<"$OUT" && \ + echo -e "\nYou should open your ports for Lets Encrypt and external access" + +grep -q "USB devices|none" <<<"$OUT" || { + grep -q "data in SD|yes" <<<"$OUT" && \ + echo -e "\nYou should use nc-datadir to move your files to your plugged in USB drive" + + grep -q "automount|no" <<<"$OUT" && \ + echo -e "\nYou should enable automount to use your plugged in USB drive" +} diff --git a/changelog.md b/changelog.md index 4dbc2e06..e8a0b4f7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,11 @@ -[v0.53.8](https://github.com/nextcloud/nextcloudpi/commit/cc733af) (2018-04-02) ncp-web: fix update notification +[v0.53.10](https://github.com/nextcloud/nextcloudpi/commit/dce58cc) (2018-04-03) ncp-web: implement dashboard -[v0.53.7](https://github.com/nextcloud/nextcloudpi/commit/d4ca26a) (2018-03-29) ncp-web: use random passwords for NC and ncp-web +[v0.53.9](https://github.com/nextcloud/nextcloudpi/commit/486d6ef) (2018-04-02) SSH: stop service upon activation + +[v0.53.8 ](https://github.com/nextcloud/nextcloudpi/commit/afd2c8e) (2018-04-02) ncp-web: fix update notification + +[v0.53.7 ](https://github.com/nextcloud/nextcloudpi/commit/d4ca26a) (2018-03-29) ncp-web: use random passwords for NC and ncp-web [v0.53.6 ](https://github.com/nextcloud/nextcloudpi/commit/151160b) (2018-03-27) samba: dont force NAME_REGEX for username diff --git a/etc/nextcloudpi-config.d/nc-info.sh b/etc/nextcloudpi-config.d/nc-info.sh index 8ff1bc69..33ffb05b 100644 --- a/etc/nextcloudpi-config.d/nc-info.sh +++ b/etc/nextcloudpi-config.d/nc-info.sh @@ -7,7 +7,7 @@ # # Usage: # -# ./installer.sh nc-diag.sh () +# ./installer.sh nc-info.sh () # # See installer.sh instructions for details # More at: https://ownyourbits.com @@ -17,36 +17,16 @@ DESCRIPTION="Print NextCloudPi system info" configure() { - # info - - local OUT="$( ncp-diag )" echo "Gathering information..." + local OUT="$( bash /usr/local/bin/ncp-diag )" + + # info echo "$OUT" | column -t -s'|' # suggestions - - DNSMASQ_ON="$( grep "^ACTIVE_=" /usr/local/etc/nextcloudpi-config.d/dnsmasq.sh | cut -d'=' -f2 )" - - grep -q "distribution|.*bian GNU/Linux 9" <<<"$OUT" || \ - echo -e "\nYou are using an unsupported distro release. Please upgrade to latest Debian/Raspbian" - - [[ $DNSMASQ_ON != "yes" ]] && \ - grep -q "NAT loopback|no" <<<"$OUT" && \ - echo -e "\nYou should enable dnsmasq to use your domain inside home" - - grep -q "certificates|none" <<<"$OUT" && \ - echo -e "\nYou should run Lets Encrypt for trusted encrypted access" - - grep -q "port check .*|closed" <<<"$OUT" && \ - echo -e "\nYou should open your ports for Lets Encrypt and external access" - - grep -q "USB devices|none" <<<"$OUT" || { - grep -q "data in SD|yes" <<<"$OUT" && \ - echo -e "\nYou should use nc-datadir to move your files to your plugged in USB drive" - - grep -q "automount|no" <<<"$OUT" && \ - echo -e "\nYou should enable automount to uyyse your plugged in USB drive" - } + echo + bash /usr/local/bin/ncp-suggestions "$OUT" + return 0 } @@ -68,4 +48,3 @@ install() { :; } # along with this script; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA - diff --git a/ncp-web/img/dashboard.svg b/ncp-web/img/dashboard.svg new file mode 100644 index 00000000..294f2018 --- /dev/null +++ b/ncp-web/img/dashboard.svg @@ -0,0 +1,65 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/ncp-web/index.php b/ncp-web/index.php index aa6ed315..2f1696ff 100644 --- a/ncp-web/index.php +++ b/ncp-web/index.php @@ -111,6 +111,11 @@ HTML;
+
+
+
+
+
-

__("Configure NextCloudPi features"); ?>

- -
-
-
-
-