From 0d659e9bcac80145c2d6bc463663aea2393649f5 Mon Sep 17 00:00:00 2001 From: Severin Kaderli Date: Mon, 31 Dec 2018 13:49:39 +0100 Subject: [PATCH] Add user to groups in install.sh Closes #3 Signed-off-by: Severin Kaderli --- install.sh | 17 +++++++++++++++-- system/.config/dconf/user | Bin 0 -> 308 bytes system/bin/utils.sh | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 system/.config/dconf/user diff --git a/install.sh b/install.sh index b1d87b9..e4aecad 100755 --- a/install.sh +++ b/install.sh @@ -18,6 +18,8 @@ ####################################### # Configuration variables ####################################### +USER="severin" + # Array of directories which should be created DIRECTORIES=( ".logs" @@ -58,6 +60,11 @@ LINKED_FILES_HOME=( "bin" ) +# Groups the user should be added to +ADD_GROUPS=( + "bumblebee" +) + # Array of systemd services which should be enabled SYSTEMD_SERVICES=( "bumblebeed" @@ -86,8 +93,8 @@ print_header "Installing packages" #rm -rf yay # Install packages -#aurman -S --noconfirm $(cat "${PACKAGES_DIR}/packages.list") -#aurman -S --noconfirm $(cat "${PACKAGES_DIR}/packages2.list") +#yay -S --noconfirm $(cat "${PACKAGES_DIR}/packages.list") +#yay -S --noconfirm $(cat "${PACKAGES_DIR}/packages2.list") print_header "Creating symlinks" for file in "${LINKED_FILES_HOME[@]}"; @@ -98,6 +105,12 @@ done print_header "Give permissions" set_permission severin 744 "${HOME}/bin" +print_header "Add user to groups" +for group in "${ADD_GROUPS[@]}" +do + add_to_group "${USER}" "${group}" +done + print_header "Enabling systemd services" for service in "${SYSTEMD_SERVICES[@]}" do diff --git a/system/.config/dconf/user b/system/.config/dconf/user new file mode 100644 index 0000000000000000000000000000000000000000..f07e771e2e83b2919e519d343c85dab33b10542e GIT binary patch literal 308 zcmXYsJqp4w7>46dMG-~BLGc2DggOY`Km{Ef#7V>yi-uw&X|QJy9P}{W!2>vSaBy(& z7WMr!frsa9@-}=KErgaLG|a9heE;W8!R}??9LQT7c$J*SWa?JflqK*BOlFrdbt&hu z|As$cFkcR#Uv9G_E8@~Bc-*oq#iE=+zXmtJ^SVA$pK=}j4%`K$wBLe$*+IXDk3NWH zxKS~Wj4-~7^DLlwmEO8EXCybiCp7nz3id(=+|#}Y4ocdmQGoWjPHawPQ$L()4 Ln-}_fMOU*gXWTaJ literal 0 HcmV?d00001 diff --git a/system/bin/utils.sh b/system/bin/utils.sh index 2af64db..0569455 100755 --- a/system/bin/utils.sh +++ b/system/bin/utils.sh @@ -83,6 +83,13 @@ function set_permission() { sudo chmod -R "${2}" "${3}" } +# Function to add a user to a group +# USAGE add_to_group USER GROUP +function add_to_group() { + print_log "Add user ${YELLOW}${1}${RESET} to group ${YELLOW}${2}${RESET} " + sudo gpasswd -a "${1}" "${2}" > /dev/null 2>&1 +} + # Function to enable a service # USAGE: enable_service SERVICE function enable_service() {