added cyan to machine color in prompt

added write permission flag to acl script
added pass through options from share_dir to the acladduser
master
Kebler Network System Administrator 2021-04-14 10:51:17 -07:00
parent 5d2ccc7c4f
commit 4ad1946952
2 changed files with 19 additions and 9 deletions

View File

@ -30,7 +30,10 @@ case $TERM in
;;
esac
local UC=WHITE # user's color
local MC=CYAN # machine color
[[ $SSH_SESSION == "true" ]] && UC=LIGHT_PURPLE && MC=WHITE # remote machine color
[ $UID -eq "0" ] && UC=LIGHT_RED # root's color
# PS1="$PARENTBASE\[${UC}\]\u@\h: \[${COLOR_LIGHT_GREEN}\]→\[${COLOR_NC}\] "
@ -41,7 +44,7 @@ local dir
local branch
local promptc
user="$(c $UC)\u$(c GREY)@$(c NC)"
machine="$(c CYAN)\h$(c GREY):$(c NC)"
machine="$(c $MC)\h$(c GREY):$(c NC)"
dir="$(c YELLOW)[${PARENTBASE}]$(c NC)"
branch=$(c LIGHT_BLUE)'$(parse_git_branch)'$(c NC)
promptc=$(c GREEN)' $ '$(c NC)

View File

@ -15,21 +15,25 @@ acladduserdir() {
local uid
local usesudo
local del
local write
local spec
local dir
local cmd="-R -m "
local cmdd="-dR -m"
local opts
local optsd
declare OPTION
declare OPTARG
declare OPTIND
while getopts 'ds' OPTION; do
while getopts 'wds' OPTION; do
# echo $OPTION $OPTARG
case "$OPTION" in
d)
del=true
;;
w)
write="w"
;;
s)
usesudo="sudo"
;;
@ -49,7 +53,7 @@ acladduserdir() {
else
opts="-R -m "
optsd="-dR -m"
spec="u:$1:rwX"
spec="u:$1:r${write}X"
fi
[[ ! $2 ]] && echo acluserdir: both user and direcotory must be passed && return 1
dir=$2
@ -90,13 +94,15 @@ share_dir() {
[[ ! $(sudo -l -U $USER 2>/dev/null) ]] && echo current user does not have sudo privilges, aborting && return 4
local group
local owner=$USER
local opts=""
[[ $(getent group users) ]] && group=users || group=$USER
declare OPTION
declare OPTARG
declare OPTIND
while getopts 'g:o:' OPTION; do
while getopts 'wsg:o:' OPTION; do
# echo $OPTION $OPTARG
case "$OPTION" in
o)
@ -106,7 +112,8 @@ share_dir() {
group=$OPTARG
;;
*)
echo unknown option $OPTION
# echo adding pass through option $OPTION
opts="${opts} -${OPTION}"
;;
esac
done
@ -121,7 +128,7 @@ share_dir() {
confirm share directory $dir with users: $@ ? confirm || return 6
for user in "$@"; do
echo adding acl user $user
acladduserdir -s $user $dir
acladduserdir -s $opts $user $dir
done
echo done adding acl users $@
echo these are the chown/chmod commands that you will run