Merge branch 'add-user' into 'master'

Add user to groups in install.sh

Closes #3

See merge request severinkaderli/dotfiles!2
This commit is contained in:
Severin Kaderli 2018-12-31 12:51:05 +00:00
commit 2167a322b7
3 changed files with 22 additions and 2 deletions

View file

@ -18,6 +18,8 @@
####################################### #######################################
# Configuration variables # Configuration variables
####################################### #######################################
USER="severin"
# Array of directories which should be created # Array of directories which should be created
DIRECTORIES=( DIRECTORIES=(
".logs" ".logs"
@ -58,6 +60,11 @@ LINKED_FILES_HOME=(
"bin" "bin"
) )
# Groups the user should be added to
ADD_GROUPS=(
"bumblebee"
)
# Array of systemd services which should be enabled # Array of systemd services which should be enabled
SYSTEMD_SERVICES=( SYSTEMD_SERVICES=(
"bumblebeed" "bumblebeed"
@ -86,8 +93,8 @@ print_header "Installing packages"
#rm -rf yay #rm -rf yay
# Install packages # Install packages
#aurman -S --noconfirm $(cat "${PACKAGES_DIR}/packages.list") #yay -S --noconfirm $(cat "${PACKAGES_DIR}/packages.list")
#aurman -S --noconfirm $(cat "${PACKAGES_DIR}/packages2.list") #yay -S --noconfirm $(cat "${PACKAGES_DIR}/packages2.list")
print_header "Creating symlinks" print_header "Creating symlinks"
for file in "${LINKED_FILES_HOME[@]}"; for file in "${LINKED_FILES_HOME[@]}";
@ -98,6 +105,12 @@ done
print_header "Give permissions" print_header "Give permissions"
set_permission severin 744 "${HOME}/bin" 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" print_header "Enabling systemd services"
for service in "${SYSTEMD_SERVICES[@]}" for service in "${SYSTEMD_SERVICES[@]}"
do 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}" 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 # Function to enable a service
# USAGE: enable_service SERVICE # USAGE: enable_service SERVICE
function enable_service() { function enable_service() {