Separate into more files

This commit is contained in:
flyingscorpio@pinebook-pro 2020-03-03 12:37:39 +01:00
parent 010437b45f
commit 48d5b989a8
5 changed files with 191 additions and 58 deletions

View file

@ -0,0 +1,37 @@
#!/bin/sh
## This script handles the installations for Arch-based systems.
## It is run by setup_cockpit.sh
if [ "$OS" != 'arch' ]; then
echo "${RED}The OS wasn't defined as Arch. Quitting...${NC}"
exit 1
else
echo "${GREEN}Installing for Arch-based systems${NC}"
fi
echo "Installing Keepass..."
if sudo pacman -S keepass; then
echo "${GREEN}Successfully installed Keepass${NC}"
else
echo "${RED}Didn't install Keepass${NC}"
fi
echo "Setting up ProtonVPN..."
if sudo pacman -S openvpn dialog python-pip python-setuptools && sudo pip install protonvpn-cli; then
echo "${GREEN}Successfully installed ProtonVPN${NC}"
if sudo protonvpn init; then
sudo protonvpn c --cc NL
else
echo "${RED}There was a problem with protonvpn init${NC}"
fi
else
echo "${RED}Didn't install ProtonVPN${NC}"
fi
echo "Installing Git..."
if sudo pacman -S git; then
echo "${GREEN}Successfully installed Git${NC}"
else
echo "${RED}Didn't install Git${NC}"
fi

38
SetupCockpit/clone_projects.sh Executable file → Normal file
View file

@ -2,8 +2,6 @@
# This script clones all the different repos
sudo apt install python3-venv
##################
# REPOS ON LIME2 #
##################
@ -11,14 +9,13 @@ sudo apt install python3-venv
cd || exit 1
echo "Currently in $(pwd)"
echo "Setting up VimConf.git..."
echo "Setting up VimConf..."
git clone ssh://flyingscorpio@2px.info.tm/~/repos/VimConf.git
echo "Setting up Lessons.git..."
echo "Setting up Lessons..."
git clone ssh://flyingscorpio@2px.info.tm/~/repos/Lessons.git
echo "Setting up RootMe.git..."
echo "Setting up RootMe..."
git clone ssh://flyingscorpio@2px.info.tm/~/repos/RootMe.git
###################
# REPOS ON GITLAB #
###################
@ -31,10 +28,10 @@ fi
cd ~/SRC || exit 1
echo "Currently in $(pwd)"
echo "Setting up e2li/depydoc.git..."
echo "Setting up e2li/depydoc..."
git clone https://gitlab.com/e2li/depydoc.git
echo "Setting up 2px.git..."
echo "Setting up 2px..."
git clone https://gitlab.com/flyingscorpio/2px.git
cd ~/SRC/2px || exit 1
echo "Currently in $(pwd)"
@ -48,17 +45,17 @@ export DJANGO_PASSWORD
DJANGO_SECRET_KEY='q+hci0d5y90q)k07f@1k3qzr&w=@89n(0z0ukp)_iu(g9iws0r'
export DJANGO_SECRET_KEY" >> ~/SRC/2px/env/bin/activate
echo "Successfully set up 2px.git"
echo "Successfully set up 2px"
cd ~/SRC || exit 1
echo "Currently in $(pwd)"
echo "Setting up BlurMySearches.git..."
echo "Setting up BlurMySearches..."
git clone https://gitlab.com/flyingscorpio/BlurMySearches.git
echo "Setting up JsonToPython.git..."
echo "Setting up JsonToPython..."
git clone https://gitlab.com/flyingscorpio/JsonToPython.git
echo "Setting up LVEL-website.git..."
echo "Setting up LVEL-website..."
git clone https://gitlab.com/flyingscorpio/LVEL-website.git
cd ~/SRC/LVEL-website || exit 1
echo "Currently in $(pwd)"
@ -76,20 +73,19 @@ echo "Successfully set up LVEL-website.git"
cd ~/SRC || exit 1
echo "Currently in $(pwd)"
echo "Setting up MarioSokoban.git..."
echo "Setting up MarioSokoban..."
git clone https://gitlab.com/flyingscorpio/MarioSokoban.git
echo "Setting up PythonLocalBlockchain.git..."
echo "Setting up PythonLocalBlockchain..."
git clone https://gitlab.com/flyingscorpio/PythonLocalBlockchain.git
echo "Setting up Roboc-GUI.git..."
echo "Setting up Roboc-GUI..."
git clone https://gitlab.com/flyingscorpio/Roboc-GUI.git
echo "Setting up Roboc-console.git..."
echo "Setting up Roboc-console..."
git clone https://gitlab.com/flyingscorpio/Roboc-console
echo "Setting up SudokuSolver.git..."
echo "Setting up SudokuSolver..."
git clone https://gitlab.com/flyingscorpio/SudokuSolver.git
echo "Setting up TicTacToe.git..."
echo "Setting up TicTacToe..."
git clone https://gitlab.com/flyingscorpio/TicTacToe.git
echo "Setting up WhitespaceInterpreter.git..."
echo "Setting up WhitespaceInterpreter..."
git clone https://gitlab.com/flyingscorpio/WhitespaceInterpreter.git
echo "Setting up WikipediaAcronymScraper.git..."
echo "Setting up WikipediaAcronymScraper..."
git clone https://gitlab.com/flyingscorpio/WikipediaAcronymScraper.git

