Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Dec 2, 2019
1 parent f15adbe commit f2765bd
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 11 deletions.
7 changes: 6 additions & 1 deletion cookbooks/mount-hd/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ function install()

local -r fstabConfig="${newDisk} ${mountOn} ${MOUNT_HD_FS_TYPE} ${MOUNT_HD_MOUNT_OPTIONS} ${MOUNT_HD_DUMP} ${MOUNT_HD_FSCK_OPTION}"

appendToFileIfNotFound '/etc/fstab' "$(stringToSearchPattern "${fstabConfig}")" "${fstabConfig}" 'true' 'false' 'true'
appendToFileIfNotFound \
'/etc/fstab' \
"$(stringToSearchPattern "${fstabConfig}")" "${fstabConfig}" \
'true' \
'false' \
'true'

# Display File System

Expand Down
16 changes: 14 additions & 2 deletions cookbooks/ps1/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ function install()
fi
fi

appendToFileIfNotFound "${profileFilePath}" "${prompt}" "${prompt}" 'false' 'false' 'true'
appendToFileIfNotFound \
"${profileFilePath}" \
"${prompt}" \
"${prompt}" \
'false' \
'false' \
'true'
else
warn "WARN : profile '${user}' not found"
fi
Expand All @@ -113,7 +119,13 @@ function install()

echo -e "Updating '\033[1;32m${defaultProfileFilePath}\033[0m'"

appendToFileIfNotFound "${defaultProfileFilePath}" "${defaultPrompt}" "${defaultPrompt}" 'false' 'false' 'true'
appendToFileIfNotFound \
"${defaultProfileFilePath}" \
"${defaultPrompt}" \
"${defaultPrompt}" \
'false' \
'false' \
'true'

umask '0077'
}
Expand Down
9 changes: 8 additions & 1 deletion cookbooks/redis/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ function install()

local -r overCommitMemoryConfig="vm.overcommit_memory = ${REDIS_VM_OVER_COMMIT_MEMORY}"

appendToFileIfNotFound '/etc/sysctl.conf' "$(stringToSearchPattern "${overCommitMemoryConfig}")" "\n${overCommitMemoryConfig}" 'true' 'true' 'true'
appendToFileIfNotFound \
'/etc/sysctl.conf' \
"$(stringToSearchPattern "${overCommitMemoryConfig}")" \
"\n${overCommitMemoryConfig}" \
'true' \
'true' \
'true'

sysctl "$(deleteSpaces "${overCommitMemoryConfig}")"

# Start
Expand Down
8 changes: 7 additions & 1 deletion cookbooks/ssh/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ function install()
<<< "$(cat '/etc/ssh/sshd_config')" \
> '/etc/ssh/sshd_config' || true

appendToFileIfNotFound '/etc/ssh/sshd_config' "$(stringToSearchPattern "${config}")" "${config}" 'true' 'false' 'true'
appendToFileIfNotFound \
'/etc/ssh/sshd_config' \
"$(stringToSearchPattern "${config}")" \
"${config}" \
'true' \
'false' \
'true'

grep -F "${config}" '/etc/ssh/sshd_config' | grep -v '^\s*#'
done
Expand Down
9 changes: 8 additions & 1 deletion cookbooks/tweaks/recipes/disable-icmp-timestamp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ function install()
{
umask '0022'

appendToFileIfNotFound '/etc/sysctl.conf' 'net.ipv4.icmp_echo_ignore_all = 1' 'net.ipv4.icmp_echo_ignore_all = 1' 'false' 'false' 'true'
appendToFileIfNotFound \
'/etc/sysctl.conf' \
'net.ipv4.icmp_echo_ignore_all = 1' \
'net.ipv4.icmp_echo_ignore_all = 1' \
'false' \
'false' \
'true'

cat '/etc/sysctl.conf'

umask '0077'
Expand Down
9 changes: 8 additions & 1 deletion cookbooks/tweaks/recipes/disable-tcp-timestamp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ function install()
{
umask '0022'

appendToFileIfNotFound '/etc/sysctl.conf' 'net.ipv4.tcp_timestamps = 0' 'net.ipv4.tcp_timestamps = 0' 'false' 'false' 'true'
appendToFileIfNotFound \
'/etc/sysctl.conf' \
'net.ipv4.tcp_timestamps = 0' \
'net.ipv4.tcp_timestamps = 0' \
'false' \
'false' \
'true'

cat '/etc/sysctl.conf'

umask '0077'
Expand Down
17 changes: 15 additions & 2 deletions cookbooks/vim/recipes/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ function install()

if [[ "$(isAmazonLinuxDistributor)" = 'true' || "$(isCentOSDistributor)" = 'true' || "$(isRedHatDistributor)" = 'true' ]]
then
appendToFileIfNotFound '/etc/profile' 'alias vi=vim' 'alias vi=vim' 'false' 'false' 'true'
appendToFileIfNotFound '/etc/vimrc' 'source /etc/vim/vimrc.local' 'source /etc/vim/vimrc.local' 'false' 'false' 'true'
appendToFileIfNotFound \
'/etc/profile' \
'alias vi=vim' \
'alias vi=vim' \
'false' \
'false' \
'true'

appendToFileIfNotFound \
'/etc/vimrc' \
'source /etc/vim/vimrc.local' \
'source /etc/vim/vimrc.local' \
'false' \
'false' \
'true'
fi

umask '0077'
Expand Down
16 changes: 14 additions & 2 deletions roles/nam/libraries/app.bash
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ function autoSudo()

local -r command='sudo su -l'

appendToFileIfNotFound "$(getUserHomeFolder "${userLogin}")/${profileFileName}" "${command}" "${command}" 'false' 'false' 'true'
appendToFileIfNotFound \
"$(getUserHomeFolder "${userLogin}")/${profileFileName}" \
"${command}" \
"${command}" \
'false' \
'false' \
'true'
}

function setupRepository()
Expand Down Expand Up @@ -40,5 +46,11 @@ function updateRepositoryOnLogin()

local -r command='cd /opt/linux-cookbooks/cookbooks && git pull'

appendToFileIfNotFound "$(getProfileFilePath "${userLogin}")" "${command}" "${command}" 'false' 'false' 'true'
appendToFileIfNotFound \
"$(getProfileFilePath "${userLogin}")" \
"${command}" \
"${command}" \
'false' \
'false' \
'true'
}

0 comments on commit f2765bd

Please sign in to comment.