-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sudo option on functions with default to 'true'
- Loading branch information
1 parent
4d1e334
commit 73e5e18
Showing
7 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#----------------------------------------------------------------------- | ||
# | ||
# Basescript function | ||
# | ||
# The basescript functions were designed to work as abstract function, | ||
# so it could be used in many different contexts executing specific job | ||
# always remembering Unix concept DOTADIW - "Do One Thing And Do It Well" | ||
# | ||
# Developed by | ||
# Evert Ramos <[email protected]> | ||
# | ||
# Copyright Evert Ramos | ||
# | ||
#----------------------------------------------------------------------- | ||
# | ||
# Be careful when editing this file, it is part of a bigger script! | ||
# | ||
# Basescript - https://github.com/evertramos/basescript | ||
# | ||
#----------------------------------------------------------------------- | ||
|
||
#----------------------------------------------------------------------- | ||
# This function has one main objective: | ||
# 1. Check if user has permission on specific folder | ||
# | ||
# You must/might inform the parameters below: | ||
# 1. Full path of the folder you are checking | ||
# | ||
#----------------------------------------------------------------------- | ||
|
||
system_check_user_folder_owner() | ||
{ | ||
local LOCAL_PATH | ||
|
||
LOCAL_PATH=${1:-null} | ||
|
||
[[ $LOCAL_PATH == "" || $LOCAL_PATH == null ]] && echoerror "You must inform the folder path to the function: '${FUNCNAME[0]}'" | ||
|
||
[[ "$DEBUG" == true ]] && echo "Checking permissions in path '$LOCAL_PATH'." | ||
|
||
if [[ "$(stat -c '%u' ${LOCAL_PATH})" == "$UID" ]]; then | ||
SYSTEM_CHECK_USER_FOLDER_OWNER=true | ||
return 0 | ||
else | ||
SYSTEM_CHECK_USER_FOLDER_OWNER=false | ||
return 1 | ||
fi | ||
} | ||
|