updated implementation to install aspnetcore-runtime-2.2 from MS package via apt-get. fixed issue with stdout and stdin logging. added logging for tar command.

This commit is contained in:
Shreyas Zare
2019-05-19 01:27:53 +05:30
parent 3bc89c9b7e
commit 1e54029bc6

View File

@@ -1,9 +1,5 @@
#!/bin/sh
aspnetcoreDir="/opt/dotnet"
aspnetcoreTar="/opt/dotnet/aspnetcore-runtime-2.2.4-linux-x64.tar.gz"
aspnetcoreUrl="https://download.visualstudio.microsoft.com/download/pr/61a33dc2-fc56-4bbe-b564-d232172eb210/d8006a719a3bcc65d2937a909623afcb/aspnetcore-runtime-2.2.4-linux-x64.tar.gz"
dnsDir="/etc/dns"
dnsTar="/etc/dns/DnsServerPortable.tar.gz"
dnsUrl="https://download.technitium.com/dns/DnsServerPortable.tar.gz"
@@ -16,38 +12,31 @@ echo ""
echo "==============================="
echo "Technitium DNS Server Installer"
echo "==============================="
echo ""
if [ ! -f /etc/dns/DnsServerApp.dll ]
if [ -f "/usr/bin/dotnet" ]
then
echo ""
echo "Installing dependencies..."
echo ".NET Core Runtime was found installed."
else
echo "Installing .NET Core Runtime..."
until apt-get -y update &>> $installLog && apt-get -y install libunwind8 icu-devtools apt-transport-https &>> $installLog
do
echo "Trying again.."
sleep 2
done
echo ""
if [ ! -f /usr/bin/dotnet ]
if wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -r -s)/packages-microsoft-prod.deb" -O "$dnsDir/packages-microsoft-prod.deb"
then
echo "Downloading .NET Core Runtime..."
mkdir -p $aspnetcoreDir
if wget -q "$aspnetcoreUrl" -O $aspnetcoreTar
then
echo "Installing .NET Core Runtime..."
tar -zxf $aspnetcoreTar -C $aspnetcoreDir
ln -s $aspnetcoreDir/dotnet /usr/bin
echo ".NET Core Runtime was installed succesfully."
else
echo "Failed to download .NET Core Runtime from: $aspnetcoreUrl"
exit 1
fi
dpkg -i "$dnsDir/packages-microsoft-prod.deb">> $installLog 2>&1
add-apt-repository universe >> $installLog 2>&1
until apt-get -y update >> $installLog 2>&1 && apt-get -y install libunwind8 icu-devtools apt-transport-https aspnetcore-runtime-2.2 >> $installLog 2>&1
do
echo "Trying again.."
sleep 2
done
echo ".NET Core Runtime was installed succesfully."
else
echo ".NET Core Runtime was found installed."
echo ""
echo "Failed to install .NET Core Runtime. Please try again."
exit 1
fi
fi
@@ -56,36 +45,36 @@ echo "Downloading Technitium DNS Server..."
if wget -q "$dnsUrl" -O $dnsTar
then
if [ -f /etc/dns/DnsServerApp.dll ]
if [ -f "/etc/dns/DnsServerApp.dll" ]
then
echo "Updating Technitium DNS Server..."
else
echo "Installing Technitium DNS Server..."
fi
tar -zxf $dnsTar -C $dnsDir
tar -zxf $dnsTar -C $dnsDir >> $installLog 2>&1
if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ]
then
if [ -f /etc/systemd/system/dns.service ]
if [ -f "/etc/systemd/system/dns.service" ]
then
echo "Restarting systemd service..."
systemctl restart dns.service &>> $installLog
systemctl restart dns.service >> $installLog 2>&1
else
echo "Configuring systemd service..."
cp $dnsDir/systemd.service /etc/systemd/system/dns.service
systemctl enable dns.service &>> $installLog
systemctl start dns.service &>> $installLog
systemctl enable dns.service >> $installLog 2>&1
systemctl start dns.service >> $installLog 2>&1
fi
else
if [ -f /etc/supervisor/conf.d/dns.conf ]
if [ -f "/etc/supervisor/conf.d/dns.conf" ]
then
echo "Restarting supervisor service..."
service supervisor restart &>> $installLog
service supervisor restart >> $installLog 2>&1
else
echo "Installing supervisor..."
until apt-get -y install supervisor &>> $installLog
until apt-get -y install supervisor >> $installLog 2>&1
do
echo "Trying again.."
sleep 2
@@ -93,7 +82,7 @@ then
echo "Configuring supervisor service..."
cp $dnsDir/supervisor.conf /etc/supervisor/conf.d/dns.conf
service supervisor restart &>> $installLog
service supervisor restart >> $installLog 2>&1
fi
fi