mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-12-27 22:09:45 +00:00
7533606302
Separate utitility functions into user manager functions and monitor control functions, disable somechecks and formatting
32 lines
572 B
Bash
32 lines
572 B
Bash
#!/bin/sh -e
|
|
|
|
. ../../common-script.sh
|
|
|
|
checkGroups() {
|
|
groups="$1"
|
|
available_groups="$2"
|
|
for group in $groups; do
|
|
if ! echo "$available_groups" | grep -q -w "$group"; then
|
|
return 1
|
|
fi
|
|
done
|
|
return 0
|
|
}
|
|
|
|
confirmAction() {
|
|
confirm="$1"
|
|
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
|
|
printf "%b\n" "${RED}Cancelled operation...${RC}" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
checkEmpty() {
|
|
if [ -z "$1" ]; then
|
|
printf "%b\n" "${RED}Empty value is not allowed${RC}" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
checkEnv
|