1
0
mirror of https://github.com/gryf/vmstrap.git synced 2025-12-19 12:28:21 +01:00

Merge fedora and centos installation, since they are very similar

This commit is contained in:
2020-05-15 19:22:08 +02:00
parent 789e1f383b
commit 6091e15acd

View File

@@ -57,72 +57,41 @@ COMMON_DEB=(exuberant-ctags
python3-jedi python3-jedi
silversearcher-ag) silversearcher-ag)
centos7() {
# 1. update
sudo yum -y install epel-release
sudo yum -y update
# rxvt-unicode-256color to have proper terminfo rpm_based() {
PGS=(ptpython2 if [[ $DISTRO_ID == 'fedora' ]]; then
python-devel PGS=(ptpython3
python-flake8 python2
python-ipython-console python2-devel
python-pip python2-pip
python2-apsw python3-apsw
python2-jedi python3-flake8
python2-mccabe python3-ipython
python2-pip python3-jedi
python34-apsw python3-mccabe
python36-jedi python3-pylint)
python36-mccabe) elif [[ $DISTRO_ID == 'centos' ]]; then
PGS=(ptpython2
# 2. install tools python-devel
sudo yum install -y "${COMMON_PGS[@]}" "${COMMON_RPM[@]}" "${PGS[@]}" python-flake8
python-ipython-console
# 3. cleanup python-pip
sudo yum -y clean all python2-apsw
python2-jedi
# 4. set default editor python2-mccabe
echo 'export visual="vim"' | sudo tee /etc/profile.d/vim.sh python2-pip
echo 'export editor="vim"' | sudo tee -a /etc/profile.d/vim.sh python34-apsw
python36-jedi
# 5. install tools from pypi (only py3, no more latest setuptools for py2) python36-mccabe)
sudo pip3 install -u pip setuptools
installed_pkgs=$(pip list)
if echo "${installed_pkgs}" | grep -qv "rainbow"; then
sudo pip install rainbow
sudo pip3 install rainbow
fi fi
installed_pkgs=$(pip3 list)
for pkg in remote_pdb pdbpp; do
if echo "${installed_pkgs}" | grep -qv "${pkg}"; then
sudo pip3 install ${pkg}
fi
done
# 6. copy configuration for bash, git, tmux
common_conf
}
fedora() {
# fedora 31
# 1. update # 1. update
if [[ $DISTRO_ID == 'centos' ]]; then
# install epel repository for centos
sudo yum -y install epel-release
fi
sudo yum -y update sudo yum -y update
# rxvt-unicode-256color to have proper terminfo
PGS=(ptpython3
python2
python2-devel
python2-pip
python3-apsw
python3-flake8
python3-ipython
python3-jedi
python3-mccabe
python3-pylint)
# 2. install tools # 2. install tools
sudo yum install -y "${COMMON_PGS[@]}" "${COMMON_RPM[@]}" "${PGS[@]}" sudo yum install -y "${COMMON_PGS[@]}" "${COMMON_RPM[@]}" "${PGS[@]}"
@@ -133,19 +102,34 @@ fedora() {
echo 'export VISUAL="vim"' | sudo tee /etc/profile.d/vim.sh echo 'export VISUAL="vim"' | sudo tee /etc/profile.d/vim.sh
echo 'export EDITOR="vim"' | sudo tee -a /etc/profile.d/vim.sh echo 'export EDITOR="vim"' | sudo tee -a /etc/profile.d/vim.sh
# 5. install tools from pypi # 5. install tools from pypi
sudo pip install -U pip setuptools if [[ $DISTRO_ID == 'fedora' ]]; then
installed_pkgs=$(pip list) sudo pip install -U pip setuptools
pkgs_to_install= installed_pkgs=$(pip list)
for pkg in remote_pdb pdbpp rainbow; do pkgs_to_install=
if echo "${installed_pkgs}" | grep -qv "${pkg}"; then for pkg in remote_pdb pdbpp rainbow; do
pkgs_to_install="${pkgs_to_install} ${pkg}" if echo "${installed_pkgs}" | grep -qv "${pkg}"; then
fi pkgs_to_install="${pkgs_to_install} ${pkg}"
done fi
done
if [ -n "${pkgs_to_install}" ]; then if [ -n "${pkgs_to_install}" ]; then
sudo pip install ${pkgs_to_install} sudo pip install ${pkgs_to_install}
fi
elif [[ $DISTRO_ID == 'centos' ]]; then
sudo pip3 install -u pip setuptools
installed_pkgs=$(pip list)
if echo "${installed_pkgs}" | grep -qv "rainbow"; then
sudo pip install rainbow
sudo pip3 install rainbow
fi
installed_pkgs=$(pip3 list)
for pkg in remote_pdb pdbpp; do
if echo "${installed_pkgs}" | grep -qv "${pkg}"; then
sudo pip3 install ${pkg}
fi
done
fi fi
# 6. copy configuration for bash, git, tmux # 6. copy configuration for bash, git, tmux
@@ -239,12 +223,12 @@ case $DISTRO_ID in
ubuntu ubuntu
;; ;;
"centos") "centos")
centos7 rpm_based
;; ;;
"fedora") "fedora") # Fedora 31
fedora rpm_based
;; ;;
*) *)
echo Distribution ${DISTRO_ID} not supported echo "Distribution ${DISTRO_ID} not supported"
;; ;;
esac esac