Closed Mirppc closed 6 years ago
Looking at the code it seems this is the trickiest bit for me, how to modify this for a third option.
function azCliCheck { rpm -qa 'release' > /dev/null 2>&1 if [ $? -eq 0 ]; then rpmAzInstall else installAzCli fi
Got most of the SUSE specific stuff done. Let me know how it looks.
https://github.com/Mirppc/pwshcore/blob/Mirppc-suse-pwrsh/install.sh
added some independed SUSE and OpenSUSE Leap install scripts here under the folders sles11, sles12 and opensuse_leap using modified versions of the ubuntu 17.04 script
Great. I have added minimal support for OpenSUSE 42 into my script and have a function call for AzCLI to install on anything with a Zypper pkg manager. I just need to add a check in for the script to default to that function if it detects a Zypper system - the same way I did the RPM check. I'll try to get my updates posted tomorrow. If you can test, and the tests clear on your end, I'll add in the other versions of SUSE, too.
you might want to take a look at this script. i ran into issue #5 when testing it https://github.com/Mirppc/pwshcore/blob/Mirppc-patch-1-suse/suse/install.sh
A check might be to do something similar to this `declare -A osInfo; osInfo[/etc/redhat-release]=yum osInfo[/etc/arch-release]=pacman osInfo[/etc/gentoo-release]=emerge osInfo[/etc/SuSE-release]=zypp osInfo[/etc/debian_version]=apt-get
for f in ${!osInfo[@]} do if [[ -f $f ]];then echo Package manager: ${osInfo[$f]} fi done`
Found this via Stackflow. Source: https://unix.stackexchange.com/questions/46081/identifying-the-system-package-manager
It can be manipulated as i have done that to trick some HP software into thinking i am running RedHat 4 when in fact i was running OpenSuse 13.2.
since you are supporting only what has repositories available via Microsoft this can be limited even more via apt/apt-get for debian/ubuntu variants, yum for redhat and derivatives, zypp/zypper for SUSE and Opensuse. Homebrew for the mac would be an equivalent ~_0
Updated master install script to ensure azCliCheck function is scalable as more distro support is added. Suse script with whiptail is in the dev branch, but whiptail is not yet supported on Suse. Until then, Suse all in one install script can be run via the following (beta) command:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/jldeen/pwshcore/dev/SUSE/install.sh)"
I am working on splicing in the abilityt to have SLES 11/2 and OpenSUSE Leap support and i got the main repo for the powershell core setup and will be posting that when i get it cleaned up.
Not sure how to deal with the azurecli install though.
for example the current code looks like this for RedHat and the derivatives therein.
old
function rpmAzInstall { { for ((i=0; i<=100; i+=20)); do
sudo -S - auth sudo in advance
This is what the SUSE (both SLES+OpenSUSE) should somewhat look like though it might be possible to clean it up more by using the package manager to add the repo file.
new
function rpmAzInstall { { for ((i=0; i<=100; i+=20)); do
sudo -S - auth sudo in advance
Really not too sure how to differentiate the Redhat RPM install of Azurecli verses the SUSE one. Any suggestions would be appreciated.
On another note for adding a .repo you could just do the following.
zypper ar https://packages.microsoft.com/config/sles/12/prod.repo microsoft
zypper == package manager for SUSE ar == Add Repository https://your.url/something/something/something.repo == the url to the .repo file being imported microsoft == the alias of the repository or name. if you add one for azure then add an alias dnoting that that is an azure repo.
Will post more once the weather here in Ventura clears up enough that i dont have to wear a half face gas mask to breathe.
you can always find me on irc.freenode.net in #suse or #damnsmalllinux