View file

@ -0,0 +1,46 @@
#!/bin/sh
## This script handles the installations for Debian-based systems.
## It is run by setup_cockpit.sh
if [ "$OS" != 'debian' ]; then
echo "${RED}The OS wasn't defined as Debian. Quitting...${NC}"
exit 1
else
echo "${GREEN}Installing for Debian-based systems${NC}"
fi
sudo apt update
echo "Installing Python venv..."
if sudo apt install python3-venv; then
echo "${GREEN}Successfully installed Python venv${NC}"
else
echo "${RED}Didn't install Python venv${NC}"
fi
echo "Installing Keepass..."
if sudo apt install keepass2; then
echo "${GREEN}Successfully installed Keepass${NC}"
else
echo "${RED}Didn't install Keepass${NC}"
fi
echo "Setting up ProtonVPN..."
if sudo apt install -y openvpn dialog python3-pip python3-setuptools && sudo pip3 install protonvpn-cli; then
echo "${GREEN}Successfully installed ProtonVPN${NC}"
if sudo protonvpn init; then
sudo protonvpn c --cc NL
else
echo "${RED}There was a problem with protonvpn init${NC}"
fi
else
echo "${RED}Didn't install ProtonVPN${NC}"
fi
echo "Installing Git..."
if sudo apt install git; then
echo "${GREEN}Successfully installed Git${NC}"
else
echo "${RED}Didn't install Git${NC}"
fi

22
SetupCockpit/separator.sh Normal file
View file

@ -0,0 +1,22 @@
#!/bin/bash
## This script is used to visually separate commands in the other scripts
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
ORANGE=$(tput setaf 3)
NC=$(tput sgr0)
export RED
export GREEN
export ORANGE
export NC
if [ $? -eq 0 ]; then
echo -n "${GREEN}"
else
echo -n "${RED}"
fi
echo "========================================"
echo "${NC}"

View file

@ -1,21 +1,62 @@
#!/bin/bash
# Script to automate the setting up of my working environment.
# First make sure the keepass Database.kdbx is in a folder.
# Open keepass in a separate window. The script will prompt for passwords.
## Script to automate the setting up of my working environment.
#############
# DEFINE OS #
#############
if [ -z "$1" ]; then
echo "Which OS are you using?"
select os in 'debian - ubuntu' 'arch - manjaro'; do
case $os in
'debian - ubuntu' ) os='debian'; break;;
'arch - manjaro' ) os='arch'; break;;
esac
done
else
if [ "$1" = 'debian' ] || [ "$1" = 'ubuntu' ]; then
os='debian'
elif [ "$1" = 'arch' ] || [ "$1" = 'manjaro' ]; then
os='arch'
else
echo "${ORANGE}Didn't understand OS argument${NC}"
echo "Which OS are you using?"
select os in 'debian - ubuntu' 'arch - manjaro'; do
case $os in
'debian - ubuntu' ) os='debian'; break;;
'arch - manjaro' ) os='arch'; break;;
esac
done
fi
fi
echo "Using $os"
export os
/bin/bash separator.sh
###################
# Install scripts #
###################
if [ "$os" = 'debian' ]; then
/bin/bash debian_based_installs.sh
elif [ "$os" = 'arch' ]; then
/bin/bash arch_based_installs.sh
else
echo "${RED} Didn't receive correct OS information, quitting...${NC}"
fi
/bin/bash separator.sh
####################
# Install KeePass2 #
# Set bash aliases #
####################
install_keepass2() {
sudo apt install keepass2
}
####################
# Set some aliases #
####################
set_bash_aliases() {
echo "Writing aliases to ~/.bash_aliases..."
echo "alias lime2connect='ssh flyingscorpio@2px.info.tm'
alias protonvpn='sudo protonvpn'
alias fish='fish ~/.config/fish/functions/my_aliases.fish && fish'
@ -23,36 +64,34 @@ alias rm='rm --preserve-root'
alias ll='ls -lArth'
alias la='ls -A'
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
}
alias tor-browser-start='~/tor-browser_en-US/tor-browser_en-US/Browser/start-tor-browser --detach'" >> ~/.bash_aliases
#####################
# Install ProtonVPN #
#####################
install_protonvpn() {
sudo apt install -y openvpn dialog python3-pip python3-setuptools
sudo pip3 install protonvpn-cli
sudo protonvpn init
sudo protonvpn c --cc NL
}
/bin/bash separator.sh
#################
# Configure Git #
#################
echo "Configuring Git..."
#############################
# Install and configure Git #
#############################
install_and_configure_git() {
sudo apt install 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"
}
/bin/bash separator.sh
##############################################################################
# Add MIME type for reading .md files in Firefox (need to add extension too) #
##############################################################################
add_md_mime_type() {
echo "Adding MIME type for .md files in Firefox"
echo "${ORANGE}Remember to install the Firefox extension for it to work${NC}"
if [ -e ~/.local/share/mime/packages/text-markdown.xml ]; then
echo "<?xml version=\"1.0\"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
@ -63,12 +102,5 @@ echo "<?xml version=\"1.0\"?>
</mime-type>
</mime-info>" >> ~/.local/share/mime/packages/text-markdown.xml
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
/bin/bash separator.sh