mirror of
https://github.com/gryf/vmstrap.git
synced 2025-12-18 20:10:28 +01:00
Merge fedora and centos installation, since they are very similar
This commit is contained in:
140
bootstrap.sh
140
bootstrap.sh
@@ -21,7 +21,7 @@ else
|
|||||||
# CentOS Linux release 7.6.1810 (Core)
|
# CentOS Linux release 7.6.1810 (Core)
|
||||||
# We want only major, here: 7
|
# We want only major, here: 7
|
||||||
DISTRO_R=$(cut -f 4 -d ' ' /etc/redhat-release | cut -f 1 -d '.')
|
DISTRO_R=$(cut -f 4 -d ' ' /etc/redhat-release | cut -f 1 -d '.')
|
||||||
elif [[ $DISTRO_ID =~ fedora ]]; then
|
elif [[ $DISTRO_ID =~ fedora ]]; then
|
||||||
# Fedora release 32 (Thirty Two)
|
# Fedora release 32 (Thirty Two)
|
||||||
DISTRO_R=$(cut -f 3 -d ' ' /etc/redhat-release)
|
DISTRO_R=$(cut -f 3 -d ' ' /etc/redhat-release)
|
||||||
fi
|
fi
|
||||||
@@ -29,7 +29,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
COMMON_PGS=(ccze
|
COMMON_PGS=(ccze
|
||||||
git-review
|
git-review
|
||||||
htop
|
htop
|
||||||
jq
|
jq
|
||||||
mc
|
mc
|
||||||
@@ -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
|
||||||
@@ -223,7 +207,7 @@ common_conf() {
|
|||||||
# showmarks is a stubborn one
|
# showmarks is a stubborn one
|
||||||
mkdir ~/.vim/bundle/ShowMarks/doc
|
mkdir ~/.vim/bundle/ShowMarks/doc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make current user sudo passwordless
|
# make current user sudo passwordless
|
||||||
#if [ -z "$(sudo grep "${USER}" /etc/sudoers)" ]; then
|
#if [ -z "$(sudo grep "${USER}" /etc/sudoers)" ]; then
|
||||||
# echo "${USER} ALL = (ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
|
# echo "${USER} ALL = (ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user