Add dconf configuration and small fixes
Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
parent
006fddf028
commit
615d4fac8d
11 changed files with 97 additions and 29 deletions
42
utils.sh
42
utils.sh
|
@ -6,8 +6,8 @@
|
|||
# Directory variables
|
||||
#######################################
|
||||
DIR="$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)"
|
||||
SYSTEM_DIR="$DIR/system"
|
||||
PACKAGES_DIR="$DIR/packages"
|
||||
SYSTEM_DIR="${DIR}/system"
|
||||
PACKAGES_DIR="${DIR}/packages"
|
||||
|
||||
#######################################
|
||||
# Bash color code variables
|
||||
|
@ -22,22 +22,42 @@ YELLOW='\033[33m'
|
|||
# Helper functions
|
||||
#######################################
|
||||
# Function to display fancy headers
|
||||
# $1: Title
|
||||
function print_header() {
|
||||
echo -e "$GREEN########################################"
|
||||
echo -e "# $1"
|
||||
echo -e "########################################$RESET"
|
||||
echo -e "\n${GREEN}########################################"
|
||||
echo -e "# ${1}"
|
||||
echo -e "########################################${RESET}"
|
||||
}
|
||||
|
||||
# Creates the given directory in the home directory
|
||||
# $1: Directory
|
||||
function create_directory() {
|
||||
echo -e "- Creating directory ${YELLOW}${HOME}/${dir}${RESET}"
|
||||
mkdir -p "${HOME}/${dir}"
|
||||
}
|
||||
|
||||
# Creates a symlink of the given file from the home directory to here.
|
||||
# $1: Filename
|
||||
function create_link() {
|
||||
echo -e "- Linking ${YELLOW}${HOME}/${1}${RESET} -> ${YELLOW}${SYSTEM_DIR}/${1}${RESET}"
|
||||
rm -rf "${HOME:?}/$1"
|
||||
ln -fs "${SYSTEM_DIR}/${1}" "${HOME}/${1}"
|
||||
}
|
||||
|
||||
# Function to set owner and permission of a file
|
||||
# $1: Owner
|
||||
# $2: Permissions
|
||||
# $3: 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"
|
||||
echo -e "- Changing permission of ${YELLOW}${3}${RESET} to ${YELLOW}${1}${RESET}"
|
||||
sudo chown -R "${1}" "${3}"
|
||||
echo -e "- Changing permission of ${YELLOW}${3}${RESET} to ${YELLOW}${2}${RESET}"
|
||||
sudo chmod -R "${2}" "${3}"
|
||||
}
|
||||
|
||||
# Function to enable a service
|
||||
# $1: Service
|
||||
function enable_service() {
|
||||
echo -e "- Enabling service $1"
|
||||
sudo systemctl enable "$1"
|
||||
echo -e "- Enabling service ${YELLOW}${1}${RESET}"
|
||||
sudo systemctl enable "${1}"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue