43 lines
1.6 KiB
Bash
43 lines
1.6 KiB
Bash
#Set repo
|
|
mrepo=https://git.ictmaatwerk.com/VPS-scripts/Unattended-Security-Updates
|
|
mbranch=master
|
|
|
|
#OS Detection if not provided by external installer
|
|
if [ -z ${shortdist+x} ]; then
|
|
dist_ver=$(grep --color=never -Po "^VERSION_ID=\K.*" "/etc/os-release")
|
|
dist=$(grep --color=never -Po "^ID=\K.*" "/etc/os-release")
|
|
|
|
if [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"18.04"* ]]; then
|
|
shortdist=ubu1804
|
|
echo set
|
|
elif [[ "${dist}" == *"ubuntu"* ]] && [[ "${dist_ver}" == *"20.04"* ]]; then
|
|
shortdist=ubu2004
|
|
echo set
|
|
elif [[ "${dist}" == *"debian"* ]] && [[ "${dist_ver}" == *"10"* ]]; then
|
|
shortdist=deb10
|
|
echo set
|
|
elif [[ "${dist}" == *"centos"* ]] && [[ "${dist_ver}" == *"8"* ]]; then
|
|
shortdist=cent8
|
|
echo set
|
|
else
|
|
echo "This os in not supported"
|
|
fi
|
|
fi
|
|
|
|
#OS Handeler
|
|
|
|
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
|
##Setting Configname
|
|
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] ; then
|
|
LinVer=Ubuntu
|
|
elif [ "$shortdist" = "deb10" ]; then
|
|
LinVer=Debian
|
|
fi
|
|
|
|
##Fetching Confgs
|
|
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/apt/Universal_20auto-upgrades -o /etc/apt/apt.conf.d/20auto-upgrades > $OUTPUT 2>&1
|
|
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/apt/"$LinVer"_50unattended-upgrades -o /etc/apt/apt.conf.d/50unattended-upgrades > $OUTPUT 2>&1
|
|
elif [ "$shortdist" = "cent8" ]; then
|
|
##Fetching Confgs
|
|
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/dnf/Cent8_automatic.conf -o /etc/dnf/automatic.conf > $OUTPUT 2>&1
|
|
fi |