Add user to groups in install.sh

Closes #3

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2018-12-31 13:49:39 +01:00
parent edeb50e517
commit 0d659e9bca
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
3 changed files with 22 additions and 2 deletions

View file

@ -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

BIN
system/.config/dconf/user Normal file

Binary file not shown.

View file

@ -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() {