Reroganize repository

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2018-12-12 21:41:12 +01:00
parent 0a4424d25e
commit cd781c174e
40 changed files with 113 additions and 22 deletions

View file

@ -2,14 +2,27 @@
#
# Author: Severin Kaderli <severin.kaderli@gmail.com>
# Usage: ./install.sh
# Array of files which should be symlinked.
FILES=(
#######################################
# Configuration variables
#######################################
# Array of directories which should be created
DIRECTORIES=(
"Build"
"Downloads"
"Projects"
".logs"
)
# Array of files which should be symlinked in the home folder
LINKED_FILES_HOME=(
".aliases"
".bash_logout"
".bash_profile"
".bashrc"
".config/compton.conf"
".config/dunst"
".config/gtk-3.0"
".config/i3"
".config/polybar"
".config/streamlink"
@ -22,20 +35,59 @@ FILES=(
".keyleds"
".vimrc"
".xinitrc"
".xprofile"
".Xresources"
"bin"
)
# The directory of this repository
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Array of systemd services which should be enabled
SYSTEMD_SERVICES=(
"cronie"
"bumblebeed"
)
#######################################
# Directory variables
#######################################
DIR="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)"
SYSTEM_DIR="$DIR/system"
PACKAGES_DIR="$DIR/packages"
#######################################
# Helper functions
#######################################
# Function to display fancy headers
function print_header() {
echo -e "\e[32m########################################"
echo -e "\n\e[32m########################################"
echo -e "# $1"
echo -e "########################################\e[39m"
}
# Function to set owner and permission of a file
function set_permission() {
echo -e "- Changing permission of $3 to $1"
sudo chown -R "$1" "$3"
echo -e "- Changing permission of $3 to $2"
sudo chmod -R "$2" "$3"
}
# Function to enable a service
function enable_service() {
echo -e "- Enabling service $1"
sudo systemctl enable "$1"
}
#######################################
# Main code
#######################################
# Creating needed directories
print_header "Creating directories"
for dir in "${DIRECTORIES[@]}"
do
echo "- Creating $HOME/$dir"
mkdir -p "$HOME/$dir"
done
# Install base-devel for building aur packages
print_header "Installing packages"
#sudo pacman -S git base-devel --noconfirm
@ -48,21 +100,28 @@ print_header "Installing packages"
#rm -rf aurman
# Install packages
#aurman -S --noconfirm $(cat "$DIR/packages.list")
#aurman -S --noconfirm $(cat "$DIR/packages2.list")
#aurman -S --noconfirm $(cat "$PACKAGES_DIR/packages.list")
#aurman -S --noconfirm $(cat "$PACKAGES_DIR/packages2.list")
# Create symlinks to dotfiles
print_header "Creating symlinks"
for file in "${FILES[@]}"
for file in "${LINKED_FILES_HOME[@]}"
do
echo "Linking $file"
echo "- Linking $HOME/$file -> $SYSTEM_DIR/$file"
rm -rf "$HOME/$file"
ln -fs "$DIR/$file" "$HOME/$file"
ln -fs "$SYSTEM_DIR/$file" "$HOME/$file"
done
print_header "Asking for root permissions"
sudo -v
# Give scripts execute permissions
print_header "Give permissions"
chmod -R +x "$HOME/bin"
set_permission severin 744 "$HOME/bin"
# TODO: Enable services
print_header "Enabling systemd services"
print_header "Enabling systemd services"
for service in "${SYSTEMD_SERVICES[@]}"
do
enable_service "$service"
done