From bef42ca800ea134b4eabde9c22775b8a9badeb6b Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Sat, 24 Nov 2018 21:29:48 +0100 Subject: [PATCH] zfs-auto-snapshot needs multiverse (#721) --- lib.sh | 20 ++++++++++++++------ nextcloud_install_production.sh | 1 + nextcloud_update.sh | 1 + static/format-sdb.sh | 4 ++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib.sh b/lib.sh index b020009b..bb3ea3d6 100644 --- a/lib.sh +++ b/lib.sh @@ -17,7 +17,6 @@ RORDIR=/opt/es/ # Ubuntu OS DISTRO=$(lsb_release -sd | cut -d ' ' -f 2) -UNIV=$(apt-cache policy | grep http | awk '{print $3}' | grep universe | head -n 1 | cut -d "/" -f 2) # Network [ ! -z "$FIRST_IFACE" ] && IFACE=$(lshw -c network | grep "logical name" | awk '{print $3; exit}') IFACE2=$(ip -o link show | awk '{print $2,$9}' | grep 'UP' | cut -d ':' -f 1) @@ -747,12 +746,21 @@ fi # Check universe reposiroty check_universe() { -if [ "$UNIV" = "universe" ] +UNIV=$(apt-cache policy | grep http | awk '{print $3}' | grep universe | head -n 1 | cut -d "/" -f 2) +if [ "$UNIV" != "universe" ] then - echo "Seems that required repositories are ok." -else - echo "Adding required repo (universe)." - add-apt-repository universe + echo "Adding required repo (universe)." + add-apt-repository universe +fi +} + +# Check universe reposiroty +check_multiverse() { +MULTIV=$(apt-cache policy | grep http | awk '{print $3}' | grep multiverse | head -n 1 | cut -d "/" -f 2) +if [ "$MULTIV" != "multiverse" ] +then + echo "Adding required repo (multiverse)." + add-apt-repository multiverse fi } diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index 67ee262f..e6739577 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -73,6 +73,7 @@ rm $SCRIPTS/adduser.sh # Check distrobution and version check_distro_version check_universe +check_multiverse # Check if key is available if ! wget -q -T 10 -t 2 "$NCREPO" > /dev/null diff --git a/nextcloud_update.sh b/nextcloud_update.sh index 2b9a92f1..4d98a596 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -271,6 +271,7 @@ if dpkg -l | grep libzfs2linux then if grep -r ncdata /etc/mtab then + check_multiverse install_if_not zfs-auto-snapshot sed -i "s|date --utc|date|g" /usr/sbin/zfs-auto-snapshot check_command zfs-auto-snapshot -r ncdata diff --git a/static/format-sdb.sh b/static/format-sdb.sh index 69d32c9e..8342f88b 100644 --- a/static/format-sdb.sh +++ b/static/format-sdb.sh @@ -10,6 +10,10 @@ true # Check if root root_check +# Needs to be Ubuntu 18.04 and Multiverse +check_distro_version +check_multiverse + LABEL_=ncdata MOUNT_=/mnt/$LABEL_