Move around and rename things

This commit is contained in:
flyingscorpio@pinebook-pro 2020-04-14 09:42:32 +02:00
parent 347e9add0f
commit 5ebc4fd6c4

View file

@ -2,19 +2,18 @@
## flyingscorpio
## Script to automate the setting up of my working environment.
## Uncomment the function calls you wish to run.
## Uncomment the function calls in MAIN you wish to run.
# Set up {{{
# 1. Set up {{{
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
ORANGE=$(tput setaf 3)
NC=$(tput sgr0)
export RED
GREEN=$(tput setaf 2)
export GREEN
ORANGE=$(tput setaf 3)
export ORANGE
NC=$(tput sgr0)
export NC
BASE_DIR="$PWD"
@ -36,7 +35,7 @@ separator() {
# }}}
# Define OS {{{
# 2. Define OS {{{
OS='none'
@ -74,7 +73,7 @@ export OS
# }}}
# Handle args {{{
# 3. Handle args {{{
OVERWRITE='false'
UPDATE='false'
@ -120,6 +119,61 @@ export UPDATE
# }}}
# FUNCTIONS:
clone_projects() { # {{{
# Clone projects
echo "Cloning projects..."
/bin/bash "$BASE_DIR"/installation_scripts/clone_projects.sh
separator
} # }}}
configure_git() { # {{{
# Configure Git
echo "Configuring Git..."
git config --global user.name "$USER@$(uname -n)"
git config --global user.email "tfranken@protonmail.com"
git config --global alias.ci "commit"
git config --global alias.co "checkout"
git config --global alias.st "status"
git config --global alias.br "branch"
separator
} # }}}
configure_protonvpn() { # {{{
# Configure ProtonVPN
echo "Configuring ProtonVPN..."
sudo protonvpn init && sudo protonvpn c --cc CH
separator
} # }}}
install_rust() { # {{{
# Install Rust
echo "Installing Rust..."
if rustc --version; then
echo "${GREEN}Rust is already intalled${NC}"
if [ "$UPDATE" = 'true' ]; then
echo "Updading..."
rustup update
fi
else
if curl https://sh.rustup.rs -sSf | sh; then
echo "${GREEN}Successfully installed Rust${NC}"
else
echo "${ORANGE}There was a problem while installing Rust${NC}"
fi
fi
separator
} # }}}
install_scripts() { # {{{
echo "Installing scripts..."
@ -136,47 +190,25 @@ install_scripts() { # {{{
separator
} # }}}
# install_scripts
update_vim() { # {{{
# Update vim configuration
markdown_mimetype() { # {{{
# Add MIME type for reading .md files in Firefox (need to add extension too)
echo "Setting up configuration for Vim..."
/bin/bash "$BASE_DIR"/installation_scripts/vim.sh
echo "Adding MIME type for .md files in Firefox..."
echo "${ORANGE}Remember to install the Firefox extension for it to work${NC}"
mkdir -p ~/.local/share/mime/packages
echo "<?xml version=\"1.0\"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type=\"text/plain\">
<glob pattern=\"*.md\"/>
<glob pattern=\"*.mkd\"/>
<glob pattern=\"*.markdown\"/>
</mime-type>
</mime-info>" > ~/.local/share/mime/packages/text-markdown.xml
update-mime-database ~/.local/share/mime
separator
} # }}}
# update_vim
setup_sddm() { # {{{
# Update sddm
echo "Setting up SDDM..."
/bin/bash "$BASE_DIR"/installation_scripts/sddm.sh
separator
} # }}}
# setup_sddm
update_i3() { # {{{
# Update i3 configuration
echo "Setting up i3..."
/bin/bash "$BASE_DIR"/installation_scripts/i3.sh
separator
} # }}}
# update_i3
configure_protonvpn() { # {{{
# Configure ProtonVPN
echo "Configuring ProtonVPN..."
sudo protonvpn init && sudo protonvpn c --cc CH
separator
} # }}}
# configure_protonvpn
setup_bash_files() { # {{{
# Set up .bashrc
@ -212,46 +244,8 @@ setup_bash_files() { # {{{
separator
} # }}}
# setup_bash_files
configure_git() { # {{{
# Configure Git
echo "Configuring Git..."
git config --global user.name "$USER@$(uname -n)"
git config --global user.email "tfranken@protonmail.com"
git config --global alias.ci "commit"
git config --global alias.co "checkout"
git config --global alias.st "status"
git config --global alias.br "branch"
separator
} # }}}
# configure_git
install_rust() { # {{{
# Install Rust
echo "Installing Rust..."
if rustc --version; then
echo "${GREEN}Rust is already intalled${NC}"
if [ "$UPDATE" = 'true' ]; then
echo "Updading..."
rustup update
fi
else
if curl https://sh.rustup.rs -sSf | sh; then
echo "${GREEN}Successfully installed Rust${NC}"
else
echo "${ORANGE}There was a problem while installing Rust${NC}"
fi
fi
separator
} # }}}
# install_rust
bash_git_prompt() { # {{{
setup_bash_git_prompt() { # {{{
# Clone bash-git-prompt
if [ -e ~/.bash-git-prompt ]; then
@ -267,34 +261,44 @@ bash_git_prompt() { # {{{
separator
} # }}}
# bash_git_prompt
markdown_mimetype() { # {{{
# Add MIME type for reading .md files in Firefox (need to add extension too)
setup_i3() { # {{{
# Update i3 configuration
echo "Adding MIME type for .md files in Firefox..."
echo "${ORANGE}Remember to install the Firefox extension for it to work${NC}"
mkdir -p ~/.local/share/mime/packages
echo "<?xml version=\"1.0\"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type=\"text/plain\">
<glob pattern=\"*.md\"/>
<glob pattern=\"*.mkd\"/>
<glob pattern=\"*.markdown\"/>
</mime-type>
</mime-info>" > ~/.local/share/mime/packages/text-markdown.xml
update-mime-database ~/.local/share/mime
echo "Setting up i3..."
/bin/bash "$BASE_DIR"/installation_scripts/i3.sh
separator
} # }}}
setup_sddm() { # {{{
# Update sddm
echo "Setting up SDDM..."
/bin/bash "$BASE_DIR"/installation_scripts/sddm.sh
separator
} # }}}
setup_vim() { # {{{
# Update vim configuration
echo "Setting up configuration for Vim..."
/bin/bash "$BASE_DIR"/installation_scripts/vim.sh
separator
} # }}}
# MAIN:
# install_scripts
# configure_git
# configure_protonvpn
# setup_bash_files
# setup_bash_git_prompt
# install_rust
# setup_vim
# setup_sddm
# setup_i3
# markdown_mimetype
clone_projects() { # {{{
# Clone projects
echo "Cloning projects..."
/bin/bash "$BASE_DIR"/installation_scripts/clone_projects.sh
separator
} # }}}
# clone_projects