zfs-auto-snapshot needs multiverse (#721)

This commit is contained in:
Daniel Hansson 2018-11-24 21:29:48 +01:00 committed by GitHub
parent f00f45bf9a
commit bef42ca800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 6 deletions

20
lib.sh
View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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_