#!/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
}

exit 0
