diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a4c5b3..8d95e86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,6 @@ before_script: Lint: script: - - shellcheck -x ./system/bin/* + - shellcheck -x disable=SC2034 ./system/bin/* - shellcheck -x ./install.sh - shellcheck -x ./post-install.sh diff --git a/install.sh b/install.sh index a19b584..437e6b9 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,18 @@ #!/bin/bash +# +# SCRIPT NAME: +# install.sh # -# Author: Severin Kaderli -# Usage: ./install.sh +# AUTHOR: +# Severin Kaderli +# +# DESCRIPTION: +# This is the main installation script for my dotfiles. It setups the symlinks +# to the neeeded files, creates new directories, enables systemd services, +# installs pacman packages and gives out the correct permissions to files. +# +# USAGE: +# ./install.sh . ./system/bin/utils.sh ####################################### @@ -9,10 +20,10 @@ ####################################### # Array of directories which should be created DIRECTORIES=( + ".logs" "Build" "Downloads" "Projects" - ".logs" ) # Array of files which should be symlinked in the home folder @@ -54,7 +65,6 @@ SYSTEMD_SERVICES=( ####################################### # Main code ####################################### -# Creating needed directories print_header "Creating directories" for dir in "${DIRECTORIES[@]}" do @@ -76,17 +86,12 @@ print_header "Installing packages" #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 "${LINKED_FILES_HOME[@]}" do create_link "${file}" done -print_header "Asking for root permissions" -sudo -v - -# Give scripts execute permissions print_header "Give permissions" set_permission severin 744 "${HOME}/bin" diff --git a/post-install.sh b/post-install.sh index dc141cf..018fc78 100755 --- a/post-install.sh +++ b/post-install.sh @@ -1,13 +1,18 @@ #!/bin/bash +# +# SCRIPT NAME: +# post-install.sh # -# This is the post installation script. This should be executed only after -# install.sh has been executed completly and the system has been rebooted -# after that. +# AUTHOR: +# Severin Kaderli # -# This script installs npm packages. +# DESCRIPTION: +# This is the post-install script for my dotfiles. It should be only run +# after install.sh has been run and the system has been rebooted. This script +# installs global npm packages. # -# Author: Severin Kaderli -# Usage: ./post-install.sh +# USAGE: +# ./post-install.sh . ./system/bin/utils.sh ####################################### @@ -23,6 +28,5 @@ NPM_PACKAGES=( ####################################### # Main code ####################################### -# Install global npm packages print_header "Installing global npm packages" npm i -g "${NPM_PACKAGES[@]}" \ No newline at end of file diff --git a/system/bin/utils.sh b/system/bin/utils.sh index e3174e0..f648f4c 100755 --- a/system/bin/utils.sh +++ b/system/bin/utils.sh @@ -7,8 +7,8 @@ # Severin Kaderli # # DESCRIPTION: -# This script provides functions that I use in my other scripts. It is -# not supposed to be run directly. +# This script provides functions and variables that I use in my other scripts. +# It is not supposed to be run directly but to be sourced by other scripts. # # USAGE: # Source this script in the needed script. @@ -32,7 +32,7 @@ YELLOW='\033[33m' # Helper functions ####################################### # Function to display fancy headers -# $1: Title +# USAGE: print_header TITLE function print_header() { echo -e "\n${GREEN}########################################" echo -e "# ${1}" @@ -40,14 +40,14 @@ function print_header() { } # Creates the given directory in the home directory -# $1: Directory +# USAGE: create_directory DIRECTORY function create_directory() { echo -e "- Creating directory ${YELLOW}${HOME}/${1}${RESET}" mkdir -p "${HOME}/${1}" } # Creates a symlink of the given file from the home directory to here. -# $1: Filename +# USAGE: create_link FILE function create_link() { echo -e "- Linking ${YELLOW}${HOME}/${1}${RESET} -> ${YELLOW}${SYSTEM_DIR}/${1}${RESET}" rm -rf "${HOME:?}/$1" @@ -55,9 +55,7 @@ function create_link() { } # Function to set owner and permission of a file -# $1: Owner -# $2: Permissions -# $3: File +# USAGE: set_permission OWNER PERMISSION FILE function set_permission() { echo -e "- Changing permission of ${YELLOW}${3}${RESET} to ${YELLOW}${1}${RESET}" sudo chown -R "${1}" "${3}" @@ -66,7 +64,7 @@ function set_permission() { } # Function to enable a service -# $1: Service +# USAGE: enable_service SERVICE function enable_service() { echo -e "- Enabling service ${YELLOW}${1}${RESET}" sudo systemctl enable "${1}"