Make kickstart.user.exec work on clients using module
The kickstart.user.exec function was using the `kickstart infect` command, which works on clients with kickstart installed (which is the case for `kickstart infect`ed terminals or baseline). This change will lookup for the client existance and use it, or use the compiled module.
This commit is contained in:
parent
44169e4f86
commit
07dad25ec4
@ -18,15 +18,32 @@ kickstart.user.remove_group() {
|
|||||||
usermod -G `kickstart.print_with_separator , ${groups[*]}` $1
|
usermod -G `kickstart.print_with_separator , ${groups[*]}` $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kickstart.user.exec.command.module() {
|
||||||
|
local cur_dir=`pwd`
|
||||||
|
cat <<COMMAND
|
||||||
|
cd modules/kickstart
|
||||||
|
source install.sh
|
||||||
|
cd $cur_dir
|
||||||
|
$@
|
||||||
|
COMMAND
|
||||||
|
}
|
||||||
|
|
||||||
|
kickstart.user.exec.command.infect() {
|
||||||
|
cat <<COMMAND
|
||||||
|
eval "$(kickstart infect)"
|
||||||
|
$@
|
||||||
|
COMMAND
|
||||||
|
}
|
||||||
|
|
||||||
kickstart.user.exec() {
|
kickstart.user.exec() {
|
||||||
local user=$1
|
local user=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
local command=$(cat <<COMMAND
|
local command=''
|
||||||
eval "$(kickstart infect)"
|
kickstart.command_exists kickstart && \
|
||||||
$@
|
command=`kickstart.user.exec.command.infect "$@"` || \
|
||||||
COMMAND
|
command=`kickstart.user.exec.command.module "$@"`
|
||||||
)
|
|
||||||
kickstart.info "Running \"$@\" as $user"
|
kickstart.info Running \'"$@"\' as $user
|
||||||
su $user - bash -c "$command"
|
su $user - bash -c "$command"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user