#!/bin/bash



whoami | grep root || {
    echo "Error, should be launched as root"
    exit 1
}

nslookup repository.uncom.tech || {
    echo "Error, can't find uncom server"
    exit 2
}

# && - because fuser returns 0 if there is a lock
fuser /var/lib/dpkg/lock && {
    echo "Error, apt is locked"
    exit 3
}

apt list --installed 2>&1 | grep "linux-image-unsigned-6.8" && {
    echo "New kernel already installed"
    exit 4
}

apt list --installed 2>&1 | grep " i386 " && {
    echo "i386 packages installed"
    exit 5
}


exit 0
