I have the following install script for ubuntu :
#!/bin/bash
sudo apt update
sudo apt full-upgrade -y
sudo apt install jq
sudo apt autoclean -y
sudo apt autoremove
will the following work under fedora, red hat, mageia or other rpm-based distros
...or does the syntax have to change more?
#!/bin/bash
sudo rpm update
sudo rpm full-upgrade -y
sudo rpm install jq
sudo rpm autoclean -y
sudo rpm autoremove
also can I do something to the effect of the following? :
#!/bin/bash
if [ $(command -v yum) ]
then
sudo yum update
sudo yum full-upgrade -y
sudo yum install jq
sudo yum autoclean -y
sudo yum autoremove
else
sudo rpm update
sudo rpm full-upgrade -y
sudo rpm install jq
sudo rpm autoclean -y
sudo rpm autoremove
fi
yum
is used in RHEL up to version 7, CentOS up to version 7, and probably other RPM-based distributions;dnf
is used in Fedora, and RHEL 8 and later. – Stephen Kitt Apr 16 '19 at 15:33apt
, but do not agree on all package names. – allo Apr 17 '19 at 08:09