Put functions

This commit is contained in:
flyingscorpio@ubuntu-desktop 2020-02-28 18:26:34 +01:00
parent fe155fb82a
commit 010437b45f

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# Script to automate the setting up of my working environment. # Script to automate the setting up of my working environment.
# First make sure the keepass Database.kdbx is in a folder. # First make sure the keepass Database.kdbx is in a folder.
@ -8,42 +8,38 @@
#################### ####################
# Install KeePass2 # # Install KeePass2 #
#################### ####################
install_keepass2() {
sudo apt install keepass2 sudo apt install keepass2
}
#################### ####################
# Set some aliases # # Set some aliases #
#################### ####################
set_bash_aliases() {
{ echo "alias lime2connect='ssh flyingscorpio@2px.info.tm'
echo "alias lime2connect='ssh flyingscorpio@2px.info.tm'" alias protonvpn='sudo protonvpn'
echo "alias protonvpn='sudo protonvpn'" alias fish='fish ~/.config/fish/functions/my_aliases.fish && fish'
echo "alias fish='fish ~/.config/fish/functions/my_aliases.fish && fish'" alias rm='rm --preserve-root'
echo "alias rm='rm --preserve-root'" alias ll='ls -lArth'
echo "alias ll='ls -lArth'" alias la='ls -A'
echo "alias la='ls -A'" alias l='ls -CF'
echo "alias l='ls -CF'" alias tor-browser-start='/home/flyingscorpio/NetworkAndSecurity/tor-browser-linux64-9.0.4_en-US/tor-browser_en-US/Browser/start-tor-browser --detach'" >> ~/.bash_aliases
echo "alias tor-browser-start='/home/flyingscorpio/NetworkAndSecurity/tor-browser-linux64-9.0.4_en-US/tor-browser_en-US/Browser/start-tor-browser --detach'" }
} >> ~/.bash_aliases
##################### #####################
# Install ProtonVPN # # Install ProtonVPN #
##################### #####################
install_protonvpn() {
sudo apt install -y openvpn dialog python3-pip python3-setuptools sudo apt install -y openvpn dialog python3-pip python3-setuptools
sudo pip3 install protonvpn-cli sudo pip3 install protonvpn-cli
sudo protonvpn init sudo protonvpn init
sudo protonvpn c --cc NL
# Connect to ProtonVPN in Holland }
sudo protonvpn c --cc NL
############################# #############################
# Install and configure Git # # Install and configure Git #
############################# #############################
install_and_configure_git() {
sudo apt install git sudo apt install git
git config --global user.name "$USER@$(uname -n)" git config --global user.name "$USER@$(uname -n)"
git config --global user.email "tfranken@protonmail.com" git config --global user.email "tfranken@protonmail.com"
@ -51,12 +47,12 @@ git config --global alias.ci "commit"
git config --global alias.co "checkout" git config --global alias.co "checkout"
git config --global alias.st "status" git config --global alias.st "status"
git config --global alias.br "branch" git config --global alias.br "branch"
}
############################################################################## ##############################################################################
# Add MIME type for reading .md files in Firefox (need to add extension too) # # Add MIME type for reading .md files in Firefox (need to add extension too) #
############################################################################## ##############################################################################
add_md_mime_type() {
if [ -e ~/.local/share/mime/packages/text-markdown.xml ]; then if [ -e ~/.local/share/mime/packages/text-markdown.xml ]; then
echo "<?xml version=\"1.0\"?> echo "<?xml version=\"1.0\"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'> <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
@ -67,3 +63,12 @@ echo "<?xml version=\"1.0\"?>
</mime-type> </mime-type>
</mime-info>" >> ~/.local/share/mime/packages/text-markdown.xml </mime-info>" >> ~/.local/share/mime/packages/text-markdown.xml
fi fi
}
# Check if function exists
if declare -f "$1" > /dev/null; then
"$@"
else
echo "'$1' is not a know function name" >&2
exit 1
fi