mirror of
https://github.com/gryf/vmstrap.git
synced 2025-12-18 12:00:31 +01:00
Added option to not install any packages.
This commit is contained in:
75
bootstrap.sh
75
bootstrap.sh
@@ -60,7 +60,7 @@ COMMON_DEB=(exuberant-ctags
|
||||
silversearcher-ag)
|
||||
|
||||
|
||||
rpm_based() {
|
||||
function rpm_based {
|
||||
if [[ $DISTRO_ID == 'fedora' ]]; then
|
||||
PGS=(ptpython3
|
||||
python3-apsw
|
||||
@@ -86,6 +86,7 @@ rpm_based() {
|
||||
rxvt-unicode-256color)
|
||||
fi
|
||||
|
||||
if [ "${DONT_INSTALL_PKGS}" != "1" ]; then
|
||||
# 1. update
|
||||
if [[ $DISTRO_ID == 'centos' ]]; then
|
||||
# install epel repository for centos
|
||||
@@ -99,11 +100,7 @@ rpm_based() {
|
||||
# 3. cleanup
|
||||
sudo yum -y clean all
|
||||
|
||||
# 4. set default editor
|
||||
echo 'export VISUAL="vim"' | sudo tee /etc/profile.d/vim.sh
|
||||
echo 'export EDITOR="vim"' | sudo tee -a /etc/profile.d/vim.sh
|
||||
|
||||
# 5. install tools from pypi
|
||||
# 4. install tools from pypi
|
||||
if [[ $DISTRO_ID == 'fedora' ]]; then
|
||||
sudo pip install -U pip setuptools
|
||||
installed_pkgs=$(pip list)
|
||||
@@ -132,12 +129,17 @@ rpm_based() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
# 5. set default editor
|
||||
echo 'export VISUAL="vim"' | sudo tee /etc/profile.d/vim.sh
|
||||
echo 'export EDITOR="vim"' | sudo tee -a /etc/profile.d/vim.sh
|
||||
|
||||
# 6. copy configuration for bash, git, tmux
|
||||
common_conf
|
||||
}
|
||||
|
||||
ubuntu() {
|
||||
function ubuntu {
|
||||
case $DISTRO_R in
|
||||
'16.04')
|
||||
PGS=(ipython
|
||||
@@ -172,6 +174,8 @@ ubuntu() {
|
||||
# linux-image-virtual linux-virtual cryptsetup-initramfs \
|
||||
# busybox-initramfs cloud-init initramfs-tools
|
||||
|
||||
if [ "${DONT_INSTALL_PKGS}" != "1" ]; then
|
||||
|
||||
# 1. update
|
||||
sudo apt update && sudo apt -y upgrade
|
||||
|
||||
@@ -181,10 +185,7 @@ ubuntu() {
|
||||
# 3. cleanup
|
||||
sudo apt-get autoremove -y && sudo apt-get autoclean -y
|
||||
|
||||
# 4. change alternatives
|
||||
sudo update-alternatives --set editor /usr/bin/vim.basic
|
||||
|
||||
# 5.
|
||||
# 4.
|
||||
case $DISTRO_R in
|
||||
'16.04')
|
||||
sudo pip install pip --upgrade
|
||||
@@ -208,13 +209,20 @@ ubuntu() {
|
||||
sudo pip3 install remote_pdb rainbow pdbpp
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# 5. change alternatives
|
||||
sudo update-alternatives --set editor /usr/bin/vim.basic
|
||||
|
||||
# 6. copy configuration for bash, git, tmux
|
||||
common_conf
|
||||
}
|
||||
|
||||
tmux_conf() {
|
||||
function tmux_conf {
|
||||
tmux_ver=$(tmux -V|cut -f 2 -d ' ')
|
||||
if [ -z "${tmux_ver}" ]; then
|
||||
return
|
||||
fi
|
||||
major=${tmux_ver%.*}
|
||||
minor=${tmux_ver#*.}
|
||||
|
||||
@@ -269,9 +277,10 @@ tmux_conf() {
|
||||
fi
|
||||
}
|
||||
|
||||
common_conf() {
|
||||
function common_conf {
|
||||
cp "${DIR}/.bash_prompt" ~/
|
||||
cp "${DIR}/.tmux.conf" ~/
|
||||
|
||||
tmux_conf
|
||||
|
||||
cp "${DIR}/.gitconfig" ~/
|
||||
@@ -299,10 +308,6 @@ common_conf() {
|
||||
popd
|
||||
fi
|
||||
|
||||
# clone devstack
|
||||
git clone https://opendev.org/openstack/devstack ~/devstack
|
||||
cp "${DIR}/kuryr.conf" ~/devstack/local.conf
|
||||
|
||||
# get k9s
|
||||
wget "https://github.com/derailed/k9s/releases/download/"`
|
||||
`"v0.24.7/k9s_Linux_x86_64.tar.gz"
|
||||
@@ -310,7 +315,17 @@ common_conf() {
|
||||
rm k9s_Linux_x86_64.tar.gz
|
||||
}
|
||||
|
||||
case $DISTRO_ID in
|
||||
function _showusage {
|
||||
echo "Usage: $(basename $1) [OPTIONS]"
|
||||
echo "Configure system and optionally install a set of packages."
|
||||
echo
|
||||
echo Where OPTIONS are:
|
||||
echo " -h This help."
|
||||
echo " -c Do the config only, don't install anything"
|
||||
}
|
||||
|
||||
function main {
|
||||
case $DISTRO_ID in
|
||||
"ubuntu")
|
||||
ubuntu
|
||||
;;
|
||||
@@ -323,4 +338,26 @@ case $DISTRO_ID in
|
||||
*)
|
||||
echo "Distribution ${DISTRO_ID} not supported"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
# react on -h or --help
|
||||
while getopts ":heicbdgvxsauzr" optchar; do
|
||||
case "${optchar}" in
|
||||
h)
|
||||
_showusage "$0"
|
||||
exit 0
|
||||
;;
|
||||
c)
|
||||
DONT_INSTALL_PKGS=1
|
||||
;;
|
||||
*)
|
||||
echo Invalid argument "$1"
|
||||
_showusage "$0"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
main
|
||||
|
||||
Reference in New Issue
Block a user