From 4e7aef37705bf99736abb930dcc138c73b6f9a9f Mon Sep 17 00:00:00 2001 From: "flyingscorpio@arch-desktop" Date: Wed, 8 Apr 2020 15:59:45 +0200 Subject: [PATCH] Start whole rewrite --- arch_based_installs.sh | 32 ------- clone_projects.sh | 111 ----------------------- debian_based_installs.sh | 41 --------- separator.sh | 12 --- setup_cockpit.sh | 185 --------------------------------------- 5 files changed, 381 deletions(-) delete mode 100644 arch_based_installs.sh delete mode 100644 clone_projects.sh delete mode 100644 debian_based_installs.sh delete mode 100644 separator.sh delete mode 100755 setup_cockpit.sh diff --git a/arch_based_installs.sh b/arch_based_installs.sh deleted file mode 100644 index a9bb700..0000000 --- a/arch_based_installs.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 --needed keepass; then - echo "${GREEN}Successfully installed Keepass${NC}" -else - echo "${RED}Didn't install Keepass${NC}" -fi - -echo "Installing ProtonVPN..." -if sudo pacman -S --needed openvpn dialog python-pip python-setuptools && sudo pip install protonvpn-cli; then - echo "${GREEN}Successfully installed ProtonVPN${NC}" -else - echo "${RED}Didn't install ProtonVPN${NC}" -fi - -echo "Installing Git..." -if sudo pacman -S --needed git; then - echo "${GREEN}Successfully installed Git${NC}" -else - echo "${RED}Didn't install Git${NC}" -fi diff --git a/clone_projects.sh b/clone_projects.sh deleted file mode 100644 index 49274ad..0000000 --- a/clone_projects.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh - -## This script clones all the different repos - -set_up_2px_repo() { - repo_name="$1" - folder="$2" - echo "Setting up $repo_name..." - if [ -e ~/"$folder""$repo_name" ]; then - echo "${GREEN}$repo_name is already there, updating...${NC}" - cd ~/"$folder""$repo_name" && git pull - else - echo "${ORANGE}Cloning new $repo_name...${NC}" - cd ~/"$folder" && git clone ssh://flyingscorpio@2px.info.tm/~/repos/"$repo_name".git - fi - - return 0 -} - -set_up_gitlab_repo() { - repo_owner="$1" - repo_name="$2" - folder="$3" - echo "Setting up $repo_owner/$repo_name..." - if [ -e ~/"$folder""$repo_name" ]; then - echo "${GREEN}$repo_name is already there, updating...${NC}" - cd ~/"$folder""$repo_name" && git pull - else - echo "${ORANGE}Cloning new $repo_name...${NC}" - cd ~/"$folder" && git clone https://gitlab.com/"$repo_owner"/"$repo_name".git - fi - - return 0 -} - -# REPOS ON LIME2 {{{ - -echo "Setting up Lessons..." -if [ ! -e ~/Lessons ]; then - mkdir ~/Lessons && echo "${ORANGE}Created ~/Lessons${NC}" -fi -set_up_2px_repo 'E2L' 'Lessons/' -set_up_2px_repo 'OpenClassrooms' 'Lessons/' -set_up_2px_repo 'Keepass' -set_up_2px_repo 'PersonnalScripts' -set_up_2px_repo 'RootMe' -set_up_2px_repo 'SetupCockpit' -set_up_2px_repo 'VimConf' -cd ~/VimConf && /bin/bash ~/VimConf/update.sh -o - -# }}} - -# REPOS ON GITLAB {{{ - -if [ ! -e ~/SRC ]; then - mkdir ~/SRC && echo "${ORANGE}Created ~/SRC${NC}" -fi - -set_up_gitlab_repo 'e2li' 'depydoc' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'BlurMySearches' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'JsonToPython' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'MarioSokoban' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'PythonLocalBlockchain' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'Roboc-GUI' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'Roboc-console' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'ScheduleTimer' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'SudokuSolver' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'TicTacToe' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'TorNoVPN' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'WhitespaceInterpreter' 'SRC/' -set_up_gitlab_repo 'flyingscorpio' 'WikipediaAcronymScraper' 'SRC/' - -echo "Setting up 2px..." -if [ -e ~/SRC/2px ]; then - echo "${GREEN}2px is already there, updating...${NC}" - cd ~/SRC/2px && git pull -else - echo "${ORANGE}Cloning new 2px...${NC}" - cd ~/SRC && git clone git@gitlab.com:flyingscorpio/2px.git - cd ~/SRC/2px && python3 -m venv env - echo " -# Set own environment variables for Django -DJANGO_USER='flyingscorpio' -export DJANGO_USER -DJANGO_PASSWORD='ribosome66' -export DJANGO_PASSWORD -DJANGO_SECRET_KEY='q+hci0d5y90q)k07f@1k3qzr&w=@89n(0z0ukp)_iu(g9iws0r' -export DJANGO_SECRET_KEY -systemctl start mysqld.service" >> ~/SRC/2px/env/bin/activate -fi - -echo "Setting up LVEL-website..." -if [ -e ~/SRC/LVEL-website ]; then - echo "${GREEN}LVEL-website is already there, updating...${NC}" - cd ~/SRC/LVEL-website && git pull -else - echo "${ORANGE}Cloning new LVEL-website...${NC}" - cd ~/SRC && git clone git@gitlab.com:flyingscorpio/LVEL-website.git - cd ~/SRC/LVEL-website && python3 -m venv env - echo " -# Set own environment variables for Django -DJANGO_USER='flyingscorpio' -export DJANGO_USER -DJANGO_PASSWORD='ribosome66' -export DJANGO_PASSWORD -DJANGO_SECRET_KEY='t!d6q&g1*lm-p41m=pd!o&kga9jk)wom)sr7#4-=\$oo*\$)ymtc' -export DJANGO_SECRET_KEY -systemctl start mysqld.service" >> ~/SRC/LVEL-website/env/bin/activate -fi - -# }}} diff --git a/debian_based_installs.sh b/debian_based_installs.sh deleted file mode 100644 index 3314cd8..0000000 --- a/debian_based_installs.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/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 "Installing ProtonVPN..." -if sudo apt install -y openvpn dialog python3-pip python3-setuptools && sudo pip3 install protonvpn-cli; then - echo "${GREEN}Successfully installed ProtonVPN${NC}" -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 diff --git a/separator.sh b/separator.sh deleted file mode 100644 index d92fe71..0000000 --- a/separator.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -## This script is used to visually separate commands in the other scripts - - -if [ $? -eq 0 ]; then - echo -n "${GREEN}" -else - echo -n "${RED}" -fi -echo "========================================" -echo "${NC}" diff --git a/setup_cockpit.sh b/setup_cockpit.sh deleted file mode 100755 index ce3feda..0000000 --- a/setup_cockpit.sh +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/bash - -## Script to automate the setting up of my working environment. - - -RED=$(tput setaf 1) -GREEN=$(tput setaf 2) -ORANGE=$(tput setaf 3) -NC=$(tput sgr0) - -export RED -export GREEN -export ORANGE -export NC - -base_dir="$PWD" - - -# Define OS {{{ - -OS='none' -os_release=$(cat /etc/os-release*) -case ${os_release,,} in - *debian* ) - OS='debian' - echo "You are using Debian" - ;; - *ubuntu* ) - OS='debian' - echo "You are using Ubuntu" - ;; - *arch* ) - OS='arch' - echo "You are using Arch-Linux" - ;; - *manjaro* ) - OS='arch' - echo "You are using Manjaro" - ;; - * ) - echo "${ORANGE}Unable to determine OS${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 - echo "Using $OS" -esac -export OS - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Install scripts {{{ - -echo "Installing scripts..." - -if [ "$OS" = 'debian' ]; then - /bin/bash ~/SetupCockpit/debian_based_installs.sh -elif [ "$OS" = 'arch' ]; then - /bin/bash ~/SetupCockpit/arch_based_installs.sh -else - echo "${RED} Didn't receive correct OS information, quitting...${NC}" - exit 1 -fi - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Configure ProtonVPN {{{ - -echo "Configuring ProtonVPN..." - -sudo protonvpn init && sudo protonvpn c --cc NL - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Update .bashrc {{{ - -echo "Updating .bashrc..." -if cp ~/SetupCockpit/dotfiles/bashrc ~/.bashrc; then - echo "${GREEN}Successfully updated .bashrc${NC}" -else - echo "${ORANGE}There was a problem while updating .bashrc${NC}" -fi - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Update .bash_aliases {{{ - -echo "Updating .bash_aliases..." -if cp ~/SetupCockpit/dotfiles/bash_aliases ~/.bash_aliases; then - echo "${GREEN}Successfully updated .bash_aliases${NC}" -else - echo "${ORANGE}There was a problem while updating .bash_aliases${NC}" -fi - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# 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" - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Install Rust {{{ - -echo "Installing Rust..." -if rustc --version; then - echo "${GREEN}Rust is already intalled. Updading...${NC}" - rustup update -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 - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Clone bash-git-prompt {{{ - -if [ -e ~/.bash-git-prompt ]; then - echo "Found existing bash-git-prompt, updating..." - cd ~/.bash-git-prompt && git pull - cd "$base_dir" || exit 1 -else - echo "Cloning bash-git-prompt..." - git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1 -fi - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Add MIME type for reading .md files in Firefox (need to add extension too) {{{ - -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 " - - - - - - -" > ~/.local/share/mime/packages/text-markdown.xml -fi - -/bin/bash ~/SetupCockpit/separator.sh - -# }}} - -# Clone projects {{{ - -echo "Cloning projects..." - -/bin/bash clone_projects.sh - -/bin/bash ~/SetupCockpit/separator.sh - -# }}}