commit d10d5dc331cfcc66dfa1d12715ee7340474ee7ab Author: Carlos Sousa Date: Sat Mar 6 18:46:53 2021 +0100 Squashing Commits diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..6071387b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# HomeLab - Change Log + +All notable changes to this project will be documented in this file. +This project adheres to [Semantic Versioning](https://semver.org/). + +## [0.1.0] - Start - 2021-03-02 + +ℹ️ **Note:** + +### Added +- sync-from-opportunity.sh - Syncs [local] from [remote] + +### Updated + + +### Deleted + + +### Fixed diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..3c4d5fce --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 zebrajr + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..aabf4b3b --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# HomeLab +Scripts used for starting my HomeLab stuff, either from scratch or moving between machines. +### Situation + + +### Task + + +### Result + + +### Note + +### ToDo +- Change sync-from-opportunity.sh to use .env file diff --git a/Ubuntu-Server/Scripts/install-docker.sh b/Ubuntu-Server/Scripts/install-docker.sh new file mode 100644 index 00000000..bf8d0a43 --- /dev/null +++ b/Ubuntu-Server/Scripts/install-docker.sh @@ -0,0 +1,4 @@ +sudo apt update -y && \ +sudo apt upgrade -y && \ +sudo apt install docker -y && \ +sudo apt install docker-compose -y diff --git a/Xubuntu-Daily/001-xubuntu-deploy.sh b/Xubuntu-Daily/001-xubuntu-deploy.sh new file mode 100755 index 00000000..10599620 --- /dev/null +++ b/Xubuntu-Daily/001-xubuntu-deploy.sh @@ -0,0 +1,40 @@ +start=`date +%s` +source secrets.cfg +echo "Setting Hostname..." +sudo hostname ${clienthostname} +echo "Adding Repositories..." +sudo add-apt-repository ppa:xubuntu-dev/extras -y &> ${PWD}/001.log +echo "Updating and Upgrading..." +sudo apt update -y &> /dev/null +sudo apt upgrade -y &> /dev/null +echo "Installing: htops, kvm and it's utilities..." +sudo apt install htop -y &> /dev/null +sudo apt install qemu-kvm -y &> /dev/null +sudo apt install virt-manager -y &> /dev/null && +sudo apt install libvirt-daemon-system -y &> /dev/null && +sudo apt install libvirt-clients -y &> /dev/null && +sudo apt install bridge-utils -y &> /dev/null&& +echo "Adding user < ${USER} > to VM groups..." +sudo adduser ${USER} libvirt +sudo adduser ${USER} kvm +echo "Installing OpenVPN & Git & NFS Tools" +sudo apt install git -y &> /dev/null +sudo apt install openvpn -y &> /dev/null && +sudo apt install network-manager-openvpn -y &> /dev/null +sudo apt install nfs-common -y &> /dev/null +echo "Installing Q.O.L. - Eg: HotCorners..." +sudo apt install xfdashboard -y &> /dev/null +echo "Removing Bloatware..." +sudo apt remove gnome-mines -y &> /dev/null && +sudo apt remove sgt-launcher -y &> /dev/null && +sudo apt remove transmission-gtk -y &> /dev/null && +sudo apt remove parole -y &> /dev/null && +sudo apt remove WebBrowser -y &> /dev/null && +echo "Configuring Git to User < ${gituser} >" +git config --global user.name ${gituser} +git config --global user.email ${gitemail} +echo "Cleaning Up" +sudo apt auto-remove -y &> /dev/null +end=`date +%s` +runtime=$((end-start)) +echo "Total Run Time: ${runtime} Seconds." diff --git a/Xubuntu-Daily/002-xubuntu-git.sh b/Xubuntu-Daily/002-xubuntu-git.sh new file mode 100755 index 00000000..88b44b66 --- /dev/null +++ b/Xubuntu-Daily/002-xubuntu-git.sh @@ -0,0 +1,7 @@ +source secrets.cfg +echo "Creating Directories" +mkdir ~/GitHub &> log002.log +cd ~/GitHub &> log002.log +echo "Cloning Repos..." +git clone ${gitrepo001} &> log002.log +git clone ${gitrepo002} &> log002.log diff --git a/Xubuntu-Daily/800-company-vpn.sh b/Xubuntu-Daily/800-company-vpn.sh new file mode 100755 index 00000000..1918fd7b --- /dev/null +++ b/Xubuntu-Daily/800-company-vpn.sh @@ -0,0 +1 @@ +sudo openvpn --config client.opvn diff --git a/Xubuntu-Daily/900-xubuntu-update.sh b/Xubuntu-Daily/900-xubuntu-update.sh new file mode 100755 index 00000000..52ec0a56 --- /dev/null +++ b/Xubuntu-Daily/900-xubuntu-update.sh @@ -0,0 +1,10 @@ +echo Updating... +start=`date +%s` +sudo apt update -y &> /dev/null && +echo Upgrading... +sudo apt upgrade -y &> /dev/null && +echo Removing Old Packages... +sudo apt auto-remove -y &> /dev/null +end=`date +%s` +runtime=$((end-start)) +echo Total Update Time: ${runtime} seconds! diff --git a/Xubuntu-Daily/secrets.cfg.sample b/Xubuntu-Daily/secrets.cfg.sample new file mode 100644 index 00000000..e69de29b diff --git a/Xubuntu-Daily/todo.yaml b/Xubuntu-Daily/todo.yaml new file mode 100644 index 00000000..e64ae2e6 --- /dev/null +++ b/Xubuntu-Daily/todo.yaml @@ -0,0 +1,7 @@ +- Download & Install Atom / Opera Automatically +- Add User and Set Password automatically +- Add Summary from Setup at Start +- Set Delay before continuing after summary +- Add .gitignore: + secrets.cfg + client.opvn diff --git a/clone-from-repo.sh b/clone-from-repo.sh new file mode 100644 index 00000000..507c8f57 --- /dev/null +++ b/clone-from-repo.sh @@ -0,0 +1 @@ +git clone https://github.com/zebrajr/HomeLab diff --git a/curiosity/rsync/config.sh-sample b/curiosity/rsync/config.sh-sample new file mode 100644 index 00000000..81e7df56 --- /dev/null +++ b/curiosity/rsync/config.sh-sample @@ -0,0 +1,5 @@ +export TARGETUSER="remote user eg: docker-user" +export TARGETIP="remote ip eg: 10.50.20.5" +export TARGETFOLDER="folder to sync from eg: /home/docker-user/" +export SOURCEKEY="RSA private key location eg: /home/rsync/.ssh/curiosity" +export SOURCEFOLDER="destination folder eg: /mnt/raid1/opportunity-clone/" diff --git a/curiosity/rsync/sync-from-opportunity.sh b/curiosity/rsync/sync-from-opportunity.sh new file mode 100644 index 00000000..f76555ca --- /dev/null +++ b/curiosity/rsync/sync-from-opportunity.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Don't forget to add the script to anacron for automatic sync +# sudo nano /etc/anacrontab +# Run Every Day / If not executed wait 15 minutes after system boot / Unique Name / Script Location +# 1 15 syncFromOpportunity.daily /bin/sh /home/rsync/sync-from-opportunity.sh + +. ./home/rsync/config.sh + + + +rsync --progress -avz -e "ssh -i ${SOURCEKEY}" $TARGETUSER@$TARGETIP:$TARGETFOLDER $SOURCEFOLDER diff --git a/update-from-main-repo.sh b/update-from-main-repo.sh new file mode 100644 index 00000000..56a0dc33 --- /dev/null +++ b/update-from-main-repo.sh @@ -0,0 +1 @@ +git pull origin main