echo"*** This installer is only for $thisinstallerdistro and you are running $DistroBasedOn, please run \"$gitreporoot\install-powershell.sh\" to see if your distro is supported AND to auto-select the appropriate installer if it is."
exit0
fi
## Check requirements and prerequisites
#Only do SUDO if we are not root
SUDO=''
if(($EUID !=0));then
SUDO='sudo'
fi
#Check that sudo is available
if[["$SUDO" -eq "sudo"]];then
$SUDO -v
if[$? -ne 0];then
echo"ERROR: You must either be root or be able to use sudo" >&2
exit5
fi
fi
#Collect any variation details if required for this distro
REV=`cat /etc/SuSE-release | grep 'VERSION'| sed s/.*=\ //`
MAJORREV=`echo$REV| sed 's/\..*//'`
#END Collect any variation details if required for this distro
#If there are known incompatible versions of this distro, put the test, message and script exit here:
if[[$MAJORREV < 42]];then
echo"OpenSUSE $VERSION_ID is not supported!" >&2
exit2
fi
#END Verify The Installer Choice
##END Check requirements and prerequisites
echo
echo"*** Installing PowerShell Core for $DistroBasedOn..."
if ! hash curl 2>/dev/null;then
echo"curl not found, installing..."
$SUDO zypper install -y curl
fi
release=`curl https://api.github.com/repos/powershell/powershell/releases/latest | sed '/tag_name/!d'| sed s/\"tag_name\"://g | sed s/\"//g | sed s/v//g | sed s/,//g | sed s/\ //g`
#REPO BASED (Not ready yet)
#echo "*** Setting up PowerShell Core repo..."
#echo "*** Current version on git is: $release, repo version may differ slightly..."
## Install the Microsoft public key so that zypper trusts the package
powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"'
success=$?
if[["$success" !=0]];then
echo"ERROR: PowerShell failed to install!" >&2
exit"$success"
fi
if[["'$*'"=~ includeide ]];then
echo
echo"*** Installing VS Code PowerShell IDE..."
echo"*** Setting up VS Code repo..."
$SUDO sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/zypp/repos.d/vscode.repo'