diff --git a/batch.sh b/batch.sh index 08c2874e7..db57b76b0 100755 --- a/batch.sh +++ b/batch.sh @@ -5,13 +5,11 @@ # Copyleft 2017 by Ignacio Nunez Hernanz # GPL licensed (see end of file) * Use at your own risk! # -# Usage: ./batch.sh +# Usage: ./batch.sh # set -e -IP=${1:-192.168.0.145} # For QEMU automated testing - ## BUILDING source buildlib.sh # initializes $IMGNAME @@ -21,7 +19,7 @@ source buildlib.sh # initializes $IMGNAME } # Raspbian -./build-SD-rpi.sh "$IP" +./build-SD-rpi.sh IMG="$( ls -1t tmp/*.img | head -1 )" ./build-SD-berryboot.sh "$IMG" @@ -29,6 +27,7 @@ IMG="$( ls -1t tmp/*.img | head -1 )" ./build-SD-armbian.sh odroidxu4 OdroidHC2 ./build-SD-armbian.sh rock64 Rock64 ./build-SD-armbian.sh bananapi Bananapi +./build-SD-armbian.sh orangepizeroplus2-h5 OrangePiZeroPlus2 # VM ./build-VM.sh diff --git a/build-SD-rpi.sh b/build-SD-rpi.sh index c4e923bb2..6dcb5bea2 100755 --- a/build-SD-rpi.sh +++ b/build-SD-rpi.sh @@ -11,7 +11,6 @@ set -e source buildlib.sh -IP=${1:-192.168.0.145} # For QEMU automated testing (optional) SIZE=3G # Raspbian image size #CLEAN=0 # Pass this envvar to skip cleaning download cache IMG="NextCloudPi_RPi_$( date "+%m-%d-%y" ).img" diff --git a/changelog.md b/changelog.md index da6bf688f..be25162ce 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ -[v0.64.12](https://github.com/nextcloud/nextcloudpi/commit/293c2c7) (2018-11-03) docker: fix provisioning on a stopped the container +[v0.65.0](https://github.com/nextcloud/nextcloudpi/commit/2f56f2c) (2018-11-03) add nc-test-hdd + +[v0.64.12](https://github.com/nextcloud/nextcloudpi/commit/5e7f3da) (2018-11-03) docker: fix provisioning on a stopped the container [v0.64.11](https://github.com/nextcloud/nextcloudpi/commit/1758331) (2018-10-27) check for path transversal diff --git a/etc/ncp-config.d/nc-hdd-test.sh b/etc/ncp-config.d/nc-hdd-test.sh new file mode 100644 index 000000000..1384fcae2 --- /dev/null +++ b/etc/ncp-config.d/nc-hdd-test.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Check HDD health +# +# Copyleft 2018 by Ignacio Nunez Hernanz +# GPL licensed (see end of file) * Use at your own risk! +# +# More at https://ownyourbits.com +# + +SHORTTEST_=yes +LONGTEST_=no +DESCRIPTION="Check HDD health" + +INFO="Running no test will display test results" + +install() +{ + apt-get update + apt-get install --no-install-recommends -y smartmontools + systemctl disable smartd + systemctl stop smartd +} + +configure() +{ + local DRIVES=($(lsblk -ln | grep "^sd[[:alpha:]].*disk" | awk '{ print $1 }')) + + [[ ${#DRIVES[@]} == 0 ]] && { + echo "no drives detected. Abort" + return 0 + } + + for dr in "${DRIVES[@]}"; do + smartctl --smart=on /dev/${dr} | sed 1,2d + if [[ "$SHORTTEST_" == yes ]]; then + echo "* Starting test on $dr. Check results later" + smartctl -X "/dev/$dr" &>/dev/null + smartctl -t short "/dev/$dr" | sed 1,2d + elif [[ "$LONGTEST_" == yes ]]; then + echo "* Starting test on $dr. Check results later" + smartctl -X "/dev/$dr" &>/dev/null + smartctl -t long "/dev/$dr" | sed 1,2d + else + echo "* Test results for $dr" + smartctl -l selftest "/dev/$dr" | sed 1,2d + + echo "* Health Check for $dr" + smartctl -H "/dev/$dr" | sed 1,2d + + echo "* Stats for $dr" + smartctl -A "/dev/$dr" | sed 1,2d + fi + done +} + +# License +# +# This script is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this script; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